summaryrefslogtreecommitdiffstats
path: root/mobile/android/android-components/substitute-local-ac.gradle
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /mobile/android/android-components/substitute-local-ac.gradle
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/android-components/substitute-local-ac.gradle')
-rw-r--r--mobile/android/android-components/substitute-local-ac.gradle46
1 files changed, 46 insertions, 0 deletions
diff --git a/mobile/android/android-components/substitute-local-ac.gradle b/mobile/android/android-components/substitute-local-ac.gradle
new file mode 100644
index 0000000000..208b80f6c0
--- /dev/null
+++ b/mobile/android/android-components/substitute-local-ac.gradle
@@ -0,0 +1,46 @@
+
+def version = null
+if (gradle.hasProperty("localProperties.autoPublish.android-components.dir")) {
+ // We're doing local development using the autoPublish system. This automatically rebuilds and
+ // publishes android-components packages whenever the source changes.
+ // This version string will selected the latest build package
+ version = '0.0.1-+'
+} else if (gradle.hasProperty("localProperties.branchBuild.android-components.version")) {
+ // We're running a branch build. Here the version is set to the git commit id in
+ // local.properties
+ version = gradle.getProperty("localProperties.branchBuild.android-components.version")
+} else {
+ throw new Exception("substitute-local-appservices.gradle called from unexpected context")
+}
+logger.lifecycle("[local-ac] adjusting project to use locally published android-components modules (${version})")
+
+// Inject mavenLocal repository. This is where we're expected to publish modules.
+repositories {
+ mavenLocal()
+}
+
+configurations.configureEach { config ->
+ if (config.isCanBeResolved()) {
+ config.resolutionStrategy { strategy ->
+ dependencySubstitution {
+ configureEach { dependency ->
+ if (!(dependency.requested instanceof ModuleComponentSelector)) {
+ // We only care about substituting for a module, not a project.
+ return
+ }
+
+ // For every org.mozilla.components.* module, substitute its version for '+'.
+ // '+' version tells gradle to resolve the latest available version.
+ // As long as 'mavenLocal' is in the repositories list, gradle should pick out
+ // latest published module during dependency resolution phase.
+ def group = dependency.requested.group
+ if (group == 'org.mozilla.components') {
+ def name = dependency.requested.module
+ dependency.useTarget([group: group, name: name, version: version])
+ }
+ }
+ }
+ }
+ }
+}
+