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 targetCompatibility = 1.7 buildscript { repositories { maven { // The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" } } dependencies { classpath libraries.protobuf_plugin } } dependencies { compile project(':grpc-auth'), project(':grpc-core'), project(':grpc-netty'), project(':grpc-protobuf'), project(':grpc-stub'), libraries.lang, libraries.protobuf compile (libraries.google_auth_oauth2_http) { // prefer 3.0.2 from libraries instead of 1.3.9 exclude group: 'com.google.code.findbugs', module: 'jsr305' // prefer 20.0 from libraries instead of 19.0 exclude group: 'com.google.guava', module: 'guava' } runtime project(':grpc-grpclb') testCompile libraries.guava, libraries.guava_testlib, libraries.junit, libraries.mockito, libraries.truth testRuntime libraries.netty_tcnative, libraries.conscrypt signature 'org.codehaus.mojo.signature:java17:1.0@signature' } configureProtoCompilation() [compileJava, compileTestJava].each() { // ALTS retuns a lot of futures that we mostly don't care about. // protobuf calls valueof. Will be fixed in next release (google/protobuf#4046) it.options.compilerArgs += [ "-Xlint:-deprecation", "-Xep:FutureReturnValueIgnored:OFF" ] } 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 + "]" }