Skip to content

Commit 4801e34

Browse files
committed
Only compile and run Jetty test if Java 17.
1 parent b9ef60e commit 4801e34

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

gradle/libs.versions.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ androidx-test-ext-junit = "androidx.test.ext:junit:1.2.1"
1919
androidx-test-rules = "androidx.test:rules:1.6.1"
2020
animalsniffer = "org.codehaus.mojo:animal-sniffer:1.24"
2121
animalsniffer-annotations = "org.codehaus.mojo:animal-sniffer-annotations:1.24"
22-
assertj-core = "org.assertj:assertj-core:3.27.2"
22+
assertj-core = "org.assertj:assertj-core:3.27.3"
2323
auto-value = "com.google.auto.value:auto-value:1.11.0"
2424
auto-value-annotations = "com.google.auto.value:auto-value-annotations:1.11.0"
25-
checkstyle = "com.puppycrawl.tools:checkstyle:10.21.1"
25+
checkstyle = "com.puppycrawl.tools:checkstyle:10.21.2"
2626
commons-math3 = "org.apache.commons:commons-math3:3.6.1"
2727
conscrypt = "org.conscrypt:conscrypt-openjdk-uber:2.5.2"
2828
cronet-api = "org.chromium.net:cronet-api:119.6045.31"
@@ -34,13 +34,14 @@ cronet-embedded = "org.chromium.net:cronet-embedded:119.6045.31"
3434
errorprone-annotations = "com.google.errorprone:error_prone_annotations:2.30.0"
3535
# error-prone 2.32.0+ require Java 17+
3636
errorprone-core = "com.google.errorprone:error_prone_core:2.31.0"
37-
google-api-protos = "com.google.api.grpc:proto-google-common-protos:2.50.1"
37+
google-api-protos = "com.google.api.grpc:proto-google-common-protos:2.51.0"
3838
# google-auth-library 1.25.0+ requires error_prone_annotations 2.31.0+, which
3939
# breaks the Android build
4040
google-auth-credentials = "com.google.auth:google-auth-library-credentials:1.24.1"
4141
google-auth-oauth2Http = "com.google.auth:google-auth-library-oauth2-http:1.24.1"
4242
# Release notes: https://cloud.google.com/logging/docs/release-notes
43-
google-cloud-logging = "com.google.cloud:google-cloud-logging:3.21.1"
43+
google-cloud-logging = "com.google.cloud:google-cloud-logging:3.21.2"
44+
# 2.12.1 requires error_prone_annotations:2.36.0 but we are stuck with 2.30.0
4445
gson = "com.google.code.gson:gson:2.11.0"
4546
# 33.4.0 requires com.google.errorprone:error_prone_annotations:2.36.0 but we are stuck with 2.30.0 (see above)
4647
guava = "com.google.guava:guava:33.3.1-android"
@@ -64,8 +65,7 @@ jetty-http2-server = "org.eclipse.jetty.http2:jetty-http2-server:12.0.16"
6465
jetty-http2-server10 = "org.eclipse.jetty.http2:http2-server:10.0.20"
6566
jetty-servlet = "org.eclipse.jetty.ee10:jetty-ee10-servlet:12.0.16"
6667
jetty-servlet10 = "org.eclipse.jetty:jetty-servlet:10.0.20"
67-
# 4.9.0+ requires Java 11.
68-
jsr305 = "com.github.spotbugs:spotbugs-annotations:4.8.6"
68+
jsr305 = "com.google.code.findbugs:jsr305:3.0.2"
6969
junit = "junit:junit:4.13.2"
7070
# 2.17+ require Java 11+ (not mentioned in release notes)
7171
lincheck = "org.jetbrains.kotlinx:lincheck-jvm:2.16"

servlet/jakarta/build.gradle

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ description = "gRPC: Jakarta Servlet"
88
// Set up classpaths and source directories for different servlet tests
99
sourceSets {
1010

11-
// Only run these tests if java 11+ is being used
12-
if (JavaVersion.current().isJava11Compatible()) {
11+
// Only run these tests if the required minimum Java version is being used
12+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
1313
jettyTest {
1414
java {
1515
include '**/Jetty*.java'
1616
}
1717
}
18+
}
19+
if (JavaVersion.current().isJava11Compatible()) {
1820
tomcatTest {
1921
java {
2022
include '**/Tomcat*.java'
@@ -59,9 +61,11 @@ def migrate(String name, String inputDir, SourceSet sourceSet) {
5961

6062
migrate('main', '../src/main/java', sourceSets.main)
6163

62-
// Only build sourceSets and classpaths for tests if using Java 11
63-
if (JavaVersion.current().isJava11Compatible()) {
64+
// Only build sourceSets and classpaths for tests if using the required minimum Java version
65+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
6466
migrate('jettyTest', '../src/jettyTest/java', sourceSets.jettyTest)
67+
}
68+
if (JavaVersion.current().isJava11Compatible()) {
6569
migrate('tomcatTest', '../src/tomcatTest/java', sourceSets.tomcatTest)
6670
migrate('undertowTest', '../src/undertowTest/java', sourceSets.undertowTest)
6771
}
@@ -106,12 +110,16 @@ dependencies {
106110

107111
// Set up individual classpaths for each test, to avoid any mismatch,
108112
// and ensure they are only used when supported by the current jvm
109-
if (JavaVersion.current().isJava11Compatible()) {
113+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
110114
def jetty11Test = tasks.register('jetty11Test', Test) {
111115
classpath = sourceSets.jettyTest.runtimeClasspath
112116
testClassesDirs = sourceSets.jettyTest.output.classesDirs
113117
}
114-
118+
tasks.named("check").configure {
119+
dependsOn jetty11Test
120+
}
121+
}
122+
if (JavaVersion.current().isJava11Compatible()) {
115123
def tomcat10Test = tasks.register('tomcat10Test', Test) {
116124
classpath = sourceSets.tomcatTest.runtimeClasspath
117125
testClassesDirs = sourceSets.tomcatTest.output.classesDirs
@@ -136,6 +144,6 @@ if (JavaVersion.current().isJava11Compatible()) {
136144
}
137145

138146
tasks.named("check").configure {
139-
dependsOn jetty11Test, tomcat10Test, undertowTest
147+
dependsOn tomcat10Test, undertowTest
140148
}
141149
}

0 commit comments

Comments
 (0)