simplify versionCode

removed implementation was some Eclipse/ant style, now it's Gradle style
This commit is contained in:
Hannes Achleitner 2019-01-27 10:55:08 +01:00
parent 0474717ba1
commit 8e5abeea3a
3 changed files with 9 additions and 27 deletions

View File

@ -18,20 +18,6 @@ buildscript {
}
}
def getMyVersionName() {
def parsedManifestXml = (new XmlSlurper())
.parse("${projectDir}/src/main/AndroidManifest.xml")
.declareNamespace(android: "http://schemas.android.com/apk/res/android")
return parsedManifestXml."@android:versionName"
}
def getMyVersionCode() {
def parsedManifestXml = (new XmlSlurper())
.parse("${projectDir}/src/main/AndroidManifest.xml")
.declareNamespace(android: "http://schemas.android.com/apk/res/android")
return parsedManifestXml."@android:versionCode".toInteger()
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
@ -40,8 +26,12 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled true
versionCode getMyVersionCode()
versionName "${getMyVersionName()}"
// Version code schema:
// "1.2.3-SNAPSHOT" -> 1020300
// "1.2.3-RC4" -> 1020304
// btw I would recommend to autogenerate this
versionCode 1070195
versionName "1.7.1"
testApplicationId "de.test.antennapod"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
generatedDensities = []

View File

@ -1,14 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.danoeh.antennapod"
android:installLocation="auto"
android:versionCode="1070195"
android:versionName="1.7.1">
<!--
Version code schema:
"1.2.3-SNAPSHOT" -> 1020300
"1.2.3-RC4" -> 1020304
-->
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>

View File

@ -1,10 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'