From 432f47a4228998255d8de49a995246631f0618f9 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 00:00:19 -0700 Subject: [PATCH 01/21] context: migrate away deprecated gradle configurations --- context/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/context/build.gradle b/context/build.gradle index 832e22accba..a434a04e9b0 100644 --- a/context/build.gradle +++ b/context/build.gradle @@ -10,7 +10,9 @@ plugins { description = 'gRPC: Context' dependencies { - testCompile libraries.jsr305, libraries.guava_testlib + testImplementation libraries.guava_testlib, + libraries.jsr305 + signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" } From b05a22c91474cac27c1fb6695f2d8032cc707171 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 11:29:54 -0700 Subject: [PATCH 02/21] all: use java-library gradle plugin for grpc-api --- android/build.gradle | 12 ++++++------ api/build.gradle | 20 ++++++-------------- auth/build.gradle | 1 + build.gradle | 14 ++++++++++++++ census/build.gradle | 2 +- core/build.gradle | 4 ++-- cronet/build.gradle | 17 ++++++++--------- netty/build.gradle | 2 +- okhttp/build.gradle | 2 +- protobuf-lite/build.gradle | 8 +------- protobuf/build.gradle | 8 +------- stub/build.gradle | 4 +++- 12 files changed, 45 insertions(+), 49 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 83dfc39fb80..9d16a2bc90c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -27,12 +27,12 @@ repositories { dependencies { implementation project(':grpc-core') - - testImplementation project('::grpc-okhttp') - testImplementation libraries.androidx_test - testImplementation libraries.junit - testImplementation libraries.robolectric - testImplementation libraries.truth + guavaDependency 'implementation' + testImplementation project('::grpc-okhttp'), + libraries.androidx_test, + libraries.junit, + libraries.robolectric, + libraries.truth } task javadocs(type: Javadoc) { diff --git a/api/build.gradle b/api/build.gradle index 09361582df8..96a677ee81f 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "me.champeau.gradle.jmh" @@ -11,20 +11,12 @@ description = 'gRPC: API' evaluationDependsOn(project(':grpc-context').path) dependencies { - compile project(':grpc-context'), - libraries.errorprone, - libraries.jsr305, - libraries.animalsniffer_annotations - compile (libraries.guava) { - // prefer our own versions from libraries instead of Guava's dependency - exclude group: 'com.google.errorprone', module: 'error_prone_annotations' - exclude group: 'com.google.code.findbugs', module: 'jsr305' - exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations' - } - - testCompile project(':grpc-context').sourceSets.test.output, - project(':grpc-testing'), + api project(':grpc-context'), + libraries.jsr305 + guavaDependency 'implementation' + testImplementation project(':grpc-context').sourceSets.test.output, project(':grpc-grpclb'), + project(':grpc-testing'), libraries.guava_testlib jmh project(':grpc-core') diff --git a/auth/build.gradle b/auth/build.gradle index 2dafc0f4fd9..04ff8afc21f 100644 --- a/auth/build.gradle +++ b/auth/build.gradle @@ -10,6 +10,7 @@ description = "gRPC: Auth" dependencies { compile project(':grpc-api'), libraries.google_auth_credentials + guavaDependency 'implementation' testCompile project(':grpc-testing'), libraries.google_auth_oauth2_http signature "org.codehaus.mojo.signature:java17:1.0@signature" diff --git a/build.gradle b/build.gradle index f3fd9180769..176b190d6a2 100644 --- a/build.gradle +++ b/build.gradle @@ -185,6 +185,20 @@ subprojects { // Jetty ALPN dependencies jetty_alpn_agent: 'org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.9' ] + + // A util function to config guava dependency with the given configuration + // name. We exclude some of its transitive dependencies and manually + // add them with a specific version. + guavaDependency = { configurationName -> + dependencies."$configurationName"(libraries.guava) { + exclude group: 'com.google.code.findbugs', module: 'jsr305' + exclude group: 'com.google.errorprone', module: 'error_prone_annotations' + exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations' + } + dependencies."$configurationName" libraries.errorprone + dependencies.runtimeOnly libraries.animalsniffer_annotations + dependencies.runtimeOnly libraries.jsr305 + } } // Define a separate configuration for managing the dependency on Jetty ALPN agent. diff --git a/census/build.gradle b/census/build.gradle index 1c08390d185..8e719146e7b 100644 --- a/census/build.gradle +++ b/census/build.gradle @@ -27,7 +27,7 @@ dependencies { // prefer 20.0 from libraries instead of 19.0 exclude group: 'com.google.guava', module: 'guava' } - + guavaDependency 'implementation' testCompile project(':grpc-api').sourceSets.test.output, project(':grpc-context').sourceSets.test.output, project(':grpc-core').sourceSets.test.output, diff --git a/core/build.gradle b/core/build.gradle index e4a218cf3bb..12024f3cd91 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -16,11 +16,11 @@ dependencies { compile project(':grpc-api'), libraries.gson, libraries.android_annotations, - libraries.errorprone // prefer our version to perfmark's 2.3.3 compile (libraries.perfmark) { exclude group: 'com.google.errorprone', module: 'error_prone_annotations' } - + implementation libraries.animalsniffer_annotations + guavaDependency 'implementation' testCompile project(':grpc-context').sourceSets.test.output, project(':grpc-api').sourceSets.test.output, project(':grpc-testing'), diff --git a/cronet/build.gradle b/cronet/build.gradle index aac89f07614..11f329f8e8a 100644 --- a/cronet/build.gradle +++ b/cronet/build.gradle @@ -33,15 +33,14 @@ android { } dependencies { - implementation project(':grpc-core') - testImplementation project(':grpc-testing') - - implementation libraries.cronet_api - testImplementation libraries.cronet_embedded - - testImplementation libraries.junit - testImplementation libraries.mockito - testImplementation libraries.robolectric + implementation project(':grpc-core'), + libraries.cronet_api + guavaDependency 'implementation' + testImplementation project(':grpc-testing'), + libraries.cronet_embedded, + libraries.junit, + libraries.mockito, + libraries.robolectric } task javadocs(type: Javadoc) { diff --git a/netty/build.gradle b/netty/build.gradle index c895a682a71..855b957685a 100644 --- a/netty/build.gradle +++ b/netty/build.gradle @@ -19,7 +19,7 @@ dependencies { compile project(':grpc-core'), libraries.netty, libraries.netty_proxy_handler - + guavaDependency 'implementation' // Tests depend on base class defined by core module. testCompile project(':grpc-core').sourceSets.test.output, project(':grpc-testing'), diff --git a/okhttp/build.gradle b/okhttp/build.gradle index b594600c2d5..46bf469462b 100644 --- a/okhttp/build.gradle +++ b/okhttp/build.gradle @@ -18,7 +18,7 @@ dependencies { // prefer our own versions instead of okhttp's dependency exclude group: 'com.squareup.okio', module: 'okio' } - + guavaDependency 'implementation' // Tests depend on base class defined by core module. testCompile project(':grpc-core').sourceSets.test.output, project(':grpc-testing'), diff --git a/protobuf-lite/build.gradle b/protobuf-lite/build.gradle index 9341c60cfad..60bae7c3029 100644 --- a/protobuf-lite/build.gradle +++ b/protobuf-lite/build.gradle @@ -12,13 +12,7 @@ description = 'gRPC: Protobuf Lite' dependencies { compile project(':grpc-api'), libraries.protobuf_lite - compile (libraries.guava) { - // prefer our own versions from libraries instead of Guava's dependency - exclude group: 'com.google.errorprone', module: 'error_prone_annotations' - exclude group: 'com.google.code.findbugs', module: 'jsr305' - exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations' - } - + guavaDependency 'implementation' testCompile project(':grpc-core') signature "org.codehaus.mojo.signature:java17:1.0@signature" diff --git a/protobuf/build.gradle b/protobuf/build.gradle index d7cbca8f3f9..25c02f76df2 100644 --- a/protobuf/build.gradle +++ b/protobuf/build.gradle @@ -12,13 +12,6 @@ description = 'gRPC: Protobuf' dependencies { compile project(':grpc-api'), libraries.protobuf - compile (libraries.guava) { - // prefer our own versions from libraries instead of Guava's dependency - exclude group: 'com.google.errorprone', module: 'error_prone_annotations' - exclude group: 'com.google.code.findbugs', module: 'jsr305' - exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations' - } - compile (libraries.google_api_protos) { // 'com.google.api:api-common' transitively depends on auto-value, which breaks our // annotations. @@ -30,6 +23,7 @@ dependencies { compile (project(':grpc-protobuf-lite')) { exclude group: 'com.google.protobuf', module: 'protobuf-javalite' } + guavaDependency 'implementation' signature "org.codehaus.mojo.signature:java17:1.0@signature" } diff --git a/stub/build.gradle b/stub/build.gradle index 2b7c82e5bfc..d144e197315 100644 --- a/stub/build.gradle +++ b/stub/build.gradle @@ -8,7 +8,9 @@ plugins { description = "gRPC: Stub" dependencies { - compile project(':grpc-api') + compile project(':grpc-api'), + libraries.errorprone + guavaDependency 'compile' testCompile libraries.truth, project(':grpc-testing') signature "org.codehaus.mojo.signature:java17:1.0@signature" From 9bd2f7c718eae7d3c85c81e8651e569a4dd0fa63 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 12:11:27 -0700 Subject: [PATCH 03/21] core,netty,okhttp: use java-library plugin for grpc-core --- build.gradle | 9 +++++++++ core/build.gradle | 21 +++++++++------------ netty/build.gradle | 1 + okhttp/build.gradle | 1 + 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 176b190d6a2..6f5f79fcec0 100644 --- a/build.gradle +++ b/build.gradle @@ -199,6 +199,15 @@ subprojects { dependencies.runtimeOnly libraries.animalsniffer_annotations dependencies.runtimeOnly libraries.jsr305 } + // A util function to config perfmark dependency with the given configuration + // name. We exclude some of its transitive dependencies and manually + // add them with a specific version. + perfmarkDependency = { configurationName -> + dependencies."$configurationName"(libraries.perfmark) { + exclude group: 'com.google.errorprone', module: 'error_prone_annotations' + } + dependencies.runtimeOnly libraries.errorprone + } } // Define a separate configuration for managing the dependency on Jetty ALPN agent. diff --git a/core/build.gradle b/core/build.gradle index 12024f3cd91..e71b2b98447 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "me.champeau.gradle.japicmp" @@ -13,20 +13,17 @@ evaluationDependsOn(project(':grpc-context').path) evaluationDependsOn(project(':grpc-api').path) dependencies { - compile project(':grpc-api'), - libraries.gson, - libraries.android_annotations, - compile (libraries.perfmark) { - exclude group: 'com.google.errorprone', module: 'error_prone_annotations' - } - implementation libraries.animalsniffer_annotations + api project(':grpc-api') + implementation libraries.android_annotations, + libraries.animalsniffer_annotations, + libraries.gson guavaDependency 'implementation' - testCompile project(':grpc-context').sourceSets.test.output, - project(':grpc-api').sourceSets.test.output, - project(':grpc-testing'), + perfmarkDependency 'implementation' + testImplementation project(':grpc-api').sourceSets.test.output, + project(':grpc-context').sourceSets.test.output, project(':grpc-grpclb'), + project(':grpc-testing'), libraries.guava_testlib - testRuntimeOnly project(':grpc-census') jmh project(':grpc-testing') diff --git a/netty/build.gradle b/netty/build.gradle index 855b957685a..d4ea04967a6 100644 --- a/netty/build.gradle +++ b/netty/build.gradle @@ -20,6 +20,7 @@ dependencies { libraries.netty, libraries.netty_proxy_handler guavaDependency 'implementation' + perfmarkDependency 'implementation' // Tests depend on base class defined by core module. testCompile project(':grpc-core').sourceSets.test.output, project(':grpc-testing'), diff --git a/okhttp/build.gradle b/okhttp/build.gradle index 46bf469462b..bdf81e465ca 100644 --- a/okhttp/build.gradle +++ b/okhttp/build.gradle @@ -19,6 +19,7 @@ dependencies { exclude group: 'com.squareup.okio', module: 'okio' } guavaDependency 'implementation' + perfmarkDependency 'implementation' // Tests depend on base class defined by core module. testCompile project(':grpc-core').sourceSets.test.output, project(':grpc-testing'), From 5090e29a27aa4db8c00493c99e4f62d3026df035 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 13:26:14 -0700 Subject: [PATCH 04/21] stub: use java-library gradle plugin --- stub/build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stub/build.gradle b/stub/build.gradle index d144e197315..9d5ea08e310 100644 --- a/stub/build.gradle +++ b/stub/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "me.champeau.gradle.japicmp" @@ -8,11 +8,11 @@ plugins { description = "gRPC: Stub" dependencies { - compile project(':grpc-api'), - libraries.errorprone - guavaDependency 'compile' - testCompile libraries.truth, - project(':grpc-testing') + api project(':grpc-api') + guavaDependency 'api' + testImplementation project(':grpc-testing'), + libraries.truth + signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" } From 648ce634628e72859bf05067f58cba89baec70f2 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 14:06:44 -0700 Subject: [PATCH 05/21] compiler: migrate away deprecated gradle configurations --- compiler/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/build.gradle b/compiler/build.gradle index 098f48c3080..60d3a436f6c 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -126,14 +126,14 @@ model { } configurations { - testLiteCompile + testLiteImplementation } dependencies { - testCompile project(':grpc-protobuf'), + testImplementation project(':grpc-protobuf'), project(':grpc-stub'), libraries.javax_annotation - testLiteCompile project(':grpc-protobuf-lite'), + testLiteImplementation project(':grpc-protobuf-lite'), project(':grpc-stub'), libraries.javax_annotation } From b8366a8d88aa1ea0939104c907b09ec45463ddf4 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 14:44:01 -0700 Subject: [PATCH 06/21] protobuf, protobuf-lite: use java-library gradle plugin --- protobuf-lite/build.gradle | 6 +++--- protobuf/build.gradle | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/protobuf-lite/build.gradle b/protobuf-lite/build.gradle index 60bae7c3029..8bd079d4a17 100644 --- a/protobuf-lite/build.gradle +++ b/protobuf-lite/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "com.google.protobuf" @@ -10,10 +10,10 @@ plugins { description = 'gRPC: Protobuf Lite' dependencies { - compile project(':grpc-api'), + api project(':grpc-api'), libraries.protobuf_lite guavaDependency 'implementation' - testCompile project(':grpc-core') + testImplementation project(':grpc-core') signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" diff --git a/protobuf/build.gradle b/protobuf/build.gradle index 25c02f76df2..198a0988517 100644 --- a/protobuf/build.gradle +++ b/protobuf/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "com.google.protobuf" @@ -10,19 +10,18 @@ plugins { description = 'gRPC: Protobuf' dependencies { - compile project(':grpc-api'), + api project(':grpc-api'), libraries.protobuf - compile (libraries.google_api_protos) { + api (project(':grpc-protobuf-lite')) { + exclude group: 'com.google.protobuf', module: 'protobuf-javalite' + } + api (libraries.google_api_protos) { // 'com.google.api:api-common' transitively depends on auto-value, which breaks our // annotations. exclude group: 'com.google.api', module: 'api-common' - // Prefer our more up-to-date protobuf over 3.2.0 + // prefer our own version from libraries exclude group: 'com.google.protobuf', module: 'protobuf-java' } - - compile (project(':grpc-protobuf-lite')) { - exclude group: 'com.google.protobuf', module: 'protobuf-javalite' - } guavaDependency 'implementation' signature "org.codehaus.mojo.signature:java17:1.0@signature" From 825679e981ef42d2ef27b0091c2af213fc14cc58 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 15:04:20 -0700 Subject: [PATCH 07/21] auth: use java-library gradle plugin --- auth/build.gradle | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/auth/build.gradle b/auth/build.gradle index 04ff8afc21f..82b30db391f 100644 --- a/auth/build.gradle +++ b/auth/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "me.champeau.gradle.japicmp" @@ -8,11 +8,12 @@ plugins { description = "gRPC: Auth" dependencies { - compile project(':grpc-api'), + api project(':grpc-api'), libraries.google_auth_credentials guavaDependency 'implementation' - testCompile project(':grpc-testing'), + testImplementation project(':grpc-testing'), libraries.google_auth_oauth2_http + signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" } From d88a309a5b8c70ac2c9f941126ec11484666709f Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 15:10:30 -0700 Subject: [PATCH 08/21] benchmarks: migrate away deprecated gradle configurations --- benchmarks/build.gradle | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle index 7bf6336325b..05afc8b42f1 100644 --- a/benchmarks/build.gradle +++ b/benchmarks/build.gradle @@ -21,20 +21,20 @@ configurations { } dependencies { - compile project(':grpc-core'), + alpnagent libraries.jetty_alpn_agent + + compileOnly libraries.javax_annotation + implementation project(':grpc-core'), project(':grpc-netty'), project(':grpc-okhttp'), project(':grpc-stub'), project(':grpc-protobuf'), project(':grpc-testing'), libraries.hdrhistogram, - libraries.netty_tcnative, + libraries.math, libraries.netty_epoll, - libraries.math - compileOnly libraries.javax_annotation - alpnagent libraries.jetty_alpn_agent - - testCompile libraries.junit, + libraries.netty_tcnative + testImplementation libraries.junit, libraries.mockito } From c25e37681b6a10fbd2ddfe1c4faa31cd5515359d Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 15:18:42 -0700 Subject: [PATCH 09/21] all: use java-library gradle plugin for grpc-census --- android-interop-testing/build.gradle | 2 +- build.gradle | 31 ++++++++++++++++++++++++++++ census/build.gradle | 26 +++++------------------ interop-testing/build.gradle | 1 + testing/build.gradle | 9 +------- 5 files changed, 39 insertions(+), 30 deletions(-) diff --git a/android-interop-testing/build.gradle b/android-interop-testing/build.gradle index 36d3d21d53b..75739f08d45 100644 --- a/android-interop-testing/build.gradle +++ b/android-interop-testing/build.gradle @@ -61,10 +61,10 @@ dependencies { project(':grpc-testing'), libraries.junit, libraries.truth - implementation (libraries.google_auth_oauth2_http) { exclude group: 'org.apache.httpcomponents' } + censusGrpcMetricDependency 'implementation' compileOnly libraries.javax_annotation diff --git a/build.gradle b/build.gradle index 6f5f79fcec0..3acf6d9902b 100644 --- a/build.gradle +++ b/build.gradle @@ -199,6 +199,37 @@ subprojects { dependencies.runtimeOnly libraries.animalsniffer_annotations dependencies.runtimeOnly libraries.jsr305 } + + // A util function to config opencensus_api dependency with the given + // configuration name. We exclude some of its transitive dependencies + // and manually add them with a specific version. + censusApiDependency = { configurationName -> + dependencies."$configurationName"(libraries.opencensus_api) { + exclude group: 'com.google.code.findbugs', module: 'jsr305' + exclude group: 'com.google.guava', module: 'guava' + // we'll always be more up-to-date + exclude group: 'io.grpc', module: 'grpc-context' + } + dependencies.runtimeOnly project(':grpc-context') + dependencies.runtimeOnly libraries.jsr305 + guavaDependency 'runtimeOnly' + } + + // A util function to config opencensus_contrib_grpc_metrics dependency + // with the given configuration name. We exclude some of its transitive + // dependencies and manually add them with a specific version. + censusGrpcMetricDependency = { configurationName -> + dependencies."$configurationName"(libraries.opencensus_contrib_grpc_metrics) { + exclude group: 'com.google.code.findbugs', module: 'jsr305' + exclude group: 'com.google.guava', module: 'guava' + // we'll always be more up-to-date + exclude group: 'io.grpc', module: 'grpc-context' + } + dependencies.runtimeOnly project(':grpc-context') + dependencies.runtimeOnly libraries.jsr305 + guavaDependency 'runtimeOnly' + } + // A util function to config perfmark dependency with the given configuration // name. We exclude some of its transitive dependencies and manually // add them with a specific version. diff --git a/census/build.gradle b/census/build.gradle index 8e719146e7b..dbf6c946787 100644 --- a/census/build.gradle +++ b/census/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" } @@ -8,27 +8,11 @@ description = 'gRPC: Census' evaluationDependsOn(project(':grpc-api').path) dependencies { - compile project(':grpc-api') - - compile (libraries.opencensus_api) { - // prefer 3.0.2 from libraries instead of 3.0.1 - exclude group: 'com.google.code.findbugs', module: 'jsr305' - // prefer 20.0 from libraries instead of 19.0 - exclude group: 'com.google.guava', module: 'guava' - // we'll always be more up-to-date - exclude group: 'io.grpc', module: 'grpc-context' - } - - compile (libraries.opencensus_contrib_grpc_metrics) { - // prefer 3.0.2 from libraries instead of 3.0.1 - exclude group: 'com.google.code.findbugs', module: 'jsr305' - // we'll always be more up-to-date - exclude group: 'io.grpc', module: 'grpc-context' - // prefer 20.0 from libraries instead of 19.0 - exclude group: 'com.google.guava', module: 'guava' - } + api project(':grpc-api') + censusApiDependency 'implementation' + censusGrpcMetricDependency 'implementation' guavaDependency 'implementation' - testCompile project(':grpc-api').sourceSets.test.output, + testImplementation project(':grpc-api').sourceSets.test.output, project(':grpc-context').sourceSets.test.output, project(':grpc-core').sourceSets.test.output, project(':grpc-testing'), diff --git a/interop-testing/build.gradle b/interop-testing/build.gradle index 30ece36169f..c52460469ef 100644 --- a/interop-testing/build.gradle +++ b/interop-testing/build.gradle @@ -31,6 +31,7 @@ dependencies { libraries.junit, libraries.truth compileOnly libraries.javax_annotation + censusGrpcMetricDependency 'implementation' runtime libraries.opencensus_impl, libraries.netty_tcnative, project(':grpc-grpclb') diff --git a/testing/build.gradle b/testing/build.gradle index 54c9dff6d05..6c9ababa23c 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -14,14 +14,7 @@ dependencies { project(':grpc-stub'), libraries.junit - compile (libraries.opencensus_api) { - // prefer 3.0.2 from libraries instead of 3.0.1 - exclude group: 'com.google.code.findbugs', module: 'jsr305' - // prefer 20.0 from libraries instead of 19.0 - exclude group: 'com.google.guava', module: 'guava' - // we'll always be more up-to-date - exclude group: 'io.grpc', module: 'grpc-context' - } + censusApiDependency 'implementation' testCompile (libraries.mockito) { // prefer our own versions instead of mockito's dependency From dfa15e7ebde5cfa1a71c95fc3821368300720f0a Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 16:15:09 -0700 Subject: [PATCH 10/21] grpclb: migrate away deprecated gradle configurations --- grpclb/build.gradle | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/grpclb/build.gradle b/grpclb/build.gradle index 1fd118c878f..99342295a0e 100644 --- a/grpclb/build.gradle +++ b/grpclb/build.gradle @@ -11,17 +11,17 @@ description = "gRPC: GRPCLB LoadBalancer plugin" evaluationDependsOn(project(':grpc-core').path) dependencies { - compile project(':grpc-core'), + compileOnly libraries.javax_annotation + implementation project(':grpc-core'), project(':grpc-protobuf'), project(':grpc-stub'), - libraries.protobuf - compile (libraries.protobuf_util) { - // prefer our own versions instead of protobuf-util's dependency - exclude group: 'com.google.guava', module: 'guava' + implementation (libraries.protobuf_util) { + // prefer our own version from grpc-stub instead of protobuf-util's dependency exclude group: 'com.google.errorprone', module: 'error_prone_annotations' + // prefer our own version from grpc-stub instead of protobuf-util's dependency + exclude group: 'com.google.guava', module: 'guava' } - compileOnly libraries.javax_annotation - testCompile libraries.truth, + testImplementation libraries.truth, project(':grpc-core').sourceSets.test.output } From ad39f554648dbb3062483efe16575a09535e45dc Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 20:41:55 -0700 Subject: [PATCH 11/21] netty: use java-library gradle plugin --- netty/build.gradle | 20 +++++++++++--------- netty/shaded/build.gradle | 8 ++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/netty/build.gradle b/netty/build.gradle index d4ea04967a6..b2e197c09f4 100644 --- a/netty/build.gradle +++ b/netty/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "me.champeau.gradle.japicmp" @@ -16,20 +16,22 @@ configurations { evaluationDependsOn(project(':grpc-core').path) dependencies { - compile project(':grpc-core'), - libraries.netty, - libraries.netty_proxy_handler + alpnagent libraries.jetty_alpn_agent + + api project(':grpc-core'), + libraries.netty + implementation libraries.netty_proxy_handler guavaDependency 'implementation' perfmarkDependency 'implementation' // Tests depend on base class defined by core module. - testCompile project(':grpc-core').sourceSets.test.output, + testImplementation project(':grpc-core').sourceSets.test.output, project(':grpc-testing'), project(':grpc-testing-proto') - testRuntime libraries.netty_tcnative, - libraries.conscrypt, - libraries.netty_epoll + testRuntimeOnly libraries.conscrypt, + libraries.netty_epoll, + libraries.netty_tcnative + signature "org.codehaus.mojo.signature:java17:1.0@signature" - alpnagent libraries.jetty_alpn_agent } import net.ltgt.gradle.errorprone.CheckSeverity diff --git a/netty/shaded/build.gradle b/netty/shaded/build.gradle index 1ecc36d9708..e42eef57c6e 100644 --- a/netty/shaded/build.gradle +++ b/netty/shaded/build.gradle @@ -10,10 +10,10 @@ description = "gRPC: Netty Shaded" sourceSets { testShadow {} } dependencies { - compile project(':grpc-netty') - runtime libraries.netty_tcnative, - libraries.netty_epoll - testShadowCompile files(shadowJar), + implementation project(':grpc-netty') + runtimeOnly libraries.netty_epoll, + libraries.netty_tcnative + testShadowImplementation files(shadowJar), configurations.shadow, project(':grpc-testing-proto'), project(':grpc-testing'), From 901f95d4e1b8406f8cf7f2bcde01ea448efcee3e Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 21:03:01 -0700 Subject: [PATCH 12/21] okhttp: use java-library gradle plugin --- okhttp/build.gradle | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/okhttp/build.gradle b/okhttp/build.gradle index bdf81e465ca..0bfbc2d8c47 100644 --- a/okhttp/build.gradle +++ b/okhttp/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "me.champeau.gradle.japicmp" @@ -11,19 +11,19 @@ description = "gRPC: OkHttp" evaluationDependsOn(project(':grpc-core').path) dependencies { - compile project(':grpc-core'), - libraries.okio - - compile (libraries.okhttp) { + api project(':grpc-core') + api (libraries.okhttp) { // prefer our own versions instead of okhttp's dependency exclude group: 'com.squareup.okio', module: 'okio' } + implementation libraries.okio guavaDependency 'implementation' perfmarkDependency 'implementation' // Tests depend on base class defined by core module. - testCompile project(':grpc-core').sourceSets.test.output, - project(':grpc-testing'), - project(':grpc-netty') + testImplementation project(':grpc-core').sourceSets.test.output, + project(':grpc-netty'), + project(':grpc-testing') + signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" } From 553bde280f80248fd5944fa6348977279922232c Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 21:06:23 -0700 Subject: [PATCH 13/21] rls: migrate away deprecated gradle configurations --- rls/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rls/build.gradle b/rls/build.gradle index 14dad4e508c..b59f8b57fc7 100644 --- a/rls/build.gradle +++ b/rls/build.gradle @@ -9,12 +9,12 @@ description = "gRPC: RouteLookupService Loadbalancing plugin" evaluationDependsOn(project(':grpc-core').path) dependencies { + compileOnly libraries.javax_annotation implementation project(':grpc-core'), project(':grpc-protobuf'), project(':grpc-stub') - compileOnly libraries.javax_annotation - testCompile libraries.truth, - project(':grpc-core').sourceSets.test.output // for FakeClock + testImplementation project(':grpc-core').sourceSets.test.output, // for FakeClock + libraries.truth } configureProtoCompilation() From af87b65d366a1bd7ace7eed78764c73de019300b Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 21:15:48 -0700 Subject: [PATCH 14/21] services: use java-library gradle plugin --- services/build.gradle | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/services/build.gradle b/services/build.gradle index 5a759844352..89f881302f6 100644 --- a/services/build.gradle +++ b/services/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "com.google.protobuf" @@ -19,20 +19,21 @@ description = "gRPC: Services" evaluationDependsOn(project(':grpc-core').path) dependencies { - compile project(':grpc-protobuf'), - project(':grpc-stub'), - project(':grpc-core') - compile (libraries.protobuf_util) { - // prefer our own versions instead of protobuf-util's dependency - exclude group: 'com.google.guava', module: 'guava' + api project(':grpc-core'), + project(':grpc-protobuf'), + project(':grpc-stub') + compileOnly libraries.javax_annotation + implementation (libraries.protobuf_util) { + // prefer our own version from grpc-stub instead of protobuf-util's dependency exclude group: 'com.google.errorprone', module: 'error_prone_annotations' + // prefer our own version from grpc-stub instead of protobuf-util's dependency + exclude group: 'com.google.guava', module: 'guava' } - - compileOnly libraries.javax_annotation - testCompile project(':grpc-testing'), + testCompileOnly libraries.javax_annotation + testImplementation project(':grpc-testing'), libraries.netty_epoll, // for DomainSocketAddress project(':grpc-core').sourceSets.test.output // for FakeClock - testCompileOnly libraries.javax_annotation + signature "org.codehaus.mojo.signature:java17:1.0@signature" } From 318e601f090ae15a6fa40a4a7a541443618614df Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 21:21:43 -0700 Subject: [PATCH 15/21] xds: migrate away deprecated gradle configurations --- xds/build.gradle | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/xds/build.gradle b/xds/build.gradle index f71fb3f3944..4603804e26e 100644 --- a/xds/build.gradle +++ b/xds/build.gradle @@ -19,42 +19,40 @@ description = "gRPC: XDS plugin" evaluationDependsOn(project(':grpc-core').path) dependencies { - compile project(':grpc-protobuf'), + compileOnly libraries.javax_annotation, + // At runtime use the epoll included in grpc-netty-shaded + libraries.netty_epoll + implementation project(':grpc-protobuf'), project(':grpc-stub'), project(':grpc-core'), project(':grpc-services'), project(path: ':grpc-alts', configuration: 'shadow'), libraries.gson - def nettyDependency = compile project(':grpc-netty') - - compile (libraries.opencensus_proto) { - // prefer our own versions instead of opencensus_proto's + def nettyDependency = implementation project(':grpc-netty') + implementation (libraries.opencensus_proto) { + // prefer our own version from grpc-protobuf instead of opencensus_proto's dependency exclude group: 'com.google.protobuf', module: 'protobuf-java' + // we'll always be more up-to-date exclude group: 'io.grpc', module: 'grpc-protobuf' exclude group: 'io.grpc', module: 'grpc-stub' } - compile (libraries.protobuf_util) { - // prefer our own versions instead of protobuf-util's dependency - exclude group: 'com.google.guava', module: 'guava' + implementation (libraries.protobuf_util) { + // prefer our own version from grpc-stub instead of protobuf-util's dependency exclude group: 'com.google.errorprone', module: 'error_prone_annotations' + // prefer our own version from grpc-stub instead of protobuf-util's dependency + exclude group: 'com.google.guava', module: 'guava' } - - testCompile project(':grpc-core').sourceSets.test.output - - compileOnly libraries.javax_annotation, - // At runtime use the epoll included in grpc-netty-shaded - libraries.netty_epoll - - testCompile project(':grpc-testing'), + testImplementation project(':grpc-core').sourceSets.test.output, + project(':grpc-testing'), project(':grpc-testing-proto'), libraries.guava_testlib, libraries.netty_epoll + testRuntimeOnly libraries.netty_tcnative - shadow configurations.compile.getDependencies().minus([nettyDependency]) + shadow configurations.implementation.getDependencies().minus([nettyDependency]) shadow project(path: ':grpc-netty-shaded', configuration: 'shadow') signature "org.codehaus.mojo.signature:java17:1.0@signature" - testRuntime libraries.netty_tcnative } sourceSets { From 3e1d1e4ed6abfc4ae9d7d79a427095a24b4b9127 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 22:05:40 -0700 Subject: [PATCH 16/21] alts: use java-library gradle plugin --- alts/build.gradle | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/alts/build.gradle b/alts/build.gradle index 9796ada6abc..555da862040 100644 --- a/alts/build.gradle +++ b/alts/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "com.github.johnrengelman.shadow" @@ -13,35 +13,35 @@ sourceCompatibility = 1.7 targetCompatibility = 1.7 dependencies { - compile project(':grpc-auth'), - project(':grpc-core'), + api project(':grpc-core') + compileOnly libraries.javax_annotation + implementation project(':grpc-auth'), project(':grpc-grpclb'), project(':grpc-protobuf'), project(':grpc-stub'), libraries.lang, - libraries.protobuf, libraries.conscrypt - def nettyDependency = compile project(':grpc-netty') - compile (libraries.google_auth_oauth2_http) { + def nettyDependency = implementation project(':grpc-netty') + implementation (libraries.google_auth_oauth2_http) { // prefer our own versions instead of google-auth-oauth2-http's dependency exclude group: 'com.google.guava', module: 'guava' // we'll always be more up-to-date exclude group: 'io.grpc', module: 'grpc-context' } - compileOnly libraries.javax_annotation - - shadow configurations.compile.getDependencies().minus(nettyDependency) - shadow project(path: ':grpc-netty-shaded', configuration: 'shadow') - - testCompile project(':grpc-testing'), + guavaDependency 'implementation' + testImplementation project(':grpc-testing'), project(':grpc-testing-proto'), libraries.guava, libraries.guava_testlib, libraries.junit, libraries.mockito, libraries.truth - testRuntime libraries.netty_tcnative, - libraries.netty_epoll + testRuntimeOnly libraries.netty_epoll, + libraries.netty_tcnative + + shadow configurations.implementation.getDependencies().minus(nettyDependency), + project(path: ':grpc-netty-shaded', configuration: 'shadow') + signature 'org.codehaus.mojo.signature:java17:1.0@signature' } From 60ecf5f5820936457caff143efaa70bf0d841f21 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 22:12:47 -0700 Subject: [PATCH 17/21] testing,testing-proto: use java-library gradle plugin --- testing-proto/build.gradle | 6 +++--- testing/build.gradle | 13 +++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/testing-proto/build.gradle b/testing-proto/build.gradle index 8ff8ccc6c0e..145ded4ef11 100644 --- a/testing-proto/build.gradle +++ b/testing-proto/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "com.google.protobuf" @@ -8,10 +8,10 @@ plugins { description = "gRPC: Testing Protos" dependencies { - compile project(':grpc-protobuf'), + api project(':grpc-protobuf'), project(':grpc-stub') compileOnly libraries.javax_annotation - testCompile libraries.truth + testImplementation libraries.truth testRuntime libraries.javax_annotation } diff --git a/testing/build.gradle b/testing/build.gradle index 6c9ababa23c..fae56ef1f66 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java" + id "java-library" id "maven-publish" id "me.champeau.gradle.japicmp" @@ -10,19 +10,16 @@ description = "gRPC: Testing" evaluationDependsOn(project(':grpc-core').path) dependencies { - compile project(':grpc-core'), + api project(':grpc-core'), project(':grpc-stub'), libraries.junit - censusApiDependency 'implementation' - - testCompile (libraries.mockito) { + testImplementation project(':grpc-core').sourceSets.test.output, + project(':grpc-testing-proto') + testImplementation (libraries.mockito) { // prefer our own versions instead of mockito's dependency exclude group: 'org.hamcrest', module: 'hamcrest-core' } - - testCompile project(':grpc-testing-proto'), - project(':grpc-core').sourceSets.test.output } javadoc { exclude 'io/grpc/internal/**' } From 2f36dbbdf89aa09bf869eb644cb1faf7b1dab434 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 22:23:08 -0700 Subject: [PATCH 18/21] android,cronet: use api configuration with android library gradle plugin --- android/build.gradle | 2 +- cronet/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 9d16a2bc90c..b771a749245 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,7 +26,7 @@ repositories { } dependencies { - implementation project(':grpc-core') + api project(':grpc-core') guavaDependency 'implementation' testImplementation project('::grpc-okhttp'), libraries.androidx_test, diff --git a/cronet/build.gradle b/cronet/build.gradle index 11f329f8e8a..c0f960424ff 100644 --- a/cronet/build.gradle +++ b/cronet/build.gradle @@ -33,7 +33,7 @@ android { } dependencies { - implementation project(':grpc-core'), + api project(':grpc-core'), libraries.cronet_api guavaDependency 'implementation' testImplementation project(':grpc-testing'), From ef780f361d545118a38aca83ed5a17efd1435058 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 22:29:09 -0700 Subject: [PATCH 19/21] interop-testing,gae-interop-testing: migrate away deprecated gradle configurations --- gae-interop-testing/gae-jdk8/build.gradle | 18 ++++++++---------- interop-testing/build.gradle | 14 +++++++------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gae-interop-testing/gae-jdk8/build.gradle b/gae-interop-testing/gae-jdk8/build.gradle index 1ef4086dcc5..605060c543e 100644 --- a/gae-interop-testing/gae-jdk8/build.gradle +++ b/gae-interop-testing/gae-jdk8/build.gradle @@ -43,17 +43,15 @@ repositories { apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks dependencies { - providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5' - compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.59' - // Deps needed by all gRPC apps in GAE - compile libraries.google_api_protos - compile project(":grpc-okhttp") - compile project(":grpc-protobuf") - compile project(":grpc-stub") - compile (project(":grpc-interop-testing")) { - exclude group: "io.grpc", module: "grpc-netty-shaded" + implementation project(':grpc-netty'), + project(":grpc-stub"), + libraries.protobuf, + libraries.truth + implementation (project(':grpc-interop-testing')) { + exclude group: 'io.grpc', module: 'grpc-alts' } - compile libraries.netty_tcnative + providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5' + runtimeOnly 'com.google.appengine:appengine-api-1.0-sdk:1.9.59' } compileJava { diff --git a/interop-testing/build.gradle b/interop-testing/build.gradle index c52460469ef..28d743bd1cb 100644 --- a/interop-testing/build.gradle +++ b/interop-testing/build.gradle @@ -17,7 +17,9 @@ configurations { evaluationDependsOn(project(':grpc-context').path) dependencies { - compile project(path: ':grpc-alts', configuration: 'shadow'), + alpnagent libraries.jetty_alpn_agent + compileOnly libraries.javax_annotation + implementation project(path: ':grpc-alts', configuration: 'shadow'), project(':grpc-auth'), project(':grpc-census'), project(':grpc-core'), @@ -30,15 +32,13 @@ dependencies { libraries.google_auth_oauth2_http, libraries.junit, libraries.truth - compileOnly libraries.javax_annotation censusGrpcMetricDependency 'implementation' - runtime libraries.opencensus_impl, + runtimeOnly project(':grpc-grpclb'), libraries.netty_tcnative, - project(':grpc-grpclb') - xdsRuntime project(path: ':grpc-xds', configuration: 'shadow') - testCompile project(':grpc-context').sourceSets.test.output, + libraries.opencensus_impl + testImplementation project(':grpc-context').sourceSets.test.output, libraries.mockito - alpnagent libraries.jetty_alpn_agent + xdsRuntime project(path: ':grpc-xds', configuration: 'shadow') } configureProtoCompilation() From 0762b98415bb3b8341caaaacd279d0432cdd0c6b Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Sun, 5 Apr 2020 23:51:32 -0700 Subject: [PATCH 20/21] build: fix resolutionStrategy --- build.gradle | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 3acf6d9902b..cfc77d4c60d 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,9 @@ subprojects { } } + def isAndroid = project.name in [ + 'grpc-android', 'grpc-android-interop-testing', 'grpc-cronet'] + ext { def exeSuffix = osdetector.os == 'windows' ? ".exe" : "" protocPluginBaseName = 'protoc-gen-grpc-java' @@ -54,7 +57,6 @@ subprojects { opencensusVersion = '0.24.0' configureProtoCompilation = { - boolean isAndroid = project.getName().contains('android') String generatedSourcePath = "${projectDir}/src/generated" project.protobuf { protoc { @@ -241,16 +243,20 @@ subprojects { } } - // Define a separate configuration for managing the dependency on Jetty ALPN agent. configurations { - compile { - // Detect Maven Enforcer's dependencyConvergence failures. We only - // care for artifacts used as libraries by others. - if (!(project.name in [ + // Detect Maven Enforcer's dependencyConvergence failures. We only + // care for artifacts used as libraries by others. + if (isAndroid && !(project.name in ['grpc-android-interop-testing'])) { + releaseRuntimeClasspath { + resolutionStrategy.failOnVersionConflict() + } + } + if (!isAndroid && !(project.name in [ 'grpc-benchmarks', 'grpc-interop-testing', 'grpc-gae-interop-testing-jdk8', - ])) { + ])) { + runtimeClasspath { resolutionStrategy.failOnVersionConflict() } } From 6b4b15132fb8e7e6cd72315c064d34cd28d3cdda Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Wed, 8 Apr 2020 09:37:06 -0700 Subject: [PATCH 21/21] grpc-all: migrate away deprecated gradle configurations --- all/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/all/build.gradle b/all/build.gradle index 9b7a9825666..ffba5f508e2 100644 --- a/all/build.gradle +++ b/all/build.gradle @@ -31,7 +31,7 @@ for (subproject in rootProject.subprojects) { } dependencies { - compile subprojects.minus(project(':grpc-protobuf-lite')) + implementation subprojects.minus(project(':grpc-protobuf-lite')) } javadoc {