Bug 1411667 - Remove Spoon plugin references entirely. r=maliu draft
authorNick Alexander <nalexander@mozilla.com>
Thu, 26 Oct 2017 15:49:41 -0700
changeset 687198 5244e81ffe81e8611034fea1edb07681266a7581
parent 687194 a1c5a1c9b74ec54029c6be8e9b3681efbc62c06b
child 737585 4ca23a46da78c36d8dc7fe566f1f125eeb1c49de
push id86424
push usernalexander@mozilla.com
push dateThu, 26 Oct 2017 22:50:00 +0000
reviewersmaliu
bugs1411667, 1229149
milestone58.0a1
Bug 1411667 - Remove Spoon plugin references entirely. r=maliu Spoon and some Gradle work allowed to run certain JUnit 3 test suites locally. At the time, running the various test suites was diffficult. Fast forward, and it's easier to run these suites, and in general they are only run in Android Studio. This will only get better as we move the background services tests into a separate module (Bug 1229149). MozReview-Commit-ID: KZTWmkhwi96
build.gradle
mobile/android/app/build.gradle
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,8 @@
-import java.util.regex.Pattern
-
 def tryInt = { string ->
     if (string == null) {
         return string
     }
     if (string.isInteger()) {
         return string as Integer
     }
     return string
@@ -50,20 +48,16 @@ buildscript {
         // For in tree plugins.
         maven {
             url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
         }
     }
 
     dependencies {
         classpath 'com.android.tools.build:gradle:2.3.3'
-        classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') {
-            // Without these, we get errors linting.
-            exclude module: 'guava'
-        }
         // Provided in tree.
         classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
     }
 }
 
 if ('multi' == System.env.AB_CD) {
     // Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale.  This
     // causes the
@@ -89,31 +83,16 @@ if ('multi' == System.env.AB_CD) {
         doLast {
             if (execResult.exitValue != 0) {
                 throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
             }
         }
     }
 }
 
-// Skip unit test for all build variants, unless if it was specifically requested by user.
-// The enabled property for the unit test tasks is reset based on the command line task names just before the task execution.
-// I bet there is a easier/cleaner way to do this, but this gets the job done for now.
-Pattern pattern = Pattern.compile('.*test(.+UnitTest)?.*')
-boolean startTasksIncludeTest = gradle.startParameter.taskNames.any {
-    taskName ->
-        taskName.matches(pattern)
-}
-gradle.taskGraph.beforeTask {
-    Task task ->
-        if (task.name.matches(pattern)) {
-            task.enabled = startTasksIncludeTest
-        }
-}
-
 afterEvaluate {
     subprojects {
         if (!hasProperty('android')) {
             return
         }
         android.applicationVariants.all {
             preBuild.dependsOn rootProject.generateCodeAndResources
         }
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -351,55 +351,16 @@ android.applicationVariants.all { varian
         configureVariantWithGeckoBinaries(variant)
     }
 }
 
 android.applicationVariants.all { variant ->
     configureVariantWithJNIWrappers(variant, "Fennec")
 }
 
-apply plugin: 'spoon'
-
-spoon {
-    // For now, let's be verbose.
-    debug = true
-    // It's not helpful to pass when we don't have a device connected.
-    failIfNoDeviceConnected = true
-
-    def spoonPackageName
-    if (gradle.startParameter.taskNames.contains('runBrowserTests')) {
-        spoonPackageName = 'org.mozilla.tests.browser.junit3'
-    }
-    if (gradle.startParameter.taskNames.contains('runBackgroundTests')) {
-        spoonPackageName = 'org.mozilla.gecko.background'
-    }
-    if (project.hasProperty('spoonPackageName')) {
-        // Command line overrides everything.
-        spoonPackageName = project.spoonPackageName
-    }
-    if (spoonPackageName) {
-        instrumentationArgs = ['-e', "package=${spoonPackageName}".toString()]
-    }
-}
-
-// // See discussion at https://github.com/stanfy/spoon-gradle-plugin/issues/9.
-// afterEvaluate {
-//     tasks["spoonLocal${android.testBuildType.capitalize()}AndroidTest"].outputs.upToDateWhen { false }
-
-//     // This is an awkward way to define different sets of instrumentation tests.
-//     // The task name itself is fished at runtime and the package name configured
-//     // in the spoon configuration.
-//     task runBrowserTests {
-//         dependsOn tasks["spoonLocalOldDebugAndroidTest"]
-//     }
-//     task runBackgroundTests {
-//         dependsOn tasks["spoonLocalOldDebugAndroidTest"]
-//     }
-// }
-
 // Bug 1299015: Complain to treeherder if checkstyle, lint, or unittest fails.  It's not obvious
 // how to listen to individual errors in most cases, so we just link to the reports for now.
 def makeTaskExecutionListener(artifactRootUrl) {
     return new TaskExecutionListener() {
         void beforeExecute(Task task) {
             // Do nothing.
         }