This commit is contained in:
Benoit Marty 2020-10-22 16:10:08 +02:00
parent 6a1238d2c5
commit 60556d0fa0
1 changed files with 6 additions and 5 deletions

View File

@ -39,9 +39,9 @@ def generateVersionCodeFromVersionName() {
def getVersionCode() { def getVersionCode() {
if (gitBranchName() == "develop") { if (gitBranchName() == "develop") {
return generateVersionCodeFromTimestamp() * 10 return generateVersionCodeFromTimestamp()
} else { } else {
return generateVersionCodeFromVersionName() * 10 return generateVersionCodeFromVersionName()
} }
} }
@ -166,13 +166,14 @@ android {
} }
applicationVariants.all { variant -> applicationVariants.all { variant ->
// assign different version code for each output
def baseVariantVersion = variant.versionCode * 10
variant.outputs.each { output -> variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiVersionCodes.get(output.getFilter(OutputFile.ABI)) def baseAbiVersionCode = project.ext.abiVersionCodes.get(output.getFilter(OutputFile.ABI))
// Known limitation: it does not modify the value in the BuildConfig.java generated file // Known limitation: it does not modify the value in the BuildConfig.java generated file
print "ABI " + output.getFilter(OutputFile.ABI) + " \tvariant.versionCode " + variant.versionCode
// See https://issuetracker.google.com/issues/171133218 // See https://issuetracker.google.com/issues/171133218
output.versionCodeOverride = variant.versionCode + baseAbiVersionCode output.versionCodeOverride = baseVariantVersion + baseAbiVersionCode
print " \t-> VersionCode = " + output.versionCodeOverride + "\n" print "ABI " + output.getFilter(OutputFile.ABI) + " \t-> VersionCode = " + output.versionCodeOverride + "\n"
} }
} }