mach_env.gradle (1233B)
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 } 14 15 def localMozconfig = localProperties.getProperty("mozilla-central.mozconfig") 16 def env = new HashMap(System.env) 17 if (localMozconfig) { 18 def envMozconfig = System.env.get('FOUND_MOZCONFIG') 19 if (!envMozconfig || localMozconfig == envMozconfig) { 20 logger.lifecycle("settings.gradle> Setting mozconfig from local.properties: ${localMozconfig}") 21 env.MOZCONFIG = localMozconfig 22 } else { 23 logger.lifecycle("settings.gradle> Preferring mozconfig set in mach environment to mozconfig set in local.properties: ${envMozconfig}") 24 } 25 } 26 27 return env 28 }