aboutsummaryrefslogtreecommitdiff
path: root/alts
diff options
context:
space:
mode:
authorEric Anderson <ejona@google.com>2018-08-15 17:39:20 -0700
committerGitHub <noreply@github.com>2018-08-15 17:39:20 -0700
commit3792242ae11ad9a4992ea551629fe108be128d87 (patch)
treef7f5cc9e6976349c141db124217f32b094087b1e /alts
parent0d4051ca6ee0c0240d79f88082831c22c26c4844 (diff)
downloadgrpc-grpc-java-3792242ae11ad9a4992ea551629fe108be128d87.tar.gz
alts: Use grpc-netty-shaded instead of grpc-netty
There's no good way to provide users of ALTS a choice between grpc-netty and grpc-netty-shaded. Since Netty is not exposed through the ALTS API surface, we opt for the shaded version as it has fewer deployment issues. However, this also means that we _can't_ expose any Netty API, like EventLoopGroup.
Diffstat (limited to 'alts')
-rw-r--r--alts/build.gradle40
1 files changed, 40 insertions, 0 deletions
diff --git a/alts/build.gradle b/alts/build.gradle
index c950edffe..55ba1c4cf 100644
--- a/alts/build.gradle
+++ b/alts/build.gradle
@@ -1,3 +1,10 @@
+buildscript {
+ repositories { jcenter() }
+ dependencies { classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' }
+}
+
+apply plugin: 'com.github.johnrengelman.shadow'
+
description = "gRPC: ALTS"
sourceCompatibility = 1.7
@@ -39,3 +46,36 @@ configureProtoCompilation()
}
javadoc { exclude 'io/grpc/alts/internal/**' }
+
+artifacts {
+ archives shadowJar
+}
+
+jar {
+ // Must use a different classifier to avoid conflicting with shadowJar
+ classifier = 'original'
+}
+configurations.archives.artifacts.removeAll { it.classifier == "original" }
+
+// We want to use grpc-netty-shaded instead of grpc-netty. But we also want our
+// source to work with Bazel, so we rewrite the code as part of the build.
+shadowJar {
+ classifier = null
+ dependencies {
+ exclude(dependency {true})
+ }
+ relocate 'io.grpc.netty', 'io.grpc.netty.shaded.io.grpc.netty'
+ relocate 'io.netty', 'io.grpc.netty.shaded.io.netty'
+}
+
+[
+ install.repositories.mavenInstaller,
+ uploadArchives.repositories.mavenDeployer,
+]*.pom*.whenConfigured { pom ->
+ def netty = pom.dependencies.find {dep -> dep.artifactId == 'grpc-netty'}
+ // Swap our dependency to grpc-netty-shaded. Projects depending on this via
+ // project(':grpc-alts') will still be using the non-shaded form.
+ netty.artifactId = "grpc-netty-shaded"
+ // Depend on specific version of grpc-netty-shaded because it is unstable API
+ netty.version = "[" + netty.version + "]"
+}