Home | History | Annotate | Download | only in alts
      1 buildscript {
      2     repositories { jcenter() }
      3     dependencies { classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' }
      4 }
      5 
      6 apply plugin: 'com.github.johnrengelman.shadow'
      7 
      8 description = "gRPC: ALTS"
      9 
     10 sourceCompatibility = 1.7
     11 targetCompatibility = 1.7
     12 
     13 buildscript {
     14     repositories {
     15         maven { // The google mirror is less flaky than mavenCentral()
     16             url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
     17     }
     18     dependencies { classpath libraries.protobuf_plugin }
     19 }
     20 
     21 dependencies {
     22     compile project(':grpc-auth'),
     23             project(':grpc-core'),
     24             project(':grpc-netty'),
     25             project(':grpc-protobuf'),
     26             project(':grpc-stub'),
     27             libraries.lang,
     28             libraries.protobuf
     29     compile (libraries.google_auth_oauth2_http) {
     30         // prefer 3.0.0 from libraries instead of 1.3.9
     31         exclude group: 'com.google.code.findbugs', module: 'jsr305'
     32         // prefer 20.0 from libraries instead of 19.0
     33         exclude group: 'com.google.guava', module: 'guava'
     34     }
     35     runtime project(':grpc-grpclb')
     36     testCompile libraries.guava,
     37             libraries.guava_testlib,
     38             libraries.junit,
     39             libraries.mockito,
     40             libraries.truth
     41     testRuntime libraries.netty_tcnative,
     42             libraries.conscrypt
     43     signature 'org.codehaus.mojo.signature:java17:1.0@signature'
     44 }
     45 
     46 configureProtoCompilation()
     47 
     48 [compileJava, compileTestJava].each() {
     49     // ALTS retuns a lot of futures that we mostly don't care about.
     50     // protobuf calls valueof. Will be fixed in next release (google/protobuf#4046)
     51     it.options.compilerArgs += [
     52         "-Xlint:-deprecation",
     53         "-Xep:FutureReturnValueIgnored:OFF"
     54     ]
     55 }
     56 
     57 javadoc { exclude 'io/grpc/alts/internal/**' }
     58 
     59 artifacts {
     60     archives shadowJar
     61 }
     62 
     63 jar {
     64     // Must use a different classifier to avoid conflicting with shadowJar
     65     classifier = 'original'
     66 }
     67 configurations.archives.artifacts.removeAll { it.classifier == "original" }
     68 
     69 // We want to use grpc-netty-shaded instead of grpc-netty. But we also want our
     70 // source to work with Bazel, so we rewrite the code as part of the build.
     71 shadowJar {
     72     classifier = null
     73     dependencies {
     74         exclude(dependency {true})
     75     }
     76     relocate 'io.grpc.netty', 'io.grpc.netty.shaded.io.grpc.netty'
     77     relocate 'io.netty', 'io.grpc.netty.shaded.io.netty'
     78 }
     79 
     80 [
     81     install.repositories.mavenInstaller,
     82     uploadArchives.repositories.mavenDeployer,
     83 ]*.pom*.whenConfigured { pom ->
     84     def netty = pom.dependencies.find {dep -> dep.artifactId == 'grpc-netty'}
     85     // Swap our dependency to grpc-netty-shaded. Projects depending on this via
     86     // project(':grpc-alts') will still be using the non-shaded form.
     87     netty.artifactId = "grpc-netty-shaded"
     88     // Depend on specific version of grpc-netty-shaded because it is unstable API
     89     netty.version = "[" + netty.version + "]"
     90 }
     91