From 1df7d7ea8ed1f87c7ddd232234dfd19cdc72c4e6 Mon Sep 17 00:00:00 2001 From: ZHANG Dapeng Date: Mon, 2 Mar 2020 10:22:50 -0800 Subject: [PATCH] Revert "all: let interop test use shaded dependency correctly (#6780)" This reverts commit c5f48b8e384ca1ad91b67886f8cbff27c9bcfd8d. (#6780) Revert because caused a regression in the ALTS tests. https://source.cloud.google.com/results/invocations/691d9965-fea1-487d-b606-352a5234039e/targets/grpc%2Fcore%2Fpull_request%2Flinux%2Fgrpc_interop_toprod/log 2020-03-01 20:02:12,491 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/SystemUtils at io.grpc.alts.CheckGcpEnvironment.isRunningOnGcp(CheckGcpEnvironment.java:69) at io.grpc.alts.CheckGcpEnvironment.isOnGcp(CheckGcpEnvironment.java:44) at io.grpc.alts.ComputeEngineChannelBuilder.(ComputeEngineChannelBuilder.java:62) at io.grpc.alts.ComputeEngineChannelBuilder.forTarget(ComputeEngineChannelBuilder.java:72) at io.grpc.alts.ComputeEngineChannelBuilder.forAddress(ComputeEngineChannelBuilder.java:77) at io.grpc.testing.integration.TestServiceClient$Tester.createChannel(TestServiceClient.java:399) at io.grpc.testing.integration.AbstractInteropTest.setUp(AbstractInteropTest.java:309) at io.grpc.testing.integration.TestServiceClient.setUp(TestServiceClient.java:198) at io.grpc.testing.integration.TestServiceClient.main(TestServiceClient.java:56) Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.SystemUtils at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 9 more --- alts/build.gradle | 1 - gae-interop-testing/gae-jdk8/build.gradle | 4 +--- interop-testing/build.gradle | 18 +++++++++++++----- .../io/grpc/ChannelAndServerBuilderTest.java | 6 +----- xds/build.gradle | 12 ++++-------- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/alts/build.gradle b/alts/build.gradle index 4fe2a9f5a9..b534277028 100644 --- a/alts/build.gradle +++ b/alts/build.gradle @@ -38,7 +38,6 @@ 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 1ef4086dcc..fd3e9ffabf 100644 --- a/gae-interop-testing/gae-jdk8/build.gradle +++ b/gae-interop-testing/gae-jdk8/build.gradle @@ -50,9 +50,7 @@ dependencies { 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" - } + compile project(":grpc-interop-testing") compile libraries.netty_tcnative } diff --git a/interop-testing/build.gradle b/interop-testing/build.gradle index 2e89b01fec..e528d6104c 100644 --- a/interop-testing/build.gradle +++ b/interop-testing/build.gradle @@ -16,7 +16,7 @@ configurations { evaluationDependsOn(project(':grpc-context').path) dependencies { - compile project(path: ':grpc-alts', configuration: 'shadow'), + compile project(':grpc-alts'), project(':grpc-auth'), project(':grpc-census'), project(':grpc-core'), @@ -113,13 +113,21 @@ 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" - dependencies { - runtime project(path: ':grpc-xds', configuration: 'shadow') - } outputDir = new File(project.buildDir, 'tmp') - classpath = startScripts.classpath + 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") + } } 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 6d082d4042..b83bb61357 100644 --- a/interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java +++ b/interop-testing/src/test/java/io/grpc/ChannelAndServerBuilderTest.java @@ -59,11 +59,7 @@ public class ChannelAndServerBuilderTest { } List classes = new ArrayList<>(); for (ClassInfo classInfo : classInfos) { - String className = classInfo.getName(); - if (className.contains("io.grpc.netty.shaded.io.netty")) { - continue; - } - Class clazz = Class.forName(className, false /*initialize*/, loader); + Class clazz = Class.forName(classInfo.getName(), 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 0cc068c42a..994d77b202 100644 --- a/xds/build.gradle +++ b/xds/build.gradle @@ -24,7 +24,8 @@ dependencies { project(':grpc-core'), project(':grpc-netty'), project(':grpc-services'), - project(path: ':grpc-alts', configuration: 'shadow') + project(':grpc-alts'), + libraries.netty_epoll compile (libraries.pgv) { // PGV depends on com.google.protobuf:protobuf-java 3.6.1 conflicting with :grpc-protobuf @@ -38,16 +39,11 @@ dependencies { testCompile project(':grpc-core').sourceSets.test.output - compileOnly libraries.javax_annotation, - // At runtime use the epoll included in grpc-netty-shaded - libraries.netty_epoll + compileOnly libraries.javax_annotation testCompile project(':grpc-testing'), project(':grpc-testing-proto'), - libraries.guava_testlib, - libraries.netty_epoll - - shadow project(path: ':grpc-netty-shaded', configuration: 'shadow') + libraries.guava_testlib signature "org.codehaus.mojo.signature:java17:1.0@signature" testRuntime libraries.netty_tcnative }