Skip to content

Commit c5f48b8

Browse files
authored
all: let interop test use shaded dependency correctly (#6780)
1 parent 3cd59c0 commit c5f48b8

5 files changed

Lines changed: 22 additions & 19 deletions

File tree

alts/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dependencies {
3838
libraries.truth
3939
testRuntime libraries.netty_tcnative,
4040
libraries.netty_epoll
41+
shadow project(path: ':grpc-netty-shaded', configuration: 'shadow')
4142
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
4243
}
4344

gae-interop-testing/gae-jdk8/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ dependencies {
5050
compile project(":grpc-okhttp")
5151
compile project(":grpc-protobuf")
5252
compile project(":grpc-stub")
53-
compile project(":grpc-interop-testing")
53+
compile (project(":grpc-interop-testing")) {
54+
exclude group: "io.grpc", module: "grpc-netty-shaded"
55+
}
5456
compile libraries.netty_tcnative
5557
}
5658

interop-testing/build.gradle

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ configurations {
1616
evaluationDependsOn(project(':grpc-context').path)
1717

1818
dependencies {
19-
compile project(':grpc-alts'),
19+
compile project(path: ':grpc-alts', configuration: 'shadow'),
2020
project(':grpc-auth'),
2121
project(':grpc-census'),
2222
project(':grpc-core'),
@@ -113,21 +113,13 @@ task grpclb_long_lived_affinity_test_client(type: CreateStartScripts) {
113113
}
114114

115115
task xds_test_client(type: CreateStartScripts) {
116-
// Use task dependsOn instead of depending on project(':grpc-xds') in configurations because
117-
// grpc-xds is not published yet and we don't want grpc-interop-testin to depend on it in maven.
118-
dependsOn ':grpc-xds:shadowJar'
119-
// Add all other dependencies that grpc-xds needs.
120-
dependencies { compile project(':grpc-services'), libraries.netty_epoll }
121116
mainClassName = "io.grpc.testing.integration.XdsTestClient"
122117
applicationName = "xds-test-client"
123-
outputDir = new File(project.buildDir, 'tmp')
124-
classpath = startScripts.classpath + fileTree("${project(':grpc-xds').buildDir}/libs")
125-
doLast {
126-
unixScript.text = unixScript.text.replace(
127-
'\$APP_HOME/lib/grpc-xds', "${project(':grpc-xds').buildDir}/libs/grpc-xds")
128-
windowsScript.text = windowsScript.text.replace(
129-
'%APP_HOME%\\lib\\grpc-xds', "${project(':grpc-xds').buildDir}\\libs\\grpc-xds")
118+
dependencies {
119+
runtime project(path: ':grpc-xds', configuration: 'shadow')
130120
}
121+
outputDir = new File(project.buildDir, 'tmp')
122+
classpath = startScripts.classpath
131123
}
132124

133125
task xds_test_server(type: CreateStartScripts) {

interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ public static Collection<Object[]> params() throws Exception {
5959
}
6060
List<Object[]> classes = new ArrayList<>();
6161
for (ClassInfo classInfo : classInfos) {
62-
Class<?> clazz = Class.forName(classInfo.getName(), false /*initialize*/, loader);
62+
String className = classInfo.getName();
63+
if (className.contains("io.grpc.netty.shaded.io.netty")) {
64+
continue;
65+
}
66+
Class<?> clazz = Class.forName(className, false /*initialize*/, loader);
6367
if (ServerBuilder.class.isAssignableFrom(clazz) && clazz != ServerBuilder.class) {
6468
classes.add(new Object[]{clazz});
6569
} else if (ManagedChannelBuilder.class.isAssignableFrom(clazz)

xds/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ dependencies {
2424
project(':grpc-core'),
2525
project(':grpc-netty'),
2626
project(':grpc-services'),
27-
project(':grpc-alts'),
28-
libraries.netty_epoll
27+
project(path: ':grpc-alts', configuration: 'shadow')
2928

3029
compile (libraries.pgv) {
3130
// PGV depends on com.google.protobuf:protobuf-java 3.6.1 conflicting with :grpc-protobuf
@@ -39,11 +38,16 @@ dependencies {
3938

4039
testCompile project(':grpc-core').sourceSets.test.output
4140

42-
compileOnly libraries.javax_annotation
41+
compileOnly libraries.javax_annotation,
42+
// At runtime use the epoll included in grpc-netty-shaded
43+
libraries.netty_epoll
4344

4445
testCompile project(':grpc-testing'),
4546
project(':grpc-testing-proto'),
46-
libraries.guava_testlib
47+
libraries.guava_testlib,
48+
libraries.netty_epoll
49+
50+
shadow project(path: ':grpc-netty-shaded', configuration: 'shadow')
4751
signature "org.codehaus.mojo.signature:java17:1.0@signature"
4852
testRuntime libraries.netty_tcnative
4953
}

0 commit comments

Comments
 (0)