Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / settings.gradle
blobe4d7d13c2fa9e9f820603e8dc3f5b357ca44fb51
1 // You might think topsrcdir is '.', but that's not true when the Gradle build
2 // is launched from within IntelliJ.
3 def topsrcdir = rootProject.projectDir.absolutePath
5 def commandLine = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"]
6 if (System.properties['os.name'].toLowerCase().contains('windows')) {
7     // gradle is called before parsing config.status, we cannot use PYTHON
8     // value.
9     if (System.env.MOZILLABUILD) {
10         def mozillabuild = System.env.MOZILLABUILD
11         if (mozillabuild) {
12             commandLine.addAll(0, ["${mozillabuild}/python/python.exe"])
13         }
14     }
16 def proc = commandLine.execute(null, new File(topsrcdir))
17 def standardOutput = new ByteArrayOutputStream()
18 def standardError = new ByteArrayOutputStream()
19 proc.consumeProcessOutput(standardOutput, standardError)
20 proc.waitFor()
22 // Only show the output if something went wrong.
23 if (proc.exitValue() != 0) {
24     throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\nstdout:\n${standardOutput.toString()}\n\nstderr:\n${standardError.toString()}")
27 import groovy.json.JsonSlurper
29 def slurper = new JsonSlurper()
30 def json = slurper.parseText(standardOutput.toString())
32 if (json.substs.MOZ_BUILD_APP != 'mobile/android') {
33     throw new GradleException("Building with Gradle is only supported for Fennec, i.e., MOZ_BUILD_APP == 'mobile/android'.")
36 // Set the Android SDK location.  This is the *least specific* mechanism, which
37 // is unfortunate: we'd prefer to use the *most specific* mechanism.  That is,
38 // local.properties (first 'sdk.dir', then 'android.dir') and then the
39 // environment variable ANDROID_HOME will override this.  That's unfortunate,
40 // but it's hard to automatically arrange better.
41 System.setProperty('android.home', json.substs.ANDROID_SDK_ROOT)
43 include ':annotations', ':messaging_example', ':port_messaging_example'
44 include ':geckoview'
45 include ':geckoview_example'
46 include ':omnijar'
48 project(':annotations').projectDir = new File("${json.topsrcdir}/mobile/android/annotations")
49 project(':geckoview').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview")
50 project(':geckoview_example').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview_example")
51 project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar")
53 // The Gradle instance is shared between settings.gradle and all the
54 // other build.gradle files (see
55 // http://forums.gradle.org/gradle/topics/define_extension_properties_from_settings_xml).
56 // We use this ext property to pass the per-object-directory mozconfig
57 // between scripts.  This lets us execute set-up code before we gradle
58 // tries to configure the project even once, and as a side benefit
59 // saves invoking |mach environment| multiple times.
60 gradle.ext.mozconfig = json
62 // Produced by `mach build`.  Bug 1543982: the mozconfig determined by `mach
63 // environment` above can be different because `mach build` itself sets certain
64 // critical environment variables including MOZ_OBJDIR, CC, and CXX.  We use
65 // this record to patch up the environment when we recursively invoke `mach
66 // build ...` commands from within Gradle.  This avoids invalidating configure
67 // based on the changed environment variables.
68 def orig = slurper.parse(new File(json.topobjdir, '.mozconfig.json'))
69 gradle.ext.mozconfig.orig_mozconfig = orig.mozconfig
70 project(':messaging_example').projectDir = new File('mobile/android/examples/messaging_example/app')
71 project(':port_messaging_example').projectDir = new File('mobile/android/examples/port_messaging_example/app')