Commit d86b10b8 authored by Nick Alexander's avatar Nick Alexander
Browse files

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

--HG--
extra : rebase_source : 5244e81ffe81e8611034fea1edb07681266a7581
parent d5291625
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
import java.util.regex.Pattern

def tryInt = { string ->
    if (string == null) {
        return string
@@ -55,10 +53,6 @@ buildscript {

    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'
    }
@@ -94,21 +88,6 @@ if ('multi' == System.env.AB_CD) {
    }
}

// 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')) {
+0 −39
Original line number Diff line number Diff line
@@ -355,45 +355,6 @@ 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) {