mirror of https://github.com/grpc/grpc-java.git
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.
This commit is contained in:
parent
0d4051ca6e
commit
3792242ae1
|
@ -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 + "]"
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ dependencies {
|
|||
compile "io.grpc:grpc-stub:${grpcVersion}"
|
||||
compileOnly "javax.annotation:javax.annotation-api:1.2"
|
||||
|
||||
// Used for TLS in HelloWorldServerTls
|
||||
// Used in HelloWorldServerTls
|
||||
compile "io.grpc:grpc-netty:${grpcVersion}"
|
||||
compile "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}"
|
||||
|
||||
compile "com.google.protobuf:protobuf-java-util:${protobufVersion}"
|
||||
|
|
|
@ -46,11 +46,19 @@
|
|||
<version>${grpc.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Used in HelloWorldServerTls -->
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-netty</artifactId>
|
||||
<version>${grpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-tcnative-boringssl-static</artifactId>
|
||||
<version>${netty.tcnative.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.api.grpc</groupId>
|
||||
<artifactId>proto-google-common-protos</artifactId>
|
||||
|
|
|
@ -24,6 +24,12 @@ artifacts { // We want uploadArchives to handle the shadowJar; we don't care abo
|
|||
// uploadShadow
|
||||
archives shadowJar }
|
||||
|
||||
jar {
|
||||
// Must use a different classifier to avoid conflicting with shadowJar
|
||||
classifier = 'original'
|
||||
}
|
||||
configurations.archives.artifacts.removeAll { it.classifier == "original" }
|
||||
|
||||
shadowJar {
|
||||
classifier = null
|
||||
dependencies {
|
||||
|
|
Loading…
Reference in New Issue