Bug 1777562 [wpt PR 34663] - [FedCM] Rename FederatedCredential to IdentityCredential...
[gecko.git] / settings.gradle
blobaf7caf5b0f0009cf0b809a11ce994dff5e014219
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.toLowerCase()
13         if (mozillabuild) {
14             commandLine.addAll(0, ["${mozillabuild}/python3/python3.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 ':test_runner'
57 include ':exoplayer2'
58 include ':omnijar'
60 project(':annotations').projectDir = new File("${json.topsrcdir}/mobile/android/annotations")
61 project(':geckoview').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview")
62 project(':geckoview_example').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview_example")
63 project(':test_runner').projectDir = new File("${json.topsrcdir}/mobile/android/test_runner")
64 project(':exoplayer2').projectDir = new File("${json.topsrcdir}/mobile/android/exoplayer2")
65 project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar")
67 // The Gradle instance is shared between settings.gradle and all the
68 // other build.gradle files (see
69 // http://forums.gradle.org/gradle/topics/define_extension_properties_from_settings_xml).
70 // We use this ext property to pass the per-object-directory mozconfig
71 // between scripts.  This lets us execute set-up code before we gradle
72 // tries to configure the project even once, and as a side benefit
73 // saves invoking |mach environment| multiple times.
74 gradle.ext.mozconfig = json
76 // Produced by `mach build`.  Bug 1543982: the mozconfig determined by `mach
77 // environment` above can be different because `mach build` itself sets certain
78 // critical environment variables including MOZ_OBJDIR, CC, and CXX.  We use
79 // this record to patch up the environment when we recursively invoke `mach
80 // build ...` commands from within Gradle.  This avoids invalidating configure
81 // based on the changed environment variables.
82 def orig = slurper.parse(new File(json.topobjdir, '.mozconfig.json'))
83 gradle.ext.mozconfig.orig_mozconfig = orig.mozconfig
84 project(':messaging_example').projectDir = new File('mobile/android/examples/messaging_example/app')
85 project(':port_messaging_example').projectDir = new File('mobile/android/examples/port_messaging_example/app')