Skip to content

Commit

Permalink
Use 'release' setting instead of 'compatibility' setting for compileJ…
Browse files Browse the repository at this point in the history
…ettyTestJava because of certain methods not found in `Deprecated` class with source compatibility specified at 1.8 https://github.com/grpc/grpc-java/actions/runs/13155287866/job/36710941635
  • Loading branch information
kannanjgithub committed Feb 6, 2025
1 parent 4801e34 commit 85d7688
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ guava-jre = "com.google.guava:guava:33.3.1-jre"
hdrhistogram = "org.hdrhistogram:HdrHistogram:2.2.2"
# 6.0.0+ use java.lang.Deprecated forRemoval and since from Java 9
jakarta-servlet-api = "jakarta.servlet:jakarta.servlet-api:5.0.0"
# Not using the relocated org.apache.tomcat:tomcat-annotations-api because it requires migrating
# java.annotation to jakarta.annotation. According to
# https://github.com/grpc/grpc-java/issues/6833#issuecomment-602242609
# there are so many different artifacts containing it, which causes classpath collisions.
# Using javax.annotation is fine as it is part of the JDK, we don't want to depend on J2EE
# where it is relocated to as org.apache.tomcat:tomcat-annotations-api. See issue #7179.
javax-annotation = "org.apache.tomcat:annotations-api:6.0.53"
javax-servlet-api = "javax.servlet:javax.servlet-api:4.0.1"
# 12.0.0+ require Java 17+
Expand Down
8 changes: 3 additions & 5 deletions servlet/jakarta/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ configurations {
undertowTestImplementation.extendsFrom(itImplementation)
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// Mechanically transform sources from grpc-servlet to use the corrected packages
def migrate(String name, String inputDir, SourceSet sourceSet) {
def outputDir = layout.buildDirectory.dir('generated/sources/jakarta-' + name)
Expand Down Expand Up @@ -115,6 +110,9 @@ if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
classpath = sourceSets.jettyTest.runtimeClasspath
testClassesDirs = sourceSets.jettyTest.output.classesDirs
}
tasks.named('compileJettyTestJava') { JavaCompile task ->
task.options.release.set 8
}
tasks.named("check").configure {
dependsOn jetty11Test
}
Expand Down

0 comments on commit 85d7688

Please sign in to comment.