From 959323be974e77dcbf10695d4a3a5e213bfd838c Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 17 Oct 2018 11:49:30 -0700 Subject: [PATCH] Add build support for Java 11 It appears everything was already working on Java 11, except build-specific and testing issues. Updating to Netty 4.1.30 (#4940) probably fixed the last true Java 11 incompatibility. Fixes #4933 --- .travis.yml | 1 + alts/build.gradle | 1 + build.gradle | 4 ++++ compiler/build.gradle | 9 ++++++--- examples/build.gradle | 3 +++ examples/pom.xml | 6 ++++++ .../test/java/io/grpc/netty/ProtocolNegotiatorsTest.java | 1 + services/build.gradle | 1 + 8 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 952f2ab27c..e27589b34a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,7 @@ jdk: # processor based plugin. - oraclejdk8 # if both jdk 8 and 9 are removed, migrate to net.ltgt.errorprone-javacplugin (see above comment) - oraclejdk9 # if both jdk 8 and 9 are removed, migrate to net.ltgt.errorprone-javacplugin (see above comment) + - openjdk11 notifications: email: false diff --git a/alts/build.gradle b/alts/build.gradle index e22e0555d4..27518bf882 100644 --- a/alts/build.gradle +++ b/alts/build.gradle @@ -32,6 +32,7 @@ dependencies { // prefer 20.0 from libraries instead of 19.0 exclude group: 'com.google.guava', module: 'guava' } + compileOnly libraries.javax_annotation runtime project(':grpc-grpclb') testCompile libraries.guava, libraries.guava_testlib, diff --git a/build.gradle b/build.gradle index 16738611bc..41ce63ddc9 100644 --- a/build.gradle +++ b/build.gradle @@ -297,6 +297,10 @@ subprojects { } } + jacoco { + toolVersion = "0.8.2" + } + checkstyle { configDir = file("$rootDir/buildscripts") toolVersion = "6.17" diff --git a/compiler/build.gradle b/compiler/build.gradle index 253392fa5e..81d97ab8fb 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -130,11 +130,14 @@ configurations { dependencies { testCompile project(':grpc-protobuf'), - project(':grpc-stub') + project(':grpc-stub'), + libraries.javax_annotation testLiteCompile project(':grpc-protobuf-lite'), - project(':grpc-stub') + project(':grpc-stub'), + libraries.javax_annotation testNanoCompile project(':grpc-protobuf-nano'), - project(':grpc-stub') + project(':grpc-stub'), + libraries.javax_annotation } sourceSets { diff --git a/examples/build.gradle b/examples/build.gradle index f17a7c453c..824b3a323e 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -17,6 +17,9 @@ repositories { mavenLocal() } +sourceCompatibility = 1.7 +targetCompatibility = 1.7 + // IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you // are looking at a tagged version of the example and not "master"! diff --git a/examples/pom.xml b/examples/pom.xml index e067f87338..c6bb2813dc 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -40,6 +40,12 @@ grpc-alts ${grpc.version} + + javax.annotation + javax.annotation-api + 1.2 + provided + io.grpc grpc-testing diff --git a/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java b/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java index 3b94bf2c36..124a2c6df5 100644 --- a/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java +++ b/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java @@ -96,6 +96,7 @@ public class ProtocolNegotiatorsTest { sslContext = GrpcSslContexts.forServer(serverCert, key) .ciphers(TestUtils.preferredTestCiphers(), SupportedCipherSuiteFilter.INSTANCE).build(); engine = SSLContext.getDefault().createSSLEngine(); + engine.setUseClientMode(true); } @Test diff --git a/services/build.gradle b/services/build.gradle index 108127d02c..fd56e77612 100644 --- a/services/build.gradle +++ b/services/build.gradle @@ -21,6 +21,7 @@ dependencies { compileOnly libraries.javax_annotation testCompile project(':grpc-testing'), libraries.netty_epoll // for DomainSocketAddress + testCompileOnly libraries.javax_annotation signature "org.codehaus.mojo.signature:java17:1.0@signature" }