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