Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fixed FxR Version Code
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Mar 16, 2020
1 parent 42022ca commit 45a568a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 28 deletions.
27 changes: 1 addition & 26 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -563,34 +563,9 @@ if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcd
// -------------------------------------------------------------------------------------------------

android.applicationVariants.all { variant ->
def buildType = variant.buildType.name
if (gradle.hasProperty('userProperties.taskclusterBuild')) {
def versionCode = generatedVersionCode

// The Google Play Store does not allow multiple APKs for the same app that all have the
// same version code. Therefore we need to have different version codes for our ARM and x86
// builds.
// Our generated version code has a length of 8 (See tools/gradle/versionCode.gradle).
// We will prefix our ARM builds with 1 and our x86 builds with 2. Our x86 builds need a
// higher version code to avoid installing ARM builds on an x86 device with ARM
// compatibility mode.
def multiplier = 100000000

if (variant.flavorName.contains("x86_64")) {
versionCode = versionCode + (3 * multiplier)
} else if (variant.flavorName.contains("Aarch64")) {
versionCode = versionCode + (2 * multiplier)
} else if (variant.flavorName.contains("Arm")) {
versionCode = versionCode + (1 * multiplier)
}

variant.outputs.each { output ->
output.versionCodeOverride = versionCode
output.versionCodeOverride = generatedVersionCode
}
}

println("----------------------------------------------")
println("Build type: " + buildType)
println("Flavor: " + variant.flavorName)
println("Version code: " + variant.mergedFlavor.versionCode)
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static boolean contains(String[] aTarget, String aText) {
* @return String The converted date in the format yyyy-MM-dd
*/
public static String versionCodeToDate(final @NonNull Context context, final int aVersionCode) {
String versionCode = Integer.toString(aVersionCode);
String versionCode = Integer.toString(aVersionCode - 100000000);

String formatted;
try {
Expand Down
4 changes: 3 additions & 1 deletion tools/gradle/versionCode.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ ext {
// minute.
def time = new SimpleDateFormat("HHmm").format(today)

generatedVersionCode = (year + day + time) as int
def baseNumber = (year + day + time) as int

generatedVersionCode = 100000000 + baseNumber

println("Generated versionCode: $generatedVersionCode")
println()
Expand Down

0 comments on commit 45a568a

Please sign in to comment.