Bug 1115064 - Fix small errors and make Gradle integration work in Android Studio 1.0.2. r=me
authorNick Alexander <nalexander@mozilla.com>
Tue, 23 Dec 2014 11:39:15 -0800
changeset 221117 8b881bea204add0f733100601dc136be1698ac87
parent 221116 f52833a4cf7464a89490ea53c47fb3546b96bc28
child 221165 865d06511e992baca21c3fb007e10f9a58ae7222
child 221185 f5758bdccc0a052d52206fc9ff4897ab4a8d9f4f
push id28010
push userkwierso@gmail.com
push dateWed, 24 Dec 2014 00:29:29 +0000
treeherdermozilla-central@8b881bea204a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1115064
milestone37.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 1115064 - Fix small errors and make Gradle integration work in Android Studio 1.0.2. r=me The important change here is that we allow the Android-Gradle plugin to be version 0.14.4 or version 1.0.0, which appears to work in IntelliJ 14.0.2 and in Android Studio 1.0.2. Testing feedback came from imjalpreet and garvank.
mobile/android/base/build.gradle
mobile/android/gradle/base/build.gradle
mobile/android/gradle/branding/build.gradle
mobile/android/gradle/build.gradle
mobile/android/gradle/preprocessed_resources/build.gradle
mobile/android/gradle/thirdparty/build.gradle
mobile/android/mach_commands.py
deleted file mode 100644
--- a/mobile/android/base/build.gradle
+++ /dev/null
@@ -1,90 +0,0 @@
-project.buildDir = "${topobjdir}/mobile/android/gradle/base/build"
-
-apply plugin: 'com.android.library'
-
-android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
-    buildToolsVersion rootProject.ext.buildToolsVersion
-
-    defaultConfig {
-        applicationId 'org.mozilla.gecko'
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
-    }
-
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFile getDefaultProguardFile('proguard-android.txt')
-        }
-    }
-
-    compileOptions {
-        sourceCompatibility JavaVersion.VERSION_1_7
-        targetCompatibility JavaVersion.VERSION_1_7
-    }
-
-    android {
-        lintOptions {
-            abortOnError false
-        }
-    }
-
-    sourceSets {
-        main {
-            manifest {
-                srcFile 'gradle_AndroidManifest.xml'
-            }
-
-            java {
-                // The main sources are symlinked in here.
-                srcDir "${topobjdir}/mobile/android/gradle/base/src/main/java"
-                    exclude '**/tests/**'
-                    exclude '**/resources/**'
-                if (!MOZ_CRASHREPORTER) {
-                    exclude '**/CrashReporter.java'
-                }
-                srcDir "../search/java"
-                srcDir "../stumbler/java"
-                srcDir "${topobjdir}/mobile/android/base/generated"
-                    exclude '**/R.java'
-                    exclude '**/Manifest.java'
-            }
-
-            res {
-                srcDir "../branding/unofficial/res"
-                srcDir "${topobjdir}/mobile/android/base/res"
-                // The main resources are symlinked in here.
-                srcDir "${topobjdir}/mobile/android/gradle/base/src/main/res"
-                if (MOZ_CRASHREPORTER) {
-                    srcDir "crashreporter/res"
-                }
-            }
-        }
-    }
-}
-
-dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile 'com.android.support:support-v4:19.1.+'
-    compile 'com.android.support:appcompat-v7:19.1.+'
-    compile 'com.android.support:mediarouter-v7:19.1.+'
-    compile 'com.google.android.gms:play-services:5.+'
-
-    compile project(':thirdparty')
-    compile project(':omnijar')
-}
-
-task generateCodeAndResources(type:Exec) {
-  workingDir "${topobjdir}"
-
-  commandLine "${topsrcdir}/mach"
-  args 'build'
-  args '-C'
-  args 'mobile/android/base'
-  args 'gradle-targets'
-}
-
-android.libraryVariants.all { variant ->
-    variant.checkManifest.dependsOn generateCodeAndResources
-}
--- a/mobile/android/gradle/base/build.gradle
+++ b/mobile/android/gradle/base/build.gradle
@@ -1,17 +1,13 @@
 apply plugin: 'com.android.library'
 
 apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
 
 android {
-    defaultConfig {
-        applicationId 'org.mozilla.gecko'
-    }
-
     buildTypes {
         release {
             minifyEnabled false
             proguardFile getDefaultProguardFile('proguard-android.txt')
         }
     }
 
     sourceSets {
--- a/mobile/android/gradle/branding/build.gradle
+++ b/mobile/android/gradle/branding/build.gradle
@@ -1,16 +1,12 @@
 apply plugin: 'com.android.library'
 
 apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
 
 android {
-    defaultConfig {
-        applicationId 'org.mozilla.gecko.branding'
-    }
-
     buildTypes {
         release {
             minifyEnabled false
             proguardFile getDefaultProguardFile('proguard-android.txt')
         }
     }
 }
--- a/mobile/android/gradle/build.gradle
+++ b/mobile/android/gradle/build.gradle
@@ -10,17 +10,18 @@ allprojects {
 buildDir "${topobjdir}/mobile/android/gradle/build"
 
 buildscript {
     repositories {
         jcenter()
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:0.14.4'
+        // IntelliJ 14.0.2 wants 0.14.4; Android Studio wants 1.0.0.
+        classpath 'com.android.tools.build:gradle:[0.14.4,1.0.0]'
     }
 }
 
 repositories {
     jcenter()
 }
 
 subprojects {
--- a/mobile/android/gradle/preprocessed_resources/build.gradle
+++ b/mobile/android/gradle/preprocessed_resources/build.gradle
@@ -1,17 +1,13 @@
 apply plugin: 'com.android.library'
 
 apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
 
 android {
-    defaultConfig {
-        applicationId 'org.mozilla.gecko.preprocessed_resources'
-    }
-
     buildTypes {
         release {
             minifyEnabled false
             proguardFile getDefaultProguardFile('proguard-android.txt')
         }
     }
 }
 
--- a/mobile/android/gradle/thirdparty/build.gradle
+++ b/mobile/android/gradle/thirdparty/build.gradle
@@ -1,17 +1,13 @@
 apply plugin: 'com.android.library'
 
 apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
 
 android {
-    defaultConfig {
-        applicationId 'org.mozilla.gecko.thirdparty'
-    }
-
     buildTypes {
         release {
             minifyEnabled false
             proguardFile getDefaultProguardFile('proguard-android.txt')
         }
     }
 }
 
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -123,17 +123,16 @@ class MachCommands(MachCommandBase):
         srcdir('app/libs', 'build/mobile/robocop')
 
         srcdir('base/build.gradle', 'mobile/android/gradle/base/build.gradle')
         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/res', 'mobile/android/base/resources')
-        srcdir('base/src/newtablet/res', 'mobile/android/base/newtablet/res')
         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()
         code = self.run_process([