xref: /aosp_15_r20/external/grpc-grpc-java/examples/example-tls/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    implementation "io.grpc:grpc-protobuf:${grpcVersion}"
31    implementation "io.grpc:grpc-stub:${grpcVersion}"
32    compileOnly "org.apache.tomcat:annotations-api:6.0.53"
33    runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
34}
35
36protobuf {
37    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
38    plugins {
39        grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
40    }
41    generateProtoTasks {
42        all()*.plugins { grpc {} }
43    }
44}
45
46// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code.
47sourceSets {
48    main {
49        java {
50            srcDirs 'build/generated/source/proto/main/grpc'
51            srcDirs 'build/generated/source/proto/main/java'
52        }
53    }
54}
55
56startScripts.enabled = false
57
58task helloWorldTlsServer(type: CreateStartScripts) {
59    mainClass = 'io.grpc.examples.helloworldtls.HelloWorldServerTls'
60    applicationName = 'hello-world-tls-server'
61    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
62    classpath = startScripts.classpath
63}
64
65task helloWorldTlsClient(type: CreateStartScripts) {
66    mainClass = 'io.grpc.examples.helloworldtls.HelloWorldClientTls'
67    applicationName = 'hello-world-tls-client'
68    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
69    classpath = startScripts.classpath
70}
71
72applicationDistribution.into('bin') {
73    from(helloWorldTlsServer)
74    from(helloWorldTlsClient)
75    fileMode = 0755
76}
77