xref: /aosp_15_r20/external/grpc-grpc-java/examples/example-orca/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
20def grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION
21def protocVersion = '3.22.3'
22
23dependencies {
24    implementation "io.grpc:grpc-protobuf:${grpcVersion}"
25    implementation "io.grpc:grpc-services:${grpcVersion}"
26    implementation "io.grpc:grpc-stub:${grpcVersion}"
27    implementation "io.grpc:grpc-xds:${grpcVersion}"
28    compileOnly "org.apache.tomcat:annotations-api:6.0.53"
29
30}
31
32protobuf {
33    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
34    plugins {
35        grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
36    }
37    generateProtoTasks {
38        all()*.plugins { grpc {} }
39    }
40}
41
42startScripts.enabled = false
43
44task CustomBackendMetricsClient(type: CreateStartScripts) {
45    mainClass = 'io.grpc.examples.orca.CustomBackendMetricsClient'
46    applicationName = 'custom-backend-metrics-client'
47    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
48    classpath = startScripts.classpath
49}
50
51task CustomBackendMetricsServer(type: CreateStartScripts) {
52    mainClass = 'io.grpc.examples.orca.CustomBackendMetricsServer'
53    applicationName = 'custom-backend-metrics-server'
54    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
55    classpath = startScripts.classpath
56}
57
58applicationDistribution.into('bin') {
59    from(CustomBackendMetricsClient)
60    from(CustomBackendMetricsServer)
61    fileMode = 0755
62}
63