@@ -42,33 +42,30 @@ java {
42
42
// Mechanically transform sources from grpc-servlet to use the corrected packages
43
43
def migrate (String name , String inputDir , SourceSet sourceSet ) {
44
44
def outputDir = layout. buildDirectory. dir(' generated/sources/jakarta-' + name)
45
- sourceSet. java. srcDir outputDir
46
- return tasks. register(' migrateSources' + name. capitalize(), Sync ) { task ->
45
+ sourceSet. java. srcDir tasks. register(' migrateSources' + name. capitalize(), Sync ) { task ->
47
46
into(outputDir)
48
47
from(" $inputDir /io/grpc/servlet" ) {
49
48
into(' io/grpc/servlet/jakarta' )
50
49
filter { String line ->
51
- line. replaceAll (' javax\\ .servlet' , ' jakarta.servlet' )
52
- .replaceAll (' io\\ .grpc\\ .servlet' , ' io.grpc.servlet.jakarta' )
50
+ line. replace (' javax.servlet' , ' jakarta.servlet' )
51
+ .replace (' io.grpc.servlet' , ' io.grpc.servlet.jakarta' )
53
52
}
54
53
}
55
54
}
56
55
}
57
56
58
- compileJava. dependsOn migrate(' main' , ' ../src/main/java' , sourceSets. main)
59
-
60
- sourcesJar. dependsOn migrateSourcesMain
57
+ migrate(' main' , ' ../src/main/java' , sourceSets. main)
61
58
62
59
// Build the set of sourceSets and classpaths to modify, since Jetty 11 requires Java 11
63
60
// and must be skipped
64
- compileUndertowTestJava . dependsOn( migrate(' undertowTest' , ' ../src/undertowTest/java' , sourceSets. undertowTest) )
65
- compileTomcatTestJava . dependsOn( migrate(' tomcatTest' , ' ../src/tomcatTest/java' , sourceSets. tomcatTest) )
61
+ migrate(' undertowTest' , ' ../src/undertowTest/java' , sourceSets. undertowTest)
62
+ migrate(' tomcatTest' , ' ../src/tomcatTest/java' , sourceSets. tomcatTest)
66
63
if (JavaVersion . current(). isJava11Compatible()) {
67
- compileJettyTestJava . dependsOn( migrate(' jettyTest' , ' ../src/jettyTest/java' , sourceSets. jettyTest) )
64
+ migrate(' jettyTest' , ' ../src/jettyTest/java' , sourceSets. jettyTest)
68
65
}
69
66
70
67
// Disable checkstyle for this project, since it consists only of generated code
71
- tasks. withType(Checkstyle ) {
68
+ tasks. withType(Checkstyle ). configureEach {
72
69
enabled = false
73
70
}
74
71
@@ -106,11 +103,11 @@ dependencies {
106
103
107
104
// Set up individual classpaths for each test, to avoid any mismatch,
108
105
// and ensure they are only used when supported by the current jvm
109
- check . dependsOn( tasks. register(' undertowTest' , Test ) {
106
+ def undertowTest = tasks. register(' undertowTest' , Test ) {
110
107
classpath = sourceSets. undertowTest. runtimeClasspath
111
108
testClassesDirs = sourceSets. undertowTest. output. classesDirs
112
- })
113
- check . dependsOn( tasks. register(' tomcat10Test' , Test ) {
109
+ }
110
+ def tomcat10Test = tasks. register(' tomcat10Test' , Test ) {
114
111
classpath = sourceSets. tomcatTest. runtimeClasspath
115
112
testClassesDirs = sourceSets. tomcatTest. output. classesDirs
116
113
@@ -127,11 +124,20 @@ check.dependsOn(tasks.register('tomcat10Test', Test) {
127
124
if (JavaVersion . current(). isJava9Compatible()) {
128
125
jvmArgs + = [' --add-opens=java.base/java.io=ALL-UNNAMED' , ' --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED' ]
129
126
}
130
- })
127
+ }
128
+
129
+ tasks. named(" check" ). configure {
130
+ dependsOn undertowTest, tomcat10Test
131
+ }
132
+
131
133
// Only run these tests if java 11+ is being used
132
134
if (JavaVersion . current(). isJava11Compatible()) {
133
- check . dependsOn( tasks. register(' jetty11Test' , Test ) {
135
+ def jetty11Test = tasks. register(' jetty11Test' , Test ) {
134
136
classpath = sourceSets. jettyTest. runtimeClasspath
135
137
testClassesDirs = sourceSets. jettyTest. output. classesDirs
136
- })
138
+ }
139
+
140
+ tasks. named(" check" ). configure {
141
+ dependsOn jetty11Test
142
+ }
137
143
}
0 commit comments