Bug 1411667 - Remove Spoon plugin references entirely. r=maliu
authorNick Alexander <nalexander@mozilla.com>
Thu, 26 Oct 2017 15:49:41 -0700
changeset 439800 d4baaf271606ac5cbdbbd22495bf42ed73ac3d38
parent 439799 1e44cf9fed8b781f1b47294f93a5c7efdafb5d8c
child 439801 7f19b2c7adc598f40bf32808324bcba463cce627
push id8114
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 16:33:21 +0000
treeherdermozilla-beta@73e0d89a540f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaliu
bugs1411667, 1229149
milestone58.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 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
@@ -350,55 +350,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.
         }