Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid accidental Java 9+ dependency with --release #10441

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ sourceSets {
}
}

compileContextJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
tasks.named("compileContextJava").configure {
if (JavaVersion.current().isJava9Compatible()) {
options.release = 7
} else {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
}

tasks.named("jar").configure {
Expand Down
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ subprojects {
}

plugins.withId("java") {
sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
testImplementation libraries.junit,
libraries.mockito.core,
Expand Down Expand Up @@ -240,6 +237,14 @@ subprojects {
}
}

tasks.withType(JavaCompile).configureEach {
if (JavaVersion.current().isJava9Compatible()) {
options.release = 8
} else {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
tasks.named("compileJava").configure {
// This project targets Java 7 (no time.Duration class)
options.errorprone.check("PreferJavaTimeOverload", CheckSeverity.OFF)
Expand Down Expand Up @@ -285,10 +290,6 @@ subprojects {
plugins.withId("me.champeau.jmh") {
// invoke jmh on a single benchmark class like so:
// ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh
tasks.named("compileJmhJava").configure {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
tasks.named("jmh").configure {
warmupIterations = 10
iterations = 10
Expand Down
3 changes: 0 additions & 3 deletions gae-interop-testing/gae-jdk8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ appengine {
group = 'io.grpc' // Generated output GroupId
version = '1.0-SNAPSHOT' // Version in generated output

sourceCompatibility = 1.8
targetCompatibility = 1.8

/** Returns the service name. */
String getGaeProject() {
def stream = new ByteArrayOutputStream()
Expand Down
4 changes: 0 additions & 4 deletions servlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ plugins {

description = "gRPC: Servlet"

// javax.servlet-api 4.0 requires a minimum of Java 8, so we might as well use that source level
sourceCompatibility = 1.8
targetCompatibility = 1.8

def jettyVersion = '10.0.7'

configurations {
Expand Down
2 changes: 0 additions & 2 deletions servlet/jakarta/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ plugins {
}

description = "gRPC: Jakarta Servlet"
sourceCompatibility = 1.8
targetCompatibility = 1.8

// Set up classpaths and source directories for different servlet tests
configurations {
Expand Down