mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-27 01:03:15 +01:00
populating the version name and code in about.html at build time
This commit is contained in:
parent
4e78205e62
commit
b79c0926e5
@ -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
|
||||
}
|
@ -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
2
app/src/main/assets/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# this file is generated automatically
|
||||
about.html
|
@ -41,7 +41,7 @@
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user