Android: use project directory path when parsing manifest

This commit is contained in:
Braden Farmer 2021-01-04 10:23:54 -07:00 committed by GitHub
parent a8390477b8
commit 67c1bf33ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ if(dynamicFeatures.exists()) {
apply from: "dynamic_features.gradle" apply from: "dynamic_features.gradle"
} }
static int getPlayStoreVersionCode() { int getPlayStoreVersionCode() {
def baseVersion = getManifestAttribute("versionCode").toInteger() def baseVersion = getManifestAttribute("versionCode").toInteger()
def baseTime = 1609632000 def baseTime = 1609632000
def halfWeek = 302400 def halfWeek = 302400
@ -158,13 +158,13 @@ static int getPlayStoreVersionCode() {
return baseVersion + increment return baseVersion + increment
} }
static String getPlayStoreVersionName() { String getPlayStoreVersionName() {
def versionName = getManifestAttribute("versionName") def versionName = getManifestAttribute("versionName")
return "$versionName (${new Date().format("yyyy-MM-dd")})" return "$versionName (${new Date().format("yyyy-MM-dd")})"
} }
static String getManifestAttribute(String attribute) { String getManifestAttribute(String attribute) {
def manifest = new XmlParser().parse("AndroidManifest.xml") def manifest = new XmlParser().parse("${project.projectDir}/AndroidManifest.xml")
return manifest.attributes().find { return manifest.attributes().find {
((String) it.key).contains(attribute) ((String) it.key).contains(attribute)
}.value }.value