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}")
15 def localMozconfig = localProperties.getProperty("mozilla-central.mozconfig")
17 def env = System.env.collect { k, v -> "${k}=${v}" }
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}"
24 logger.lifecycle("settings.gradle> Preferring mozconfig set in mach environment to mozconfig set in local.properties: ${envMozconfig}")