Merge pull request #788 from TomHennen/update_version_automatically_701

Update about.html version automatically
This commit is contained in:
Tom Hennen 2015-05-03 15:28:42 -04:00
commit 9c6c218aa1
5 changed files with 44 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Code contributions:
danieloeh
patheticpat
toggles
ligi

View File

@ -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,21 @@ 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/assets/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()])
}
}
preBuild.dependsOn filterAbout

View File

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.danoeh.antennapod"
android:versionCode="51"
android:versionName="1.1.1">
android:versionName="1.2">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

2
app/src/main/assets/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# this file is generated automatically
about.html

View File

@ -41,9 +41,11 @@
<div id="header" align="center">
<img src="logo.png" alt="Logo" width="100px" height="100px"/>
<p>AntennaPod, Version 1.1</p>
<p>AntennaPod, Version @versionname@, Build @versioncode@</p>
<p>Copyright © 2014 Daniel Oeh</p>
<p>Created by Daniel Oeh</p>
<p>Copyright © 2015 AntennaPod Contributors <a href="https://github.com/AntennaPod/AntennaPod/blob/master/CONTRIBUTORS">(View)</a></p>
<p>Licensed under the MIT License <a href="LICENSE.html">(View)</a></p>
</div>