@@ -20,7 +20,7 @@ plugins {
20
20
}
21
21
22
22
jacoco {
23
- toolVersion = " 0.8.10 "
23
+ toolVersion = " 0.8.12 "
24
24
}
25
25
26
26
// Do not generate reports for individual projects
@@ -64,46 +64,47 @@ test {
64
64
]
65
65
}
66
66
67
- // Create a task to test on JDK 21
68
- def testJdk21 = tasks. register(" testJdk21" , Test ) {
69
- onlyIf {
70
- // Only test on JDK 21 when using the latest Error Prone version
71
- deps. versions. errorProneApi == deps. versions. errorProneLatest
72
- }
73
- javaLauncher = javaToolchains. launcherFor {
74
- languageVersion = JavaLanguageVersion . of(21 )
75
- }
67
+ // Tasks for testing on other JDK versions; see https://jakewharton.com/build-on-latest-java-test-through-lowest-java/
68
+ [21 , 22 ]. each { majorVersion ->
69
+ def jdkTest = tasks. register(" testJdk$majorVersion " , Test ) {
70
+ onlyIf {
71
+ // Only run when using the latest Error Prone version
72
+ deps. versions. errorProneApi == deps. versions. errorProneLatest
73
+ }
74
+ javaLauncher = javaToolchains. launcherFor {
75
+ languageVersion = JavaLanguageVersion . of(majorVersion)
76
+ }
76
77
77
- description = " Runs the test suite on JDK 21 "
78
- group = LifecycleBasePlugin . VERIFICATION_GROUP
78
+ description = " Runs the test suite on JDK $m ajorVersion "
79
+ group = LifecycleBasePlugin . VERIFICATION_GROUP
79
80
80
- // Copy inputs from normal Test task.
81
- def testTask = tasks. getByName(" test" )
82
- classpath = testTask. classpath
83
- testClassesDirs = testTask. testClassesDirs
84
- maxHeapSize = " 1024m"
85
- // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
86
- jvmArgs + = [
87
- " --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" ,
88
- " --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" ,
89
- " --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" ,
90
- " --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED" ,
91
- " --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" ,
92
- " --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" ,
93
- " --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" ,
94
- " --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" ,
95
- " --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" ,
96
- " --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" ,
97
- // Accessed by Lombok tests
98
- " --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED" ,
99
- ]
100
- }
81
+ // Copy inputs from normal Test task.
82
+ def testTask = tasks. getByName(" test" )
83
+ classpath = testTask. classpath
84
+ testClassesDirs = testTask. testClassesDirs
85
+ maxHeapSize = " 1024m"
86
+ // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
87
+ jvmArgs + = [
88
+ " --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" ,
89
+ " --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" ,
90
+ " --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" ,
91
+ " --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED" ,
92
+ " --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" ,
93
+ " --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" ,
94
+ " --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" ,
95
+ " --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" ,
96
+ " --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" ,
97
+ " --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" ,
98
+ // Accessed by Lombok tests
99
+ " --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED" ,
100
+ ]
101
+ }
101
102
102
- tasks. named(' check' ). configure {
103
- dependsOn testJdk21
103
+ tasks. named(' check' ). configure {
104
+ dependsOn jdkTest
105
+ }
104
106
}
105
107
106
-
107
108
// Share the coverage data to be aggregated for the whole product
108
109
configurations. create(' coverageDataElements' ) {
109
110
visible = false
0 commit comments