Bug 1216434 - Don't symlink to objdir in |mach gradle-install|. r=sebastian
authorNick Alexander <nalexander@mozilla.com>
Sun, 18 Oct 2015 16:44:04 -0700
changeset 303723 2af1c76f67a479b01053a9524b5975c7f2527bf8
parent 303722 5165a60f02115564b69d5c8dbf6c995e25fc2fb3
child 303724 6acf624d6a2504451511b81638a326d76e98519c
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1216434
milestone44.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 1216434 - Don't symlink to objdir in |mach gradle-install|. r=sebastian DONTBUILD NPOTB This has always been possible with Gradle -- Gradle doesn't care where in the file tree resources are found. (Gradle is perfectly happy to take resources from outside of the root project directory.) IntelliJ, however, displays resources outside of known "content roots" in special and frankly unhelpful ways. Here, we avoid that on a technicality: IntelliJ doesn't acknowledge (or even register a content root!) for the non-standard AndroidManifest.xml locations set in build.gradle. This means we don't see odd content roots in unexpected places in IntelliJ. With this change, the formerly failing command mach clobber && mach configure && mach gradle-install completes successfully. That gets us one step closer to being able to open Fennec in IntelliJ without running additional commands.
mobile/android/gradle/app/build.gradle
mobile/android/mach_commands.py
--- a/mobile/android/gradle/app/build.gradle
+++ b/mobile/android/gradle/app/build.gradle
@@ -2,16 +2,19 @@ apply plugin: 'com.android.application'
 
 android {
     compileSdkVersion 23
     buildToolsVersion "23.0.1"
 
     defaultConfig {
         targetSdkVersion 22
         minSdkVersion 9
+        applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
+        testApplicationId 'org.mozilla.roboexample.test'
+        testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
     }
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
         targetCompatibility JavaVersion.VERSION_1_7
     }
 
     lintOptions {
@@ -20,23 +23,23 @@ android {
 
     buildTypes {
         release {
             minifyEnabled true
             proguardFile "${topsrcdir}/mobile/android/config/proguard/proguard.cfg"
         }
     }
 
-    defaultConfig {
-        testApplicationId 'org.mozilla.roboexample.test'
-        testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
-    }
+    sourceSets {
+        main {
+            manifest.srcFile "${topobjdir}/mobile/android/base/AndroidManifest.xml"
+        }
 
-    sourceSets {
         androidTest {
+            manifest.srcFile "${topobjdir}/build/mobile/robocop/AndroidManifest.xml"
             java {
                 srcDir "src/robocop_harness"
                 srcDir "src/robocop"
                 srcDir "src/background"
                 srcDir "src/browser"
                 srcDir "src/javaaddons"
             }
         }
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -75,19 +75,16 @@ class MachCommands(MachCommandBase):
         conditions=[conditions.is_android])
     def gradle_install(self, quiet=False):
         import mozpack.manifests
         m = mozpack.manifests.InstallManifest()
 
         def srcdir(dst, src):
             m.add_symlink(os.path.join(self.topsrcdir, src), dst)
 
-        def objdir(dst, src):
-            m.add_symlink(os.path.join(self.topobjdir, src), dst)
-
         srcdir('build.gradle', 'mobile/android/gradle/build.gradle')
         srcdir('settings.gradle', 'mobile/android/gradle/settings.gradle')
 
         m.add_pattern_copy(os.path.join(self.topsrcdir, 'mobile/android/gradle/gradle/wrapper'), '**', 'gradle/wrapper')
         m.add_copy(os.path.join(self.topsrcdir, 'mobile/android/gradle/gradlew'), 'gradlew')
 
         defines = {
             'topsrcdir': self.topsrcdir,
@@ -113,18 +110,16 @@ class MachCommands(MachCommandBase):
         srcdir('omnijar/build.gradle', 'mobile/android/gradle/omnijar/build.gradle')
         srcdir('omnijar/src/main/java/locales', 'mobile/android/locales')
         srcdir('omnijar/src/main/java/chrome', 'mobile/android/chrome')
         srcdir('omnijar/src/main/java/components', 'mobile/android/components')
         srcdir('omnijar/src/main/java/modules', 'mobile/android/modules')
         srcdir('omnijar/src/main/java/themes', 'mobile/android/themes')
 
         srcdir('app/build.gradle', 'mobile/android/gradle/app/build.gradle')
-        objdir('app/src/main/AndroidManifest.xml', 'mobile/android/base/AndroidManifest.xml')
-        objdir('app/src/androidTest/AndroidManifest.xml', 'build/mobile/robocop/AndroidManifest.xml')
         srcdir('app/src/androidTest/res', 'build/mobile/robocop/res')
         srcdir('app/src/androidTest/assets', 'mobile/android/tests/browser/robocop/assets')
         # Test code.
         srcdir('app/src/robocop_harness/org/mozilla/gecko', 'build/mobile/robocop')
         srcdir('app/src/robocop/org/mozilla/gecko/tests', 'mobile/android/tests/browser/robocop')
         srcdir('app/src/background/org/mozilla/gecko/background', 'mobile/android/tests/background/junit3/src')
         srcdir('app/src/browser', 'mobile/android/tests/browser/junit3/src')
         srcdir('app/src/javaaddons', 'mobile/android/tests/javaaddons/src')