xref: /aosp_15_r20/external/grpc-grpc-java/examples/example-xds/build.gradle (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1plugins {
2    id 'application' // Provide convenience executables for trying out the examples.
3    // ASSUMES GRADLE 5.6 OR HIGHER. Use plugin version 0.8.10 with earlier gradle versions
4    id 'com.google.protobuf' version '0.8.17'
5    // Generate IntelliJ IDEA's .idea & .iml project files
6    id 'idea'
7    id 'java'
8}
9
10repositories {
11    maven { // The google mirror is less flaky than mavenCentral()
12        url "https://maven-central.storage-download.googleapis.com/maven2/" }
13    mavenCentral()
14    mavenLocal()
15}
16
17sourceCompatibility = 1.8
18targetCompatibility = 1.8
19
20// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
21// are looking at a tagged version of the example and not "master"!
22
23// Feel free to delete the comment at the next line. It is just for safely
24// updating the version in our release process.
25def grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION
26def protocVersion = '3.22.3'
27
28dependencies {
29    implementation "io.grpc:grpc-protobuf:${grpcVersion}"
30    implementation "io.grpc:grpc-services:${grpcVersion}"
31    implementation "io.grpc:grpc-stub:${grpcVersion}"
32    implementation "io.grpc:grpc-xds:${grpcVersion}"
33    compileOnly "org.apache.tomcat:annotations-api:6.0.53"
34
35    runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
36}
37
38protobuf {
39    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
40    plugins {
41        grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
42    }
43    generateProtoTasks {
44        all()*.plugins { grpc {} }
45    }
46}
47
48startScripts.enabled = false
49
50task xdsHelloWorldClient(type: CreateStartScripts) {
51    mainClass = 'io.grpc.examples.helloworldxds.XdsHelloWorldClient'
52    applicationName = 'xds-hello-world-client'
53    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
54    classpath = startScripts.classpath
55}
56
57task xdsHelloWorldServer(type: CreateStartScripts) {
58    mainClass = 'io.grpc.examples.helloworldxds.XdsHelloWorldServer'
59    applicationName = 'xds-hello-world-server'
60    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
61    classpath = startScripts.classpath
62}
63
64applicationDistribution.into('bin') {
65    from(xdsHelloWorldClient)
66    from(xdsHelloWorldServer)
67    fileMode = 0755
68}
69