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