From b79c0926e53a90d3f1ac5d065f24bb93f091c7fa Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Sun, 3 May 2015 10:29:18 -0400 Subject: populating the version name and code in about.html at build time --- app/build.gradle | 37 +++++++++++++++++ app/src/main/AndroidManifest.xml | 2 +- app/src/main/assets/.gitignore | 2 + app/src/main/assets/about.html | 87 --------------------------------------- app/src/main/templates/about.html | 87 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 127 insertions(+), 88 deletions(-) create mode 100644 app/src/main/assets/.gitignore delete mode 100644 app/src/main/assets/about.html create mode 100644 app/src/main/templates/about.html (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index d85803538..4561dd930 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import org.apache.tools.ant.filters.ReplaceTokens + apply plugin: 'com.android.application' repositories { @@ -24,6 +26,20 @@ dependencies { compile project(':library:drag-sort-listview') } +def getMyVersionName() { + def parsedManifestXml = (new XmlSlurper()) + .parse('app/src/main/AndroidManifest.xml') + .declareNamespace(android:"http://schemas.android.com/apk/res/android") + return parsedManifestXml.'@android:versionName' +} + +def getMyVersionCode() { + def parsedManifestXml = (new XmlSlurper()) + .parse('app/src/main/AndroidManifest.xml') + .declareNamespace(android:"http://schemas.android.com/apk/res/android") + return parsedManifestXml.'@android:versionCode'.toInteger() +} + android { compileSdkVersion 21 buildToolsVersion "21.1.2" @@ -31,6 +47,8 @@ android { defaultConfig { minSdkVersion 10 targetSdkVersion 21 + versionCode getMyVersionCode() + versionName "${getMyVersionName()}" testApplicationId "de.test.antennapod" testInstrumentationRunner "de.test.antennapod.AntennaPodTestRunner" } @@ -89,4 +107,23 @@ android { lintOptions { abortOnError false } +} + +// about.html is templatized so that we can automatically insert +// our version string in to it at build time. +task filterAbout { + inputs.files files(['src/main/templates/about.html', + 'src/main/AndroidManifest.xml']) + outputs.file 'src/main/assests/about.html' +} << { + copy { + from 'src/main/templates/about.html' + into 'src/main/assets' + filter(ReplaceTokens, tokens: [versionname: android.defaultConfig.versionName, + versioncode: android.defaultConfig.versionCode.toString()]) + } +} + +gradle.projectsEvaluated { + preBuild.dependsOn filterAbout } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7a4c8366e..97f8bbdad 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="1.2"> diff --git a/app/src/main/assets/.gitignore b/app/src/main/assets/.gitignore new file mode 100644 index 000000000..328840cfc --- /dev/null +++ b/app/src/main/assets/.gitignore @@ -0,0 +1,2 @@ +# this file is generated automatically +about.html diff --git a/app/src/main/assets/about.html b/app/src/main/assets/about.html deleted file mode 100644 index af7297564..000000000 --- a/app/src/main/assets/about.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - About AntennaPod - - - -

Used libraries

- -

Apache Commons (Link)

-by The Apache Software Foundation, licensed under the Apache 2.0 license (View) - -

flattr4j (Link)

-licensed under the Apache 2.0 license (View) - -

drag-sort-listview (Link)

-licensed under the Apache 2.0 license (View) - -

Presto Client (Link)

-licensed under the Apache 2.0 license (View) - -

jsoup (Link)

-licensed under the MIT license (View) - -

Picasso (Link)

-licensed under the Apache 2.0 license (View) - -

OkHttp (Link)

-licensed under the Apache 2.0 license (View) - -

Okio (Link)

-licensed under the Apache 2.0 license (View) - -

Material Design Icons (Link)

-by Google, licensed under an Attribution-ShareAlike 4.0 International license (View) - -

EventBus (Link>)

-by greenrobot, licensed under the Apache 2.0 license (View) - -

Iconify (Link>)

-by Joan Zapata, licensed under the Apache 2.0 license (View) - - - diff --git a/app/src/main/templates/about.html b/app/src/main/templates/about.html new file mode 100644 index 000000000..df7a05b70 --- /dev/null +++ b/app/src/main/templates/about.html @@ -0,0 +1,87 @@ + + + + + + About AntennaPod + + + +

Used libraries

+ +

Apache Commons (Link)

+by The Apache Software Foundation, licensed under the Apache 2.0 license (View) + +

flattr4j (Link)

+licensed under the Apache 2.0 license (View) + +

drag-sort-listview (Link)

+licensed under the Apache 2.0 license (View) + +

Presto Client (Link)

+licensed under the Apache 2.0 license (View) + +

jsoup (Link)

+licensed under the MIT license (View) + +

Picasso (Link)

+licensed under the Apache 2.0 license (View) + +

OkHttp (Link)

+licensed under the Apache 2.0 license (View) + +

Okio (Link)

+licensed under the Apache 2.0 license (View) + +

Material Design Icons (Link)

+by Google, licensed under an Attribution-ShareAlike 4.0 International license (View) + +

EventBus (Link>)

+by greenrobot, licensed under the Apache 2.0 license (View) + +

Iconify (Link>)

+by Joan Zapata, licensed under the Apache 2.0 license (View) + + + -- cgit v1.2.3 From 5a8702c299bfa9695ee4f359c2f9a0a6e8d653e3 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Sun, 3 May 2015 10:33:21 -0400 Subject: Updated copyright and contributors file --- app/src/main/templates/about.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/templates/about.html b/app/src/main/templates/about.html index df7a05b70..3a48eeec1 100644 --- a/app/src/main/templates/about.html +++ b/app/src/main/templates/about.html @@ -43,7 +43,9 @@

AntennaPod, Version @versionname@, Build @versioncode@

-

Copyright © 2014 Daniel Oeh

+

Created by Daniel Oeh

+ +

Copyright © 2015 AntennaPod Contributors (View)

Licensed under the MIT License (View)

-- cgit v1.2.3 From 82464b86c8b432904c0af7e71f71c4ff9cff21e0 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Sun, 3 May 2015 14:16:32 -0400 Subject: fixed typo --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 4561dd930..9e43f1ed3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -114,7 +114,7 @@ android { task filterAbout { inputs.files files(['src/main/templates/about.html', 'src/main/AndroidManifest.xml']) - outputs.file 'src/main/assests/about.html' + outputs.file 'src/main/assets/about.html' } << { copy { from 'src/main/templates/about.html' -- cgit v1.2.3 From e93a631aab90b016ff087a4f13efa56c23847979 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Sun, 3 May 2015 14:45:36 -0400 Subject: removed 'projectsEvaluated' to fix AntennaPod build --- app/build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 9e43f1ed3..bb1fa26b7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -124,6 +124,4 @@ task filterAbout { } } -gradle.projectsEvaluated { - preBuild.dependsOn filterAbout -} \ No newline at end of file +preBuild.dependsOn filterAbout \ No newline at end of file -- cgit v1.2.3