summaryrefslogtreecommitdiffstats
path: root/mobile/android/android-components/settings.gradle
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /mobile/android/android-components/settings.gradle
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/android-components/settings.gradle')
-rw-r--r--mobile/android/android-components/settings.gradle101
1 files changed, 101 insertions, 0 deletions
diff --git a/mobile/android/android-components/settings.gradle b/mobile/android/android-components/settings.gradle
new file mode 100644
index 0000000000..50c58ed003
--- /dev/null
+++ b/mobile/android/android-components/settings.gradle
@@ -0,0 +1,101 @@
+/* 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/. */
+
+pluginManagement {
+ apply from: file('../gradle/mozconfig.gradle')
+
+ repositories {
+ gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
+ maven {
+ url repository
+ if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) {
+ allowInsecureProtocol = true
+ }
+ }
+ }
+ }
+
+ includeBuild("plugins/dependencies")
+ includeBuild("plugins/publicsuffixlist")
+}
+
+plugins {
+ id 'mozac.DependenciesPlugin'
+}
+
+ext.topsrcdir = rootProject.projectDir.absolutePath.minus("mobile/android/android-components")
+
+apply from: file('../shared-settings.gradle')
+
+buildCache {
+ local {
+ directory = new File(rootDir, '.build-cache')
+ removeUnusedEntriesAfterDays = 30
+ }
+}
+
+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
+//////////////////////////////////////////////////////////////////////////
+
+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")
+ }
+}