From 7d027b2280382d7d27cdddfa56a82ec38da59d6c Mon Sep 17 00:00:00 2001 From: bendk Date: Thu, 19 May 2022 10:47:37 -0400 Subject: [PATCH] Added features to support application-services branch builds (#22945) - Added support for `localProperties.branchBuild.application-services` and `localProperties.branchBuild.android-components`. These work like the autoPublish properties. However, rather than auto-building/publishing application-services/android-components as part of the fenix build, we build it ahead of time with a specific version name, then specify that version in `local.properties` as `localProperties.branchBuild.application-services.version`. - Added support for the `localProperties.branchBuild.fenix` gradle property to set the version for fenito set the version for fenix - Added support for the absolute paths when running the substutition scripts. The plan is to use this feature to build/test fenix using a particular checkout of application-services and androd-components, with the versions set to the git commit id. --- app/build.gradle | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 163362052..f1af1a008 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -237,7 +237,6 @@ 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 = variant.buildType.name == 'nightly' ? Config.nightlyVersionName() : Config.releaseVersionName(project) println("----------------------------------------------") println("Variant name: " + variant.name) @@ -251,6 +250,7 @@ android.applicationVariants.all { variant -> // same version code. Therefore we need to have different version codes for our ARM and x86 // builds. + def versionName = variant.buildType.name == 'nightly' ? Config.nightlyVersionName() : Config.releaseVersionName(project) println("versionName override: $versionName") variant.outputs.each { output -> @@ -267,6 +267,12 @@ android.applicationVariants.all { variant -> output.versionNameOverride = versionName output.versionCodeOverride = versionCodeOverride } + } else if (gradle.hasProperty("localProperties.branchBuild.fenix.version")) { + def versionName = gradle.getProperty("localProperties.branchBuild.fenix.version") + println("versionName override: $versionName") + variant.outputs.each { output -> + output.versionNameOverride = versionName + } } // ------------------------------------------------------------------------------------------------- @@ -794,14 +800,32 @@ if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcd apply from: "${topsrcdir}/substitute-local-geckoview.gradle" } +def acSrcDir = null if (gradle.hasProperty('localProperties.autoPublish.android-components.dir')) { - ext.acSrcDir = gradle."localProperties.autoPublish.android-components.dir" - apply from: "../${acSrcDir}/substitute-local-ac.gradle" + acSrcDir = gradle.getProperty('localProperties.autoPublish.android-components.dir') +} else if (gradle.hasProperty('localProperties.branchBuild.android-components.dir')) { + acSrcDir = gradle.getProperty('localProperties.branchBuild.android-components.dir') +} +if (acSrcDir) { + if (acSrcDir.startsWith("/")) { + apply from: "${acSrcDir}/substitute-local-ac.gradle" + } else { + apply from: "../${acSrcDir}/substitute-local-ac.gradle" + } } +def appServicesSrcDir = null if (gradle.hasProperty('localProperties.autoPublish.application-services.dir')) { - ext.appServicesSrcDir = gradle."localProperties.autoPublish.application-services.dir" - apply from: "../${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle" + appServicesSrcDir = gradle.getProperty('localProperties.autoPublish.application-services.dir') +} else if (gradle.hasProperty('localProperties.branchBuild.application-services.dir')) { + appServicesSrcDir = gradle.getProperty('localProperties.branchBuild.application-services.dir') +} +if (appServicesSrcDir) { + if (appServicesSrcDir.startsWith("/")) { + apply from: "${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle" + } else { + apply from: "../${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle" + } } if (gradle.hasProperty('localProperties.autoPublish.glean.dir')) {