no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / mobile / android / gradle / mach_env.gradle
blob560d7dac225cae5b8c0c02f7291a9cca02237af6
1 ext.machEnv = { topsrcdir ->
2   // Allow to specify mozconfig in `local.properties` via
3   // `mozilla-central.mozconfig=/path/to/mozconfig`.  This can't be an environment
4   // variable because it's not feasible to specify environment variables under
5   // Android Studio on some platforms including macOS.
6   def localProperties = new Properties()
7   def localPropertiesFile = new File(topsrcdir, 'local.properties')
8   if (localPropertiesFile.canRead()) {
9       localPropertiesFile.withInputStream {
10           localProperties.load(it)
11           logger.lifecycle("settings.gradle> Read local.properties: ${localPropertiesFile}")
12       }
13   }
15   def localMozconfig = localProperties.getProperty("mozilla-central.mozconfig")
17   def env = System.env.collect { k, v -> "${k}=${v}" }
18   if (localMozconfig) {
19       def envMozconfig = System.env.get('FOUND_MOZCONFIG')
20       if (!envMozconfig || localMozconfig == envMozconfig) {
21           logger.lifecycle("settings.gradle> Setting mozconfig from local.properties: ${localMozconfig}")
22           env << "MOZCONFIG=${localMozconfig}"
23       } else {
24           logger.lifecycle("settings.gradle> Preferring mozconfig set in mach environment to mozconfig set in local.properties: ${envMozconfig}")
25       }
26   }
28   return env