summaryrefslogtreecommitdiffstats
path: root/mobile/android/focus-android/settings.gradle
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /mobile/android/focus-android/settings.gradle
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/focus-android/settings.gradle')
-rw-r--r--mobile/android/focus-android/settings.gradle89
1 files changed, 8 insertions, 81 deletions
diff --git a/mobile/android/focus-android/settings.gradle b/mobile/android/focus-android/settings.gradle
index 0f5151cfe6..9db906b61f 100644
--- a/mobile/android/focus-android/settings.gradle
+++ b/mobile/android/focus-android/settings.gradle
@@ -31,6 +31,7 @@ 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'
@@ -47,90 +48,16 @@ gradle.projectsLoaded { ->
}
}
}
-
- def appServicesSrcDir = null
- if (gradle.hasProperty('localProperties.autoPublish.application-services.dir')) {
- 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: "${rootProject.projectDir}/${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle"
- }
- }
}
}
-def log(message) {
- logger.lifecycle("[settings] ${message}")
-}
-
-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 {
- log(successMessage)
+def projectLocalProperties = file("local.properties").with { localPropertiesFile ->
+ def localProperties = new Properties()
+ if (localPropertiesFile.canRead()) {
+ localPropertiesFile.withInputStream { localProperties.load(it) }
}
- return captureStdout ? standardOutput : null
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Local development enhancements
-//////////////////////////////////////////////////////////////////////////
-
-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())
- log('Loaded local.properties')
-} else {
- log('Missing local.properties; see https://github.com/mozilla-mobile/focus-android#localproperties-helpers for instructions.')
+ localProperties
}
-
-if (localProperties != null) {
- localProperties.each { prop ->
- gradle.ext.set("localProperties.${prop.key}", prop.value)
- }
-
- String appServicesLocalPath = localProperties.getProperty(settingAppServicesPath)
-
- if (appServicesLocalPath != null) {
- log("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 {
- log("Disabled auto-publication of application-services. Enable it by settings '$settingAppServicesPath' in local.properties")
- }
-
- String gleanLocalPath = localProperties.getProperty(settingGleanPath)
-
- if (gleanLocalPath != null) {
- log("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 {
- log("Disabled auto-publication of Glean. Enable it by settings '$settingGleanPath' in local.properties")
- }
+projectLocalProperties.each { prop ->
+ gradle.ext."localProperties.${prop.key}" = prop.value
}