Skip to content

Commit

Permalink
all: let interop test use shaded dependency correctly (#6780)
Browse files Browse the repository at this point in the history
  • Loading branch information
dapengzhang0 authored Feb 28, 2020
1 parent 3cd59c0 commit c5f48b8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions alts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down
4 changes: 3 additions & 1 deletion gae-interop-testing/gae-jdk8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
18 changes: 5 additions & 13 deletions interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public static Collection<Object[]> params() throws Exception {
}
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)
Expand Down
12 changes: 8 additions & 4 deletions xds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit c5f48b8

Please sign in to comment.