Backed out changeset 746468f5d979 (bug 1233882).
authorNick Alexander <nalexander@mozilla.com>
Fri, 05 Feb 2016 21:19:13 -0800
changeset 321563 4e0eba2be9b154876b5f439dc7907cf91f417a86
parent 321562 8053a371a52812cc43259f5b486d3c27057661b0
child 321564 40ddb075bbc68428d90113ccc3c2ff8d4483b60d
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1233882
milestone47.0a1
backs out746468f5d9798ff404a80cd957664e2b69a0e97c
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
Backed out changeset 746468f5d979 (bug 1233882).
mobile/android/app/base/build.gradle
mobile/android/app/base/lint.xml
mobile/android/app/build.gradle
mobile/android/app/lint.xml
mobile/android/app/src/main/resources/robolectric.properties
mobile/android/app/src/test/java/org/mozilla/gecko/TestGeckoApplication.java
mobile/android/tests/background/junit4/resources/robolectric.properties
settings.gradle
new file mode 100644
--- /dev/null
+++ b/mobile/android/app/base/build.gradle
@@ -0,0 +1,142 @@
+buildDir "${topobjdir}/gradle/build/mobile/android/base"
+
+apply plugin: 'com.android.library'
+
+android {
+    compileSdkVersion 23
+    buildToolsVersion "23.0.1"
+
+    defaultConfig {
+        targetSdkVersion 23
+        minSdkVersion 15
+        // Used by Robolectric based tests; see TestRunner.
+        buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
+    }
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_7
+        targetCompatibility JavaVersion.VERSION_1_7
+    }
+
+    lintOptions {
+        abortOnError false
+    }
+
+    sourceSets {
+        main {
+            manifest.srcFile "${topsrcdir}/mobile/android/base/AndroidManifest.xml"
+
+            java {
+                srcDir "${topsrcdir}/mobile/android/base/java"
+                srcDir "${topsrcdir}/mobile/android/search/java"
+                srcDir "${topsrcdir}/mobile/android/javaaddons/java"
+                srcDir "${topsrcdir}/mobile/android/services/src/main/java"
+
+                if (mozconfig.substs.MOZ_ANDROID_MLS_STUMBLER) {
+                    srcDir "${topsrcdir}/mobile/android/stumbler/java"
+                }
+
+                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 "${topsrcdir}/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src"
+                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src"
+                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_render/android/java/src"
+                }
+
+                if (mozconfig.substs.MOZ_INSTALL_TRACKING) {
+                    exclude 'org/mozilla/gecko/adjust/StubAdjustHelper.java'
+                } else {
+                    exclude 'org/mozilla/gecko/adjust/AdjustHelper.java'
+                }
+
+                srcDir "${project.buildDir}/generated/source/preprocessed_code" // See syncPreprocessedCode.
+            }
+
+            res {
+                srcDir "${topsrcdir}/${mozconfig.substs.MOZ_BRANDING_DIRECTORY}/res"
+                srcDir "${project.buildDir}/generated/source/preprocessed_resources" // See syncPreprocessedResources.
+                srcDir "${topsrcdir}/mobile/android/base/resources"
+                srcDir "${topsrcdir}/mobile/android/services/src/main/res"
+                if (mozconfig.substs.MOZ_CRASHREPORTER) {
+                    srcDir "${topsrcdir}/mobile/android/base/crashreporter/res"
+                }
+            }
+
+            assets {
+                srcDir "${topsrcdir}/mobile/android/app/assets"
+            }
+        }
+
+        test {
+            java {
+                srcDir "${topsrcdir}/mobile/android/tests/background/junit4/src"
+            }
+
+            resources {
+                srcDir "${topsrcdir}/mobile/android/tests/background/junit4/resources"
+            }
+        }
+    }
+}
+
+task syncPreprocessedCode(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
+    into("${project.buildDir}/generated/source/preprocessed_code")
+    from("${topobjdir}/mobile/android/base/generated/preprocessed")
+}
+
+task syncPreprocessedResources(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
+    into("${project.buildDir}/generated/source/preprocessed_resources")
+    from("${topobjdir}/mobile/android/base/res")
+}
+
+android.libraryVariants.all { variant ->
+    variant.preBuild.dependsOn syncPreprocessedCode
+    variant.preBuild.dependsOn syncPreprocessedResources
+}
+
+dependencies {
+    compile 'com.android.support:support-v4:23.0.1'
+    compile 'com.android.support:appcompat-v7:23.0.1'
+    compile 'com.android.support:recyclerview-v7:23.0.1'
+    compile 'com.android.support:design:23.0.1'
+
+    if (mozconfig.substs.MOZ_NATIVE_DEVICES) {
+        compile 'com.android.support:mediarouter-v7:23.0.1'
+        compile 'com.google.android.gms:play-services-basement:8.1.0'
+        compile 'com.google.android.gms:play-services-base:8.1.0'
+        compile 'com.google.android.gms:play-services-cast:8.1.0'
+    }
+
+    if (mozconfig.substs.MOZ_ANDROID_GCM) {
+        compile 'com.google.android.gms:play-services-basement:8.1.0'
+        compile 'com.google.android.gms:play-services-base:8.1.0'
+        compile 'com.google.android.gms:play-services-gcm:8.1.0'
+    }
+
+    // Gradle based builds include LeakCanary. Mach based builds only include the no-op version of
+    // this library.
+    compile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
+
+    compile project(':thirdparty')
+
+    testCompile 'junit:junit:4.12'
+    testCompile 'org.robolectric:robolectric:3.0'
+    testCompile 'org.simpleframework:simple-http:6.0.1'
+    testCompile 'org.mockito:mockito-core:1.10.19'
+}
+
+apply plugin: 'idea'
+
+idea {
+    module {
+    }
+}
new file mode 100644
--- /dev/null
+++ b/mobile/android/app/base/lint.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lint>
+    <!-- Enable relevant checks disabled by default -->
+    <issue id="NegativeMargin" severity="warning" />
+
+    <!-- We have a custom menu and don't conform to the recommended styles. -->
+    <issue id="IconColors" severity="ignore" />
+
+    <!-- We want all lint warnings to be fatal errors.
+         Right now, we set these to lint warnings so:
+
+         DO NOT ADD TO THIS LIST.
+
+         We did this so we can land lint in automation
+         and not fail everything. -->
+    <issue id="AppCompatResource" severity="warning" />
+    <issue id="Instantiatable" severity="warning" />
+    <issue id="LongLogTag" severity="warning" />
+    <issue id="MissingPermission" severity="warning" />
+    <issue id="MissingSuperCall" severity="warning" />
+    <issue id="NewApi" severity="warning" />
+    <issue id="OnClick" severity="warning" />
+    <issue id="ReferenceType" severity="warning" />
+    <issue id="ResourceAsColor" severity="warning" />
+    <issue id="ResourceType" severity="warning" />
+    <issue id="ValidFragment" severity="warning" />
+    <issue id="WrongConstant" severity="warning" />
+
+</lint>
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -12,18 +12,16 @@ android {
         applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
         testApplicationId 'org.mozilla.roboexample.test'
         testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
         manifestPlaceholders = [
             ANDROID_PACKAGE_NAME: mozconfig.substs.ANDROID_PACKAGE_NAME,
             MOZ_ANDROID_MIN_SDK_VERSION: mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION,
             MOZ_ANDROID_SHARED_ID: "${mozconfig.substs.ANDROID_PACKAGE_NAME}.sharedID",
         ]
-        // Used by Robolectric based tests; see TestRunner.
-        buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
     }
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
         targetCompatibility JavaVersion.VERSION_1_7
     }
  
     dexOptions {
@@ -62,75 +60,22 @@ android {
         // Automation builds.
         automation {
         }
     }
 
     sourceSets {
         main {
             manifest.srcFile "${topobjdir}/mobile/android/base/AndroidManifest.xml"
-
-            java {
-                srcDir "${topsrcdir}/mobile/android/base/java"
-                srcDir "${topsrcdir}/mobile/android/search/java"
-                srcDir "${topsrcdir}/mobile/android/javaaddons/java"
-                srcDir "${topsrcdir}/mobile/android/services/src/main/java"
-
-                if (mozconfig.substs.MOZ_ANDROID_MLS_STUMBLER) {
-                    srcDir "${topsrcdir}/mobile/android/stumbler/java"
-                }
-
-                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 "${topsrcdir}/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src"
-                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src"
-                    srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_render/android/java/src"
-                }
-
-                if (mozconfig.substs.MOZ_INSTALL_TRACKING) {
-                    exclude 'org/mozilla/gecko/adjust/StubAdjustHelper.java'
-                } else {
-                    exclude 'org/mozilla/gecko/adjust/AdjustHelper.java'
-                }
-
-                srcDir "${project.buildDir}/generated/source/preprocessed_code" // See syncPreprocessedCode.
-            }
-
-            res {
-                srcDir "${topsrcdir}/${mozconfig.substs.MOZ_BRANDING_DIRECTORY}/res"
-                srcDir "${project.buildDir}/generated/source/preprocessed_resources" // See syncPreprocessedResources.
-                srcDir "${topsrcdir}/mobile/android/base/resources"
-                srcDir "${topsrcdir}/mobile/android/services/src/main/res"
-                if (mozconfig.substs.MOZ_CRASHREPORTER) {
-                    srcDir "${topsrcdir}/mobile/android/base/crashreporter/res"
-                }
-            }
-
             assets {
                 if (mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY && !mozconfig.substs.MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER) {
                     // If we are packaging the bouncer, it will have the distribution, so don't put
                     // it in the main APK as well.
                     srcDir "${mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets"
                 }
-                srcDir "${topsrcdir}/mobile/android/app/assets"
-            }
-        }
-
-        test {
-            java {
-                srcDir "${topsrcdir}/mobile/android/tests/background/junit4/src"
             }
         }
 
         androidTest {
             java {
                 srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/src"
                 srcDir "${topsrcdir}/mobile/android/tests/background/junit3/src"
                 srcDir "${topsrcdir}/mobile/android/tests/browser/junit3/src"
@@ -142,46 +87,17 @@ android {
             assets {
                 srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/assets"
             }
         }
     }
 }
 
 dependencies {
-    compile 'com.android.support:support-v4:23.0.1'
-    compile 'com.android.support:appcompat-v7:23.0.1'
-    compile 'com.android.support:recyclerview-v7:23.0.1'
-    compile 'com.android.support:design:23.0.1'
-
-    if (mozconfig.substs.MOZ_NATIVE_DEVICES) {
-        compile 'com.android.support:mediarouter-v7:23.0.1'
-        compile 'com.google.android.gms:play-services-basement:8.1.0'
-        compile 'com.google.android.gms:play-services-base:8.1.0'
-        compile 'com.google.android.gms:play-services-cast:8.1.0'
-    }
-
-    if (mozconfig.substs.MOZ_ANDROID_GCM) {
-        compile 'com.google.android.gms:play-services-basement:8.1.0'
-        compile 'com.google.android.gms:play-services-base:8.1.0'
-        compile 'com.google.android.gms:play-services-gcm:8.1.0'
-    }
-
-    // Gradle based builds include LeakCanary.  Gradle based tests include the no-op version.  Mach
-    // based builds only include the no-op version of this library.
-    compile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
-    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
-
-    compile project(':thirdparty')
-
-    testCompile 'junit:junit:4.12'
-    testCompile 'org.robolectric:robolectric:3.0'
-    testCompile 'org.simpleframework:simple-http:6.0.1'
-    testCompile 'org.mockito:mockito-core:1.10.19'
-
+    compile project(':base')
     // Including the Robotium JAR directly can cause issues with dexing.
     androidTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
 }
 
 task syncOmnijarFromDistDir(type: Sync) {
     into("${project.buildDir}/generated/omnijar")
     from("${topobjdir}/dist/fennec/assets") {
         include 'omni.ja'
@@ -207,26 +123,16 @@ task checkAssetsExistInDistDir<< {
 
 task syncAssetsFromDistDir(type: Sync, dependsOn: checkAssetsExistInDistDir) {
     into("${project.buildDir}/generated/assets")
     from("${topobjdir}/dist/fennec/assets") {
         exclude 'omni.ja'
     }
 }
 
-task syncPreprocessedCode(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
-    into("${project.buildDir}/generated/source/preprocessed_code")
-    from("${topobjdir}/mobile/android/base/generated/preprocessed")
-}
-
-task syncPreprocessedResources(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
-    into("${project.buildDir}/generated/source/preprocessed_resources")
-    from("${topobjdir}/mobile/android/base/res")
-}
-
 // The omnijar inputs are listed as resource directory inputs to a dummy JAR.
 // That arrangement labels them nicely in IntelliJ.  See the comment in the
 // :omnijar project for more context.
 evaluationDependsOn(':omnijar')
 
 task buildOmnijar(type:Exec) {
     dependsOn rootProject.generateCodeAndResources
 
@@ -250,19 +156,16 @@ task buildOmnijar(type:Exec) {
     doLast {
         if (execResult.exitValue != 0) {
             throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
         }
     }
 }
 
 android.applicationVariants.all { variant ->
-    variant.preBuild.dependsOn syncPreprocessedCode
-    variant.preBuild.dependsOn syncPreprocessedResources
-
     // Like 'local' or 'localOld'.
     def productFlavor = variant.productFlavors[0].name
     // Like 'debug' or 'release'.
     def buildType = variant.buildType.name
 
     // We insert omni.ja and the .so libraries into all local builds.
     if (!productFlavor.startsWith('local')) {
         return
deleted file mode 100644
--- a/mobile/android/app/lint.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<lint>
-    <!-- Enable relevant checks disabled by default -->
-    <issue id="NegativeMargin" severity="warning" />
-
-    <!-- We have a custom menu and don't conform to the recommended styles. -->
-    <issue id="IconColors" severity="ignore" />
-
-    <!-- We want all lint warnings to be fatal errors.
-         Right now, we set these to lint warnings so:
-
-         DO NOT ADD TO THIS LIST.
-
-         We did this so we can land lint in automation
-         and not fail everything. -->
-    <issue id="AppCompatResource" severity="warning" />
-    <issue id="Instantiatable" severity="warning" />
-    <issue id="LongLogTag" severity="warning" />
-    <issue id="MissingPermission" severity="warning" />
-    <issue id="MissingSuperCall" severity="warning" />
-    <issue id="NewApi" severity="warning" />
-    <issue id="OnClick" severity="warning" />
-    <issue id="ReferenceType" severity="warning" />
-    <issue id="ResourceAsColor" severity="warning" />
-    <issue id="ResourceType" severity="warning" />
-    <issue id="ValidFragment" severity="warning" />
-    <issue id="WrongConstant" severity="warning" />
-
-</lint>
deleted file mode 100644
--- a/mobile/android/app/src/main/resources/robolectric.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-sdk=21
-constants=org.mozilla.gecko.BuildConfig
deleted file mode 100644
--- a/mobile/android/app/src/test/java/org/mozilla/gecko/TestGeckoApplication.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.gecko;
-
-import android.app.Application;
-
-import org.robolectric.TestLifecycleApplication;
-
-import java.lang.reflect.Method;
-
-/**
- * GeckoApplication isn't test-lifecycle friendly: onCreate is called multiple times, which
- * re-registers Gecko event listeners, which fails.  This class is magically named so that
- * Robolectric uses it instead of the application defined in the Android manifest.  See
- * http://robolectric.blogspot.ca/2013/04/the-test-lifecycle-in-20.html.
- */
-public class TestGeckoApplication extends Application implements TestLifecycleApplication {
-  @Override public void beforeTest(Method method) {
-  }
-
-  @Override public void prepareTest(Object test) {
-  }
-
-  @Override public void afterTest(Method method) {
-  }
-}
new file mode 100644
--- /dev/null
+++ b/mobile/android/tests/background/junit4/resources/robolectric.properties
@@ -0,0 +1,2 @@
+sdk=21
+constants=org.mozilla.gecko.BuildConfig
--- a/settings.gradle
+++ b/settings.gradle
@@ -24,20 +24,22 @@ if (json.substs.MOZ_BUILD_APP != 'mobile
 // Set the Android SDK location.  This is the *least specific* mechanism, which
 // is unfortunate: we'd prefer to use the *most specific* mechanism.  That is,
 // local.properties (first 'sdk.dir', then 'android.dir') and then the
 // environment variable ANDROID_HOME will override this.  That's unfortunate,
 // but it's hard to automatically arrange better.
 System.setProperty('android.home', json.substs.ANDROID_SDK_ROOT)
 
 include ':app'
+include ':base'
 include ':omnijar'
 include ':thirdparty'
 
 project(':app').projectDir = new File("${json.topsrcdir}/mobile/android/app")
+project(':base').projectDir = new File("${json.topsrcdir}/mobile/android/app/base")
 project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar")
 project(':thirdparty').projectDir = new File("${json.topsrcdir}/mobile/android/thirdparty")
 
 if (json.substs.MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER) {
     include ':bouncer'
     project(':bouncer').projectDir = new File("${json.topsrcdir}/mobile/android/bouncer")
 }