Skip to content

Commit

Permalink
Fixed FxR Version Code (#2968)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Mar 17, 2020
1 parent 538470b commit 1205a25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/build.gradle
Expand Up @@ -558,3 +558,14 @@ if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcd
apply from: "${topsrcdir}/substitute-local-geckoview.gradle"
}

// -------------------------------------------------------------------------------------------------
// Dynamically set versionCode (See tools/build/versionCode.gradle
// -------------------------------------------------------------------------------------------------

android.applicationVariants.all { variant ->
if (gradle.hasProperty('userProperties.taskclusterBuild')) {
variant.outputs.each { output ->
output.versionCodeOverride = generatedVersionCode
}
}
}
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
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 1205a25

Please sign in to comment.