Skip to content

Commit e10c4ea

Browse files
committed
Reorganise test setup and add additional tests
- Now testing against several Gradle versions (building against latest) - Using JUnit 5 and Spock 2 - Several test run for both the old method to address Jars (Jar file name) and the new method (group:name coordinates)
1 parent 3292934 commit e10c4ea

File tree

9 files changed

+522
-397
lines changed

9 files changed

+522
-397
lines changed

build.gradle.kts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,11 @@ java {
1616
sourceCompatibility = JavaVersion.VERSION_1_8
1717
targetCompatibility = JavaVersion.VERSION_1_8
1818
}
19-
val functionalTest: SourceSet by sourceSets.creating
20-
gradlePlugin.testSourceSets(functionalTest)
21-
val functionalTestTask = tasks.register<Test>("functionalTest") {
22-
group = "verification"
23-
testClassesDirs = functionalTest.output.classesDirs
24-
classpath = functionalTest.runtimeClasspath
25-
}
26-
tasks.check {
27-
dependsOn(functionalTestTask)
28-
}
2919

3020
dependencies {
3121
implementation("org.ow2.asm:asm:8.0.1")
32-
"functionalTestImplementation"("org.spockframework:spock-core:1.2-groovy-2.5")
22+
23+
testImplementation("org.spockframework:spock-core:2.1-groovy-3.0")
3324
}
3425

3526
gradlePlugin {
@@ -48,3 +39,23 @@ pluginBundle {
4839
vcsUrl = "https://github.com/jjohannes/extra-java-module-info.git"
4940
tags = listOf("java", "modularity", "jigsaw", "jpms")
5041
}
42+
43+
tasks.test {
44+
description = "Runs tests against the Gradle version the plugin is built with"
45+
classpath = sourceSets.test.get().runtimeClasspath
46+
useJUnitPlatform()
47+
}
48+
49+
listOf("6.4.1", "6.9.2", "7.0.2").forEach { gradleVersionUnderTest ->
50+
val testGradle = tasks.register<Test>("testGradle$gradleVersionUnderTest") {
51+
group = "verification"
52+
description = "Runs tests against Gradle $gradleVersionUnderTest"
53+
testClassesDirs = sourceSets.test.get().output.classesDirs
54+
classpath = sourceSets.test.get().runtimeClasspath
55+
useJUnitPlatform()
56+
systemProperty("gradleVersionUnderTest", gradleVersionUnderTest)
57+
}
58+
tasks.check {
59+
dependsOn(testGradle)
60+
}
61+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)