Bug 1190940 - Handle MOZ_NATIVE_DEVICES and MOZ_WEBRTC in Gradle build. r=sebastian
authorNick Alexander <nalexander@mozilla.com>
Tue, 04 Aug 2015 10:01:26 -0700
changeset 287792 437a166ba6ed525ee544b46c58270202d79a59a1
parent 287791 1aac59a31bc3824c6b3efb66a675972c835b5fa7
child 287793 fffe3ac33207713a9d71fcddadeeb938e6221a2a
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1190940
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1190940 - Handle MOZ_NATIVE_DEVICES and MOZ_WEBRTC in Gradle build. r=sebastian This is an information sharing review request. This patch demonstrates two ways to handle static build flags in the Java source base. For MOZ_NATIVE_DEVICES, we /exclude/ certain Java source files. This is unwieldy but works fine. For MOZ_WEBRTC, we selectively /include/ certain Javas source directories. We symlink the directories into the objdir so that the IntelliJ configuration remains entirely under the project directory -- IJ really doesn't like it when sources are outside of the project content root. Since two source directories declare the same package (org.webrtc.videoengine) we can't symlink deep in the package hierarchy. Therefore, we add top-level source directories sibling to src/main.
mobile/android/gradle/base/build.gradle
mobile/android/mach_commands.py
--- a/mobile/android/gradle/base/build.gradle
+++ b/mobile/android/gradle/base/build.gradle
@@ -25,19 +25,33 @@ android {
         }
     }
 
     sourceSets {
         main {
             java {
                 exclude 'org/mozilla/gecko/tests/**'
                 exclude 'org/mozilla/gecko/resources/**'
+
                 if (!mozconfig.substs.MOZ_CRASHREPORTER) {
                     exclude 'org/mozilla/gecko/CrashReporter.java'
                 }
+
+                if (!mozconfig.substs.MOZ_NATIVE_DEVICES) {
+                    exclude 'org/mozilla/gecko/ChromeCast.java'
+                    exclude 'org/mozilla/gecko/GeckoMediaPlayer.java'
+                    exclude 'org/mozilla/gecko/MediaPlayerManager.java'
+                }
+
+                if (mozconfig.substs.MOZ_WEBRTC) {
+                    srcDir 'src/webrtc_audio_device'
+                    srcDir 'src/webrtc_video_capture'
+                    srcDir 'src/webrtc_video_render'
+                }
+
                 // Adjust helpers are included in the preprocessed_code project.
                 exclude 'org/mozilla/gecko/adjust/**'
             }
 
             res {
                 if (mozconfig.substs.MOZ_CRASHREPORTER) {
                     srcDir "src/crashreporter/res"
                 }
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -133,16 +133,19 @@ class MachCommands(MachCommandBase):
 
         srcdir('base/build.gradle', 'mobile/android/gradle/base/build.gradle')
         srcdir('base/lint.xml', 'mobile/android/gradle/base/lint.xml')
         srcdir('base/src/main/AndroidManifest.xml', 'mobile/android/gradle/base/AndroidManifest.xml')
         srcdir('base/src/main/java/org/mozilla/gecko', 'mobile/android/base')
         srcdir('base/src/main/java/org/mozilla/mozstumbler', 'mobile/android/stumbler/java/org/mozilla/mozstumbler')
         srcdir('base/src/main/java/org/mozilla/search', 'mobile/android/search/java/org/mozilla/search')
         srcdir('base/src/main/java/org/mozilla/javaaddons', 'mobile/android/javaaddons/java/org/mozilla/javaaddons')
+        srcdir('base/src/webrtc_audio_device/java', 'media/webrtc/trunk/webrtc/modules/audio_device/android/java/src')
+        srcdir('base/src/webrtc_video_capture/java', 'media/webrtc/trunk/webrtc/modules/video_capture/android/java/src')
+        srcdir('base/src/webrtc_video_render/java', 'media/webrtc/trunk/webrtc/modules/video_render/android/java/src')
         srcdir('base/src/main/res', 'mobile/android/base/resources')
         srcdir('base/src/crashreporter/res', 'mobile/android/base/crashreporter/res')
 
         manifest_path = os.path.join(self.topobjdir, 'mobile', 'android', 'gradle.manifest')
         with FileAvoidWrite(manifest_path) as f:
             m.write(fileobj=f)
 
         self.virtualenv_manager.ensure()