From 70fe7d5886ba8465bfb61a14a27bb25322121f15 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Wed, 28 Apr 2021 11:50:57 +0200 Subject: [PATCH] Issue #10941: Align Nightly version with Gecko/A-C version. Instead of using a timestamp this will synchronize the Nightly version with the version of Gecko / A-C. So when using 90.0.20210426143115 then the Nightly version will be 90.0a1 - similar to what Firefox desktop uses. --- app/build.gradle | 4 +++- buildSrc/src/main/java/Config.kt | 8 ++++++++ taskcluster/fenix_taskgraph/transforms/build.py | 7 ++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1275b8e7a..5234c6ad1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -231,7 +231,7 @@ android.applicationVariants.all { variant -> def isDebug = variant.buildType.resValues['IS_DEBUG']?.value ?: false def useReleaseVersioning = variant.buildType.buildConfigFields['USE_RELEASE_VERSIONING']?.value ?: false - def versionName = Config.releaseVersionName(project) + def versionName = variant.buildType.name == 'nightly' ? Config.nightlyVersionName() : Config.releaseVersionName(project) println("----------------------------------------------") println("Variant name: " + variant.name) @@ -245,6 +245,8 @@ android.applicationVariants.all { variant -> // same version code. Therefore we need to have different version codes for our ARM and x86 // builds. + println("versionName override: $versionName") + variant.outputs.each { output -> def abi = output.getFilter(OutputFile.ABI) // We use the same version code generator, that we inherited from Fennec, across all channels - even on diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index ff824ff74..7460906f4 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -36,6 +36,14 @@ object Config { return if (project.hasProperty("versionName")) project.property("versionName") as String else "" } + @JvmStatic + fun nightlyVersionName(): String { + // Nightly versions use the Gecko/A-C major version and append "0.a1", e.g. with A-C 90.0.20210426143115 + // the Nightly version will be 90.0a1 + val majorVersion = AndroidComponents.VERSION.split(".")[0] + return "$majorVersion.0a1" + } + @JvmStatic fun generateBuildDate(): String { val dateTime = LocalDateTime.now() diff --git a/taskcluster/fenix_taskgraph/transforms/build.py b/taskcluster/fenix_taskgraph/transforms/build.py index 4a65b4abb..4c8029a69 100644 --- a/taskcluster/fenix_taskgraph/transforms/build.py +++ b/taskcluster/fenix_taskgraph/transforms/build.py @@ -95,14 +95,11 @@ def add_disable_optimization(config, tasks): @transforms.add def add_nightly_version(config, tasks): - push_date_string = config.params["moz_build_date"] - push_date_time = datetime.datetime.strptime(push_date_string, "%Y%m%d%H%M%S") - formated_date_time = 'Nightly {}'.format(push_date_time.strftime('%y%m%d %H:%M')) - for task in tasks: if task.pop("include-nightly-version", False): task["run"]["gradlew"].extend([ - '-PversionName={}'.format(formated_date_time), + # We only set the `official` flag here. The actual version name will be determined + # by Gradle (depending on the Gecko/A-C version being used) '-Pofficial' ]) yield task