Bug 1733869 [wpt PR 30916] - Add a note about counterintuitive send_keys() code point...
[gecko.git] / settings.gradle
blobc9a0d639ffa171d90abc6f825af7f79a21fac06f
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 apply from: "${topsrcdir}/mobile/android/gradle/mach_env.gradle"
7 def commandLine = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"]
8 if (System.properties['os.name'].toLowerCase().contains('windows')) {
9     // gradle is called before parsing config.status, we cannot use PYTHON
10     // value.
11     if (System.env.MOZILLABUILD) {
12         def mozillabuild = System.env.MOZILLABUILD
13         if (mozillabuild) {
14             commandLine.addAll(0, ["${mozillabuild}/python/python.exe"])
15         }
16     }
19 def proc = commandLine.execute(machEnv(topsrcdir), new File(topsrcdir))
20 def standardOutput = new ByteArrayOutputStream()
21 def standardError = new ByteArrayOutputStream()
22 proc.consumeProcessOutput(standardOutput, standardError)
23 proc.waitFor()
25 // Only show the output if something went wrong.
26 if (proc.exitValue() != 0) {
27     logger.info("Error running ./mach environment: \n\n"
28         + "Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\n"
29         + "stdout:\n"
30         + "${standardOutput.toString()}\n\n"
31         + "stderr:\n"
32         + "${standardError.toString()}")
33     throw new StopExecutionException(
34             "Could not run ./mach environment. Try running ./mach build first.")
37 import groovy.json.JsonSlurper
39 def slurper = new JsonSlurper()
40 def json = slurper.parseText(standardOutput.toString())
42 if (json.substs.MOZ_BUILD_APP != 'mobile/android') {
43     throw new GradleException("Building with Gradle is only supported for Fennec, i.e., MOZ_BUILD_APP == 'mobile/android'.")
46 // Set the Android SDK location.  This is the *least specific* mechanism, which
47 // is unfortunate: we'd prefer to use the *most specific* mechanism.  That is,
48 // local.properties (first 'sdk.dir', then 'android.dir') and then the
49 // environment variable ANDROID_HOME will override this.  That's unfortunate,
50 // but it's hard to automatically arrange better.
51 System.setProperty('android.home', json.substs.ANDROID_SDK_ROOT)
53 include ':annotations', ':messaging_example', ':port_messaging_example'
54 include ':geckoview'
55 include ':geckoview_example'
56 include ':omnijar'
58 project(':annotations').projectDir = new File("${json.topsrcdir}/mobile/android/annotations")
59 project(':geckoview').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview")
60 project(':geckoview_example').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview_example")
61 project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar")
63 // The Gradle instance is shared between settings.gradle and all the
64 // other build.gradle files (see
65 // http://forums.gradle.org/gradle/topics/define_extension_properties_from_settings_xml).
66 // We use this ext property to pass the per-object-directory mozconfig
67 // between scripts.  This lets us execute set-up code before we gradle
68 // tries to configure the project even once, and as a side benefit
69 // saves invoking |mach environment| multiple times.
70 gradle.ext.mozconfig = json
72 // Produced by `mach build`.  Bug 1543982: the mozconfig determined by `mach
73 // environment` above can be different because `mach build` itself sets certain
74 // critical environment variables including MOZ_OBJDIR, CC, and CXX.  We use
75 // this record to patch up the environment when we recursively invoke `mach
76 // build ...` commands from within Gradle.  This avoids invalidating configure
77 // based on the changed environment variables.
78 def orig = slurper.parse(new File(json.topobjdir, '.mozconfig.json'))
79 gradle.ext.mozconfig.orig_mozconfig = orig.mozconfig
80 project(':messaging_example').projectDir = new File('mobile/android/examples/messaging_example/app')
81 project(':port_messaging_example').projectDir = new File('mobile/android/examples/port_messaging_example/app')