diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /mobile/android/gradle/mach_env.gradle | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/gradle/mach_env.gradle')
-rw-r--r-- | mobile/android/gradle/mach_env.gradle | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mobile/android/gradle/mach_env.gradle b/mobile/android/gradle/mach_env.gradle new file mode 100644 index 0000000000..560d7dac22 --- /dev/null +++ b/mobile/android/gradle/mach_env.gradle @@ -0,0 +1,29 @@ +ext.machEnv = { topsrcdir -> + // Allow to specify mozconfig in `local.properties` via + // `mozilla-central.mozconfig=/path/to/mozconfig`. This can't be an environment + // variable because it's not feasible to specify environment variables under + // Android Studio on some platforms including macOS. + def localProperties = new Properties() + def localPropertiesFile = new File(topsrcdir, 'local.properties') + if (localPropertiesFile.canRead()) { + localPropertiesFile.withInputStream { + localProperties.load(it) + logger.lifecycle("settings.gradle> Read local.properties: ${localPropertiesFile}") + } + } + + def localMozconfig = localProperties.getProperty("mozilla-central.mozconfig") + + def env = System.env.collect { k, v -> "${k}=${v}" } + if (localMozconfig) { + def envMozconfig = System.env.get('FOUND_MOZCONFIG') + if (!envMozconfig || localMozconfig == envMozconfig) { + logger.lifecycle("settings.gradle> Setting mozconfig from local.properties: ${localMozconfig}") + env << "MOZCONFIG=${localMozconfig}" + } else { + logger.lifecycle("settings.gradle> Preferring mozconfig set in mach environment to mozconfig set in local.properties: ${envMozconfig}") + } + } + + return env +} |