aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZHANG Dapeng <zdapeng@google.com>2020-02-28 10:04:46 -0800
committerGitHub <noreply@github.com>2020-02-28 10:04:46 -0800
commitc5f48b8e384ca1ad91b67886f8cbff27c9bcfd8d (patch)
tree19205cbbfb376ca915dd10859d146bedafca5b0c
parent3cd59c0b02761901e26b425a89bfe530f9709696 (diff)
downloadgrpc-grpc-java-c5f48b8e384ca1ad91b67886f8cbff27c9bcfd8d.tar.gz
all: let interop test use shaded dependency correctly (#6780)
-rw-r--r--alts/build.gradle1
-rw-r--r--gae-interop-testing/gae-jdk8/build.gradle4
-rw-r--r--interop-testing/build.gradle18
-rw-r--r--interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java6
-rw-r--r--xds/build.gradle12
5 files changed, 22 insertions, 19 deletions
diff --git a/alts/build.gradle b/alts/build.gradle
index b53427702..4fe2a9f5a 100644
--- a/alts/build.gradle
+++ b/alts/build.gradle
@@ -38,6 +38,7 @@ dependencies {
libraries.truth
testRuntime libraries.netty_tcnative,
libraries.netty_epoll
+ shadow project(path: ':grpc-netty-shaded', configuration: 'shadow')
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
}
diff --git a/gae-interop-testing/gae-jdk8/build.gradle b/gae-interop-testing/gae-jdk8/build.gradle
index fd3e9ffab..1ef4086dc 100644
--- a/gae-interop-testing/gae-jdk8/build.gradle
+++ b/gae-interop-testing/gae-jdk8/build.gradle
@@ -50,7 +50,9 @@ dependencies {
compile project(":grpc-okhttp")
compile project(":grpc-protobuf")
compile project(":grpc-stub")
- compile project(":grpc-interop-testing")
+ compile (project(":grpc-interop-testing")) {
+ exclude group: "io.grpc", module: "grpc-netty-shaded"
+ }
compile libraries.netty_tcnative
}
diff --git a/interop-testing/build.gradle b/interop-testing/build.gradle
index e528d6104..2e89b01fe 100644
--- a/interop-testing/build.gradle
+++ b/interop-testing/build.gradle
@@ -16,7 +16,7 @@ configurations {
evaluationDependsOn(project(':grpc-context').path)
dependencies {
- compile project(':grpc-alts'),
+ compile project(path: ':grpc-alts', configuration: 'shadow'),
project(':grpc-auth'),
project(':grpc-census'),
project(':grpc-core'),
@@ -113,21 +113,13 @@ task grpclb_long_lived_affinity_test_client(type: CreateStartScripts) {
}
task xds_test_client(type: CreateStartScripts) {
- // Use task dependsOn instead of depending on project(':grpc-xds') in configurations because
- // grpc-xds is not published yet and we don't want grpc-interop-testin to depend on it in maven.
- dependsOn ':grpc-xds:shadowJar'
- // Add all other dependencies that grpc-xds needs.
- dependencies { compile project(':grpc-services'), libraries.netty_epoll }
mainClassName = "io.grpc.testing.integration.XdsTestClient"
applicationName = "xds-test-client"
- outputDir = new File(project.buildDir, 'tmp')
- classpath = startScripts.classpath + fileTree("${project(':grpc-xds').buildDir}/libs")
- doLast {
- unixScript.text = unixScript.text.replace(
- '\$APP_HOME/lib/grpc-xds', "${project(':grpc-xds').buildDir}/libs/grpc-xds")
- windowsScript.text = windowsScript.text.replace(
- '%APP_HOME%\\lib\\grpc-xds', "${project(':grpc-xds').buildDir}\\libs\\grpc-xds")
+ dependencies {
+ runtime project(path: ':grpc-xds', configuration: 'shadow')
}
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = startScripts.classpath
}
task xds_test_server(type: CreateStartScripts) {
diff --git a/interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java b/interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java
index b83bb6135..6d082d404 100644
--- a/interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java
+++ b/interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java
@@ -59,7 +59,11 @@ public class ChannelAndServerBuilderTest {
}
List<Object[]> classes = new ArrayList<>();
for (ClassInfo classInfo : classInfos) {
- Class<?> clazz = Class.forName(classInfo.getName(), false /*initialize*/, loader);
+ String className = classInfo.getName();
+ if (className.contains("io.grpc.netty.shaded.io.netty")) {
+ continue;
+ }
+ Class<?> clazz = Class.forName(className, false /*initialize*/, loader);
if (ServerBuilder.class.isAssignableFrom(clazz) && clazz != ServerBuilder.class) {
classes.add(new Object[]{clazz});
} else if (ManagedChannelBuilder.class.isAssignableFrom(clazz)
diff --git a/xds/build.gradle b/xds/build.gradle
index 994d77b20..0cc068c42 100644
--- a/xds/build.gradle
+++ b/xds/build.gradle
@@ -24,8 +24,7 @@ dependencies {
project(':grpc-core'),
project(':grpc-netty'),
project(':grpc-services'),
- project(':grpc-alts'),
- libraries.netty_epoll
+ project(path: ':grpc-alts', configuration: 'shadow')
compile (libraries.pgv) {
// PGV depends on com.google.protobuf:protobuf-java 3.6.1 conflicting with :grpc-protobuf
@@ -39,11 +38,16 @@ dependencies {
testCompile project(':grpc-core').sourceSets.test.output
- compileOnly libraries.javax_annotation
+ compileOnly libraries.javax_annotation,
+ // At runtime use the epoll included in grpc-netty-shaded
+ libraries.netty_epoll
testCompile project(':grpc-testing'),
project(':grpc-testing-proto'),
- libraries.guava_testlib
+ libraries.guava_testlib,
+ libraries.netty_epoll
+
+ shadow project(path: ':grpc-netty-shaded', configuration: 'shadow')
signature "org.codehaus.mojo.signature:java17:1.0@signature"
testRuntime libraries.netty_tcnative
}