Backed out 3 changesets (bug 1895781) for causing gradle-dependencies failures CLOSED TREE

Backed out changeset eccc129ad554 (bug 1895781)
Backed out changeset 2ffa0d4d2326 (bug 1895781)
Backed out changeset 278306033d92 (bug 1895781)
This commit is contained in:
Cristian Tuns 2024-05-09 19:26:48 -04:00
parent 79bbfad9be
commit b636f63a07
8 changed files with 142 additions and 166 deletions

View file

@ -89,13 +89,6 @@ subprojects {
}
}
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcdir')) {
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopobjdir')) {
ext.topobjdir = gradle."localProperties.dependencySubstitutions.geckoviewTopobjdir"
}
ext.topsrcdir = gradle."localProperties.dependencySubstitutions.geckoviewTopsrcdir"
apply from: "${topsrcdir}/substitute-local-geckoview.gradle"
}
afterEvaluate {
if (it.hasProperty('android')) {

View file

@ -27,7 +27,6 @@ plugins {
ext.topsrcdir = rootProject.projectDir.absolutePath.minus("mobile/android/android-components")
apply from: file('../shared-settings.gradle')
apply from: file('../autopublish-settings.gradle')
buildCache {
local {
@ -36,17 +35,67 @@ buildCache {
}
}
def runCmd(cmd, workingDir, successMessage) {
def proc = cmd.execute(null, new File(workingDir))
proc.consumeProcessOutput(System.out, System.err)
proc.waitFor()
if (proc.exitValue() != 0) {
throw new GradleException("Process '${cmd}' finished with non-zero exit value ${proc.exitValue()}")
} else {
logger.lifecycle(successMessage)
}
}
//////////////////////////////////////////////////////////////////////////
// Local Development overrides
//////////////////////////////////////////////////////////////////////////
def projectLocalProperties = file("local.properties").with { localPropertiesFile ->
def localProperties = new Properties()
if (localPropertiesFile.canRead()) {
localPropertiesFile.withInputStream { localProperties.load(it) }
Properties localProperties = null;
String settingAppServicesPath = "autoPublish.application-services.dir"
String settingGleanPath = "autoPublish.glean.dir";
if (file('local.properties').canRead()) {
localProperties = new Properties()
localProperties.load(file('local.properties').newDataInputStream())
logger.lifecycle('Local configuration: loaded local.properties')
} else {
logger.lifecycle('Local configuration: absent local.properties; proceeding as normal.')
}
if (localProperties != null) {
localProperties.each { prop ->
gradle.ext.set("localProperties.${prop.key}", prop.value)
}
String appServicesLocalPath = localProperties.getProperty(settingAppServicesPath);
if (appServicesLocalPath != null) {
logger.lifecycle("Enabling automatic publication of application-services from: $appServicesLocalPath")
// Windows can't execute .py files directly, so we assume a "manually installed" python,
// which comes with a "py" launcher and respects the shebang line to specify the version.
def publishAppServicesCmd = [];
if (System.properties['os.name'].toLowerCase().contains('windows')) {
publishAppServicesCmd << "py";
}
publishAppServicesCmd << "./automation/publish_to_maven_local_if_modified.py";
runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.")
} else {
logger.lifecycle("Disabled auto-publication of application-services. Enable it by settings '$settingAppServicesPath' in local.properties")
}
String gleanLocalPath = localProperties.getProperty(settingGleanPath);
if (gleanLocalPath != null) {
logger.lifecycle("Enabling automatic publication of Glean from: $gleanLocalPath")
// Windows can't execute .py files directly, so we assume a "manually installed" python,
// which comes with a "py" launcher and respects the shebang line to specify the version.
def publishGleanCmd = [];
if (System.properties['os.name'].toLowerCase().contains('windows')) {
publishGleanCmd << "py";
}
publishGleanCmd << "./build-scripts/publish_to_maven_local_if_modified.py";
runCmd(publishGleanCmd, gleanLocalPath, "Published Glean for local development.")
} else {
logger.lifecycle("Disabled auto-publication of Glean. Enable it by settings '$settingGleanPath' in local.properties")
}
localProperties
}
projectLocalProperties.each { prop ->
gradle.ext."localProperties.${prop.key}" = prop.value
}

View file

@ -1,114 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This settings file configures an Android project for substituting a
// local Application Services and/or Glean.
//
// For convenience, this file reads the `autoPublish.*` properties from
// `$topsrcdir/local.properties`, so that you only need to set them once
// for all Android projects.
//
// You can also set or override these properties on a per-project basis,
// by setting them in `$topsrcdir/mobile/android/{project}/local.properties`,
// if you want to only substitute App Services or Glean for a specific project,
// or to substitute different versions for different projects.
//
// This settings file configures the build to automatically publish the
// contents of your Application Services and Glean checkouts to the
// Maven local repository. Any dependencies are then substituted to use
// the locally published versions.
def rootLocalProperties = new File(gradle.mozconfig.topsrcdir, "local.properties").with { localPropertiesFile ->
def localProperties = new Properties()
if (localPropertiesFile.canRead()) {
localPropertiesFile.withInputStream { localProperties.load(it) }
}
localProperties
}
[
"autoPublish.application-services.dir",
"autoPublish.glean.dir",
].each { key ->
def relativeOrAbsolutePath = rootLocalProperties."$key"
if (relativeOrAbsolutePath != null) {
def autoPublishDir = new File(gradle.mozconfig.topsrcdir).toPath().resolve(relativeOrAbsolutePath)
gradle.ext."localProperties.$key" = autoPublishDir.toString()
}
}
gradle.settingsEvaluated {
if (gradle.hasProperty("localProperties.autoPublish.application-services.dir")) {
// The project that we're configuring now might have overridden
// the path from `$topsrcdir/local.properties`, so we need to
// resolve it again.
def appServicesLocalPath = gradle."localProperties.autoPublish.application-services.dir".with { relativeOrAbsolutePath ->
def absolutePath = rootDir.toPath().resolve(relativeOrAbsolutePath).toString()
gradle."localProperties.autoPublish.application-services.dir" = absolutePath
absolutePath
}
logger.lifecycle("settings.gradle> Enabling automatic publication of application-services from: $appServicesLocalPath")
// Windows can't execute .py files directly, so we assume a "manually installed" python,
// which comes with a "py" launcher and respects the shebang line to specify the version.
def publishAppServicesCmd = [];
if (System.properties["os.name"].toLowerCase().contains("windows")) {
publishAppServicesCmd << "py";
}
publishAppServicesCmd << "./automation/publish_to_maven_local_if_modified.py";
runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.", false)
} else {
logger.lifecycle("settings.gradle> Disabled auto-publication of application-services. Enable it by settings 'autoPublish.application-services.dir' in local.properties")
}
if (gradle.hasProperty("localProperties.autoPublish.glean.dir")) {
// As above, absolutize the path.
def gleanLocalPath = gradle."localProperties.autoPublish.glean.dir".with { relativeOrAbsolutePath ->
def absolutePath = rootDir.toPath().resolve(relativeOrAbsolutePath).toString()
gradle."localProperties.autoPublish.glean.dir" = absolutePath
absolutePath
}
logger.lifecycle("settings.gradle> Enabling automatic publication of Glean from: $gleanLocalPath")
// As above, hacks to execute .py files on Windows.
def publishGleanCmd = [];
if (System.properties["os.name"].toLowerCase().contains("windows")) {
publishGleanCmd << "py";
}
publishGleanCmd << "./build-scripts/publish_to_maven_local_if_modified.py";
runCmd(publishGleanCmd, gleanLocalPath, "Published Glean for local development.", false)
} else {
logger.lifecycle("settings.gradle> Disabled auto-publication of Glean. Enable it by settings 'autoPublish.glean.dir' in local.properties")
}
}
gradle.projectsLoaded { ->
gradle.rootProject.allprojects {
// Allow local appservices substitution in each project.
if (gradle.hasProperty("localProperties.autoPublish.application-services.dir")) {
def appServicesSrcDir = gradle."localProperties.autoPublish.application-services.dir"
apply from: "${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle"
}
// Allow local Glean substitution in each project.
if (gradle.hasProperty('localProperties.autoPublish.glean.dir')) {
def gleanSrcDir = gradle."localProperties.autoPublish.glean.dir"
apply from: "${gleanSrcDir}/build-scripts/substitute-local-glean.gradle"
}
}
}
def runCmd(cmd, workingDir, successMessage, captureStdout = true) {
def proc = cmd.execute(null, new File(workingDir))
def standardOutput = captureStdout ? new ByteArrayOutputStream() : System.out
proc.consumeProcessOutput(standardOutput, System.err)
proc.waitFor()
if (proc.exitValue() != 0) {
throw new GradleException("Process '${cmd}' finished with non-zero exit value ${proc.exitValue()}");
} else {
logger.lifecycle("settings.gradle> ${successMessage}")
}
return captureStdout ? standardOutput : null
}

View file

@ -890,14 +890,6 @@ afterEvaluate {
}
}
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcdir')) {
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopobjdir')) {
ext.topobjdir = gradle."localProperties.dependencySubstitutions.geckoviewTopobjdir"
}
ext.topsrcdir = gradle."localProperties.dependencySubstitutions.geckoviewTopsrcdir"
apply from: "${topsrcdir}/substitute-local-geckoview.gradle"
}
android.applicationVariants.configureEach { variant ->
tasks.register("apkSize${variant.name.capitalize()}", ApkSizeTask) {
variantName = variant.name

View file

@ -33,7 +33,6 @@ plugins {
ext.topsrcdir = rootProject.projectDir.absolutePath.minus("mobile/android/fenix")
apply from: file('../shared-settings.gradle')
apply from: file('../autopublish-settings.gradle')
include ':app'
include ':mozilla-detekt-rules'
@ -55,18 +54,3 @@ gradle.projectsLoaded { ->
}
}
}
//////////////////////////////////////////////////////////////////////////
// Local Development overrides
//////////////////////////////////////////////////////////////////////////
def projectLocalProperties = file("local.properties").with { localPropertiesFile ->
def localProperties = new Properties()
if (localPropertiesFile.canRead()) {
localPropertiesFile.withInputStream { localProperties.load(it) }
}
localProperties
}
projectLocalProperties.each { prop ->
gradle.ext."localProperties.${prop.key}" = prop.value
}

View file

@ -31,7 +31,6 @@ plugins {
ext.topsrcdir = rootProject.projectDir.absolutePath.minus("mobile/android/focus-android")
apply from: file('../shared-settings.gradle')
apply from: file('../autopublish-settings.gradle')
include ':app'
@ -50,13 +49,3 @@ gradle.projectsLoaded { ->
}
}
}
def projectLocalProperties = new Properties().apply { localProperties ->
def localPropertiesFile = file("local.properties")
if (localPropertiesFile.canRead()) {
localPropertiesFile.withInputStream { localProperties.load(it) }
}
}
projectLocalProperties.each { prop ->
gradle.ext."localProperties.${prop.key}" = prop.value
}

View file

@ -168,5 +168,89 @@ gradle.projectsLoaded { ->
expand(values)
}
}
// Allow local appservices substitution in each project.
if (gradle.hasProperty("localProperties.autoPublish.application-services.dir")) {
def appServicesSrcDir = gradle."localProperties.autoPublish.application-services.dir"
apply from: "${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle"
}
// Allow local Glean substitution in each project.
if (gradle.hasProperty('localProperties.autoPublish.glean.dir')) {
def gleanSrcDir = gradle."localProperties.autoPublish.glean.dir"
apply from: "${gleanSrcDir}/build-scripts/substitute-local-glean.gradle"
}
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcdir')) {
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopobjdir')) {
ext.topobjdir = gradle."localProperties.dependencySubstitutions.geckoviewTopobjdir"
}
ext.topsrcdir = gradle."localProperties.dependencySubstitutions.geckoviewTopsrcdir"
apply from: "${topsrcdir}/substitute-local-geckoview.gradle"
}
}
}
def runCmd(cmd, workingDir, successMessage, captureStdout = true) {
def proc = cmd.execute(null, new File(workingDir))
def standardOutput = captureStdout ? new ByteArrayOutputStream() : System.out
proc.consumeProcessOutput(standardOutput, System.err)
proc.waitFor()
if (proc.exitValue() != 0) {
throw new GradleException("Process '${cmd}' finished with non-zero exit value ${proc.exitValue()}");
} else {
logger.lifecycle("settings.gradle> ${successMessage}")
}
return captureStdout ? standardOutput : null
}
//////////////////////////////////////////////////////////////////////////
// Local Development overrides
//////////////////////////////////////////////////////////////////////////
def localPropertiesFile = new File(gradle.mozconfig.topsrcdir, "local.properties")
if (localPropertiesFile.canRead()) {
def localProperties = new Properties()
localPropertiesFile.withInputStream { localProperties.load(it) }
[
"autoPublish.application-services.dir",
"autoPublish.glean.dir",
].each { key ->
def relativeOrAbsolutePath = localProperties."$key"
if (relativeOrAbsolutePath != null) {
def autoPublishDir = new File(gradle.mozconfig.topsrcdir).toPath().resolve(relativeOrAbsolutePath)
gradle.ext."localProperties.$key" = autoPublishDir.toString()
}
}
}
if (gradle.hasProperty("localProperties.autoPublish.application-services.dir")) {
def appServicesLocalPath = gradle."localProperties.autoPublish.application-services.dir"
logger.lifecycle("settings.gradle> Enabling automatic publication of application-services from: $appServicesLocalPath")
// Windows can't execute .py files directly, so we assume a "manually installed" python,
// which comes with a "py" launcher and respects the shebang line to specify the version.
def publishAppServicesCmd = [];
if (System.properties["os.name"].toLowerCase().contains("windows")) {
publishAppServicesCmd << "py";
}
publishAppServicesCmd << "./automation/publish_to_maven_local_if_modified.py";
runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.", false)
} else {
logger.lifecycle("settings.gradle> Disabled auto-publication of application-services. Enable it by settings 'autoPublish.application-services.dir' in local.properties")
}
if (gradle.hasProperty("localProperties.autoPublish.glean.dir")) {
def gleanLocalPath = gradle."localProperties.autoPublish.glean.dir"
logger.lifecycle("settings.gradle> Enabling automatic publication of Glean from: $gleanLocalPath")
// As above, hacks to execute .py files on Windows.
def publishGleanCmd = [];
if (System.properties["os.name"].toLowerCase().contains("windows")) {
publishGleanCmd << "py";
}
publishGleanCmd << "./build-scripts/publish_to_maven_local_if_modified.py";
runCmd(publishGleanCmd, gleanLocalPath, "Published Glean for local development.", false)
} else {
logger.lifecycle("settings.gradle> Disabled auto-publication of Glean. Enable it by settings 'autoPublish.glean.dir' in local.properties")
}

View file

@ -33,7 +33,6 @@ plugins {
ext.topsrcdir = rootProject.projectDir.absolutePath
apply from: "${topsrcdir}/mobile/android/shared-settings.gradle"
apply from: "${topsrcdir}/mobile/android/autopublish-settings.gradle"
// Set the Android SDK location. This is the *least specific* mechanism, which
// is unfortunate: we'd prefer to use the *most specific* mechanism. That is,