test espresso
authornevin <cnevinchen@gmail.com>
Sat, 25 Nov 2017 07:28:19 +0800
changeset 1361120 e6c98d576fd62c334481feb6eed3b2bd154b9662
parent 1360531 2ae2ae9d35e8bd2299f32a5246fe6869e792e536
child 1592863 f838d84c6b3293d7071750036b7a0907a46f2a06
push id237737
push usernechen@mozilla.com
push dateFri, 24 Nov 2017 23:30:18 +0000
treeherdertry@e6c98d576fd6 [default view] [failures only]
milestone59.0a1
test
mobile/android/app/build.gradle
mobile/android/geckoview_example/build.gradle.orig
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -15,17 +15,17 @@ android {
 
     defaultConfig {
         targetSdkVersion project.ext.targetSdkVersion
         minSdkVersion project.ext.minSdkVersion
         manifestPlaceholders = project.ext.manifestPlaceholders
 
         applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
         testApplicationId 'org.mozilla.roboexample.test'
-        testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
+        //testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
         // Used by Robolectric based tests; see TestRunner.
         buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
 
         vectorDrawables.useSupportLibrary = true
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 
     }
 
new file mode 100644
--- /dev/null
+++ b/mobile/android/geckoview_example/build.gradle.orig
@@ -0,0 +1,68 @@
+buildDir "${topobjdir}/gradle/build/mobile/android/geckoview_example"
+
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion project.ext.compileSdkVersion
+    buildToolsVersion project.ext.buildToolsVersion
+
+    defaultConfig {
+        targetSdkVersion project.ext.targetSdkVersion
+        minSdkVersion project.ext.minSdkVersion
+        manifestPlaceholders = project.ext.manifestPlaceholders
+
+        applicationId "org.mozilla.geckoview_example"
+        versionCode 1
+        versionName "1.0"
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+    }
+
+    // This is extremely frustrating, but the only way to do it automation for
+    // now.  Without this, we only get a "debugAndroidTest" configuration; we
+    // have no "withoutGeckoBinariesAndroidTest" configuration.
+    testBuildType "withoutGeckoBinaries"
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+        withGeckoBinaries { // For consistency with :geckoview project in Task Cluster invocations.
+            initWith debug
+        }
+        withoutGeckoBinaries { // Logical negation of withGeckoBinaries.
+            initWith debug
+        }
+    }
+}
+
+dependencies {
+    testCompile 'junit:junit:4.12'
+
+    compile 'com.android.support:support-annotations:23.4.0'
+
+    androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
+    androidTestCompile 'com.android.support.test:runner:1.0.1'
+    // Not defining this library again results in test-app assuming 23.1.1, and the following errors:
+    // "Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.4.0) and test app (23.1.1) differ."
+    androidTestCompile 'com.android.support:support-annotations:23.4.0'
+
+    debugCompile project(path: ':geckoview', configuration: "debug")
+    releaseCompile project(path: ':geckoview', configuration: "release")
+    withGeckoBinariesCompile project(path: ':geckoview', configuration: "withGeckoBinaries")
+    withoutGeckoBinariesCompile project(path: ':geckoview', configuration: "withoutGeckoBinaries")
+}
+
+apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
+
+android.applicationVariants.all { variant ->
+    // Like 'debug', 'release', or 'withoutGeckoBinaries'.
+    def buildType = variant.buildType.name
+
+    // It would be most natural for :geckoview to always include the Gecko
+    // binaries, but that's difficult; see the notes in
+    // mobile/android/gradle/with_gecko_binaries.gradle.  Instead we handle our
+    // own Gecko binary inclusion.
+    if (!buildType.equals('withoutGeckoBinaries')) {
+        configureVariantWithGeckoBinaries(variant)
+    }
+}