xref: /aosp_15_r20/external/grpc-grpc-java/examples/example-hostname/build.gradle (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1*e07d83d3SAndroid Build Coastguard Workerplugins {
2*e07d83d3SAndroid Build Coastguard Worker    id 'application' // Provide convenience executables for trying out the examples.
3*e07d83d3SAndroid Build Coastguard Worker    id 'java'
4*e07d83d3SAndroid Build Coastguard Worker
5*e07d83d3SAndroid Build Coastguard Worker    id "com.google.protobuf" version "0.8.17"
6*e07d83d3SAndroid Build Coastguard Worker    id 'com.google.cloud.tools.jib' version '3.1.4' // For releasing to Docker Hub
7*e07d83d3SAndroid Build Coastguard Worker}
8*e07d83d3SAndroid Build Coastguard Worker
9*e07d83d3SAndroid Build Coastguard Workerrepositories {
10*e07d83d3SAndroid Build Coastguard Worker    maven { // The google mirror is less flaky than mavenCentral()
11*e07d83d3SAndroid Build Coastguard Worker        url "https://maven-central.storage-download.googleapis.com/maven2/" }
12*e07d83d3SAndroid Build Coastguard Worker    mavenCentral()
13*e07d83d3SAndroid Build Coastguard Worker    mavenLocal()
14*e07d83d3SAndroid Build Coastguard Worker}
15*e07d83d3SAndroid Build Coastguard Worker
16*e07d83d3SAndroid Build Coastguard WorkersourceCompatibility = 1.8
17*e07d83d3SAndroid Build Coastguard WorkertargetCompatibility = 1.8
18*e07d83d3SAndroid Build Coastguard Worker
19*e07d83d3SAndroid Build Coastguard Worker// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
20*e07d83d3SAndroid Build Coastguard Worker// are looking at a tagged version of the example and not "master"!
21*e07d83d3SAndroid Build Coastguard Worker
22*e07d83d3SAndroid Build Coastguard Worker// Feel free to delete the comment at the next line. It is just for safely
23*e07d83d3SAndroid Build Coastguard Worker// updating the version in our release process.
24*e07d83d3SAndroid Build Coastguard Workerdef grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION
25*e07d83d3SAndroid Build Coastguard Workerdef protobufVersion = '3.22.3'
26*e07d83d3SAndroid Build Coastguard Worker
27*e07d83d3SAndroid Build Coastguard Workerdependencies {
28*e07d83d3SAndroid Build Coastguard Worker    implementation "io.grpc:grpc-protobuf:${grpcVersion}"
29*e07d83d3SAndroid Build Coastguard Worker    implementation "io.grpc:grpc-stub:${grpcVersion}"
30*e07d83d3SAndroid Build Coastguard Worker    implementation "io.grpc:grpc-services:${grpcVersion}"
31*e07d83d3SAndroid Build Coastguard Worker    compileOnly "org.apache.tomcat:annotations-api:6.0.53"
32*e07d83d3SAndroid Build Coastguard Worker    runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
33*e07d83d3SAndroid Build Coastguard Worker
34*e07d83d3SAndroid Build Coastguard Worker    testImplementation 'junit:junit:4.13.2'
35*e07d83d3SAndroid Build Coastguard Worker    testImplementation "io.grpc:grpc-testing:${grpcVersion}"
36*e07d83d3SAndroid Build Coastguard Worker}
37*e07d83d3SAndroid Build Coastguard Worker
38*e07d83d3SAndroid Build Coastguard Workerprotobuf {
39*e07d83d3SAndroid Build Coastguard Worker  protoc {
40*e07d83d3SAndroid Build Coastguard Worker    artifact = "com.google.protobuf:protoc:${protobufVersion}"
41*e07d83d3SAndroid Build Coastguard Worker  }
42*e07d83d3SAndroid Build Coastguard Worker  plugins {
43*e07d83d3SAndroid Build Coastguard Worker    grpc {
44*e07d83d3SAndroid Build Coastguard Worker      artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
45*e07d83d3SAndroid Build Coastguard Worker    }
46*e07d83d3SAndroid Build Coastguard Worker  }
47*e07d83d3SAndroid Build Coastguard Worker  generateProtoTasks {
48*e07d83d3SAndroid Build Coastguard Worker    all()*.plugins {
49*e07d83d3SAndroid Build Coastguard Worker      grpc {}
50*e07d83d3SAndroid Build Coastguard Worker    }
51*e07d83d3SAndroid Build Coastguard Worker  }
52*e07d83d3SAndroid Build Coastguard Worker}
53*e07d83d3SAndroid Build Coastguard Worker
54*e07d83d3SAndroid Build Coastguard WorkerapplicationName = 'hostname-server'
55*e07d83d3SAndroid Build Coastguard WorkermainClassName = 'io.grpc.examples.hostname.HostnameServer'
56*e07d83d3SAndroid Build Coastguard Worker
57*e07d83d3SAndroid Build Coastguard Worker// For releasing to Docker Hub
58*e07d83d3SAndroid Build Coastguard Workerjib {
59*e07d83d3SAndroid Build Coastguard Worker  from.image = "gcr.io/distroless/java:8"
60*e07d83d3SAndroid Build Coastguard Worker  container.ports = ['50051']
61*e07d83d3SAndroid Build Coastguard Worker  outputPaths {
62*e07d83d3SAndroid Build Coastguard Worker    tar = 'build/example-hostname.tar'
63*e07d83d3SAndroid Build Coastguard Worker    digest = 'build/example-hostname.digest'
64*e07d83d3SAndroid Build Coastguard Worker    imageId = 'build/example-hostname.id'
65*e07d83d3SAndroid Build Coastguard Worker  }
66*e07d83d3SAndroid Build Coastguard Worker}
67