blob: b53427702889df38cf15d329f75a036b506f1b91 [file] [log] [blame]
plugins {
id "java"
id "maven-publish"
id "com.github.johnrengelman.shadow"
id "com.google.protobuf"
id "ru.vyarus.animalsniffer"
}
description = "gRPC: ALTS"
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
compile project(':grpc-auth'),
project(':grpc-core'),
project(':grpc-netty'),
project(':grpc-protobuf'),
project(':grpc-stub'),
libraries.lang,
libraries.protobuf,
libraries.conscrypt
compile (libraries.google_auth_oauth2_http) {
// prefer our own versions instead of google-auth-oauth2-http's dependency
exclude group: 'com.google.guava', module: 'guava'
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
}
compileOnly libraries.javax_annotation
runtime project(':grpc-grpclb')
testCompile project(':grpc-testing'),
project(':grpc-testing-proto'),
libraries.guava,
libraries.guava_testlib,
libraries.junit,
libraries.mockito,
libraries.truth
testRuntime libraries.netty_tcnative,
libraries.netty_epoll
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
}
configureProtoCompilation()
import net.ltgt.gradle.errorprone.CheckSeverity
[compileJava, compileTestJava].each() {
// protobuf calls valueof. Will be fixed in next release (google/protobuf#4046)
it.options.compilerArgs += [
"-Xlint:-deprecation"
]
// ALTS returns a lot of futures that we mostly don't care about.
it.options.errorprone.check("FutureReturnValueIgnored", CheckSeverity.OFF)
}
javadoc { exclude 'io/grpc/alts/internal/**' }
jar {
// Must use a different classifier to avoid conflicting with shadowJar
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'
}
publishing {
publications {
maven(MavenPublication) {
// use shadowJar and remove the original Jar
artifact shadowJar
def originalJar = artifacts.find { dep -> dep.classifier == 'original'}
artifacts.remove(originalJar)
pom.withXml {
// Swap our dependency to grpc-netty-shaded. Projects depending on this via
// project(':grpc-alts') will still be using the non-shaded form.
asNode().dependencies.'*'.findAll() { dep ->
dep.artifactId.text() == 'grpc-netty'
}.each() { netty ->
netty.artifactId*.value = 'grpc-netty-shaded'
netty.version*.value = "[" + netty.version.text() + "]"
}
}
}
}
}