File: crossVersionTest.gradle

package info (click to toggle)
gradle 4.4.1-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 85,104 kB
  • sloc: java: 319,724; xml: 14,356; cpp: 4,200; ansic: 1,025; sh: 300; makefile: 60; asm: 17; jsp: 17; objc: 10
file content (109 lines) | stat: -rw-r--r-- 4,039 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import org.gradle.testing.CrossVersionTest

apply plugin: 'java'

sourceSets {
    crossVersionTest {
        compileClasspath += main.output
        runtimeClasspath += main.output
    }
}

configurations {
    crossVersionTestCompile.extendsFrom testCompile
    crossVersionTestImplementation.extendsFrom testImplementation
    crossVersionTestRuntime.extendsFrom testRuntime
    crossVersionTestRuntimeOnly.extendsFrom testRuntimeOnly
    partialDistribution.extendsFrom crossVersionTestRuntimeClasspath
}

dependencies {
    crossVersionTestCompile project(":internalIntegTesting")

    //so that implicit help tasks are available:
    crossVersionTestRuntime project(':diagnostics')

    //So that the wrapper and init task are added when crossVersionTests are run via commandline
    crossVersionTestRuntime project(':buildInit')
    //above can be removed when we implement the auto-apply plugins

    crossVersionTestRuntime project(":toolingApiBuilders")
}

useTestFixtures(project: ":toolingApi")

ext.crossVersionTestTasks = tasks.withType(CrossVersionTest)

crossVersionTestTasks.all { CrossVersionTest task ->
    group = "verification"
    classpath = sourceSets.crossVersionTest.runtimeClasspath
    requiresLibsRepo = true
}

task crossVersionTest(type: CrossVersionTest) {
    def defaultExecuter = project.hasProperty("defaultIntegTestExecuter") ? project.defaultIntegTestExecuter : "embedded"
    description "Runs crossVersionTest with '${defaultExecuter}' executer"
    systemProperties['org.gradle.integtest.executer'] = defaultExecuter
    if (project.hasProperty('org.gradle.integtest.debug')) {
        systemProperties['org.gradle.integtest.debug'] = 'true'
        testLogging.showStandardStreams = true
    }
    if (project.hasProperty('org.gradle.integtest.verbose')) {
        testLogging.showStandardStreams = true
    }
    if(project.hasProperty('org.gradle.integtest.launcher.debug')) {
        systemProperties['org.gradle.integtest.launcher.debug'] = 'true'
    }
}
check.dependsOn(crossVersionTest)

['embedded', 'forking'].each { mode ->
    def taskName = "${mode}CrossVersionTest"
    tasks.create(taskName, CrossVersionTest).configure {
        description "Runs crossVersionTests with '${mode}' executer"
        systemProperties['org.gradle.integtest.executer'] = mode
    }
}

task allVersionsCrossVersionTests {
    description "Runs the cross-version tests against all Gradle versions with 'forking' executer"
}

task quickFeedbackCrossVersionTests {
    description "Runs the cross-version tests against a subset of selected Gradle versions with 'forking' executer for quick feedback"
}

releasedVersions.testedVersions.each { targetVersion ->
    tasks.create("gradle${targetVersion}CrossVersionTest", CrossVersionTest).configure {
        allVersionsCrossVersionTests.dependsOn it
        description "Runs the cross-version tests against Gradle ${targetVersion}"
        systemProperties['org.gradle.integtest.versions'] = targetVersion
        systemProperties['org.gradle.integtest.executer'] = 'forking'
    }
}

releasedVersions.getTestedVersions(true).each { targetVersion ->
    tasks.getByName("gradle${targetVersion}CrossVersionTest").configure {
        quickFeedbackCrossVersionTests.dependsOn it
    }
}

plugins.withType(org.gradle.plugins.ide.idea.IdeaPlugin) { // lazy as plugin not applied yet
    idea {
        module {
            testSourceDirs += sourceSets.crossVersionTest.groovy.srcDirs
            testSourceDirs += sourceSets.crossVersionTest.resources.srcDirs
            scopes.TEST.plus.add(configurations.crossVersionTestCompileClasspath)
            scopes.TEST.plus.add(configurations.crossVersionTestRuntimeClasspath)
        }
    }
}

plugins.withType(org.gradle.plugins.ide.eclipse.EclipsePlugin) { // lazy as plugin not applied yet
    eclipse {
        classpath {
            plusConfigurations.add(configurations.crossVersionTestCompileClasspath)
            plusConfigurations.add(configurations.crossVersionTestRuntimeClasspath)
        }
    }
}