blob: 5ee162bbd83fc370043b9eb8fffa35bc9a82af3d [file] [log] [blame]
Eric Anderson2e12b532020-01-31 11:13:44 -08001plugins {
2 id 'application' // Provide convenience executables for trying out the examples.
sanjaypujareb6601ba2020-10-23 08:38:27 -07003 // ASSUMES GRADLE 5.6 OR HIGHER. Use plugin version 0.8.10 with earlier gradle versions
Chengyuan Zhangf2ed41a2021-07-21 19:30:38 -07004 id 'com.google.protobuf' version '0.8.17'
sanjaypujareb6601ba2020-10-23 08:38:27 -07005 // Generate IntelliJ IDEA's .idea & .iml project files
6 id 'idea'
Eric Anderson2e12b532020-01-31 11:13:44 -08007 id 'java'
8}
9
10repositories {
11 maven { // The google mirror is less flaky than mavenCentral()
Eric Andersondc30d852020-07-09 09:38:24 -070012 url "https://maven-central.storage-download.googleapis.com/maven2/" }
Eric Anderson2e12b532020-01-31 11:13:44 -080013 mavenCentral()
14 mavenLocal()
15}
16
Eric Anderson7cf048e2022-01-18 07:17:51 -080017sourceCompatibility = 1.8
18targetCompatibility = 1.8
Eric Anderson2e12b532020-01-31 11:13:44 -080019
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.
Sergii Tkachenko558b5b02023-06-13 15:39:30 -070025def grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION
Eric Anderson1551cc72023-04-13 08:52:20 -070026def protocVersion = '3.22.3'
Eric Anderson2e12b532020-01-31 11:13:44 -080027
28dependencies {
sanjaypujareb6601ba2020-10-23 08:38:27 -070029 implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Eric Anderson7480dad2020-11-24 12:09:02 -080030 implementation "io.grpc:grpc-services:${grpcVersion}"
sanjaypujareb6601ba2020-10-23 08:38:27 -070031 implementation "io.grpc:grpc-stub:${grpcVersion}"
32 implementation "io.grpc:grpc-xds:${grpcVersion}"
33 compileOnly "org.apache.tomcat:annotations-api:6.0.53"
Eric Anderson7480dad2020-11-24 12:09:02 -080034
35 runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
sanjaypujareb6601ba2020-10-23 08:38:27 -070036}
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 }
Eric Anderson2e12b532020-01-31 11:13:44 -080046}
47
48startScripts.enabled = false
49
Eric Anderson0be12b42020-11-24 12:12:22 -080050task xdsHelloWorldClient(type: CreateStartScripts) {
Eric Andersond44de502022-01-07 09:54:50 -080051 mainClass = 'io.grpc.examples.helloworldxds.XdsHelloWorldClient'
sanjaypujaref0915e72020-11-24 09:08:27 -080052 applicationName = 'xds-hello-world-client'
Eric Andersond44de502022-01-07 09:54:50 -080053 outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
sanjaypujareb6601ba2020-10-23 08:38:27 -070054 classpath = startScripts.classpath
55}
56
Eric Anderson0be12b42020-11-24 12:12:22 -080057task xdsHelloWorldServer(type: CreateStartScripts) {
Eric Andersond44de502022-01-07 09:54:50 -080058 mainClass = 'io.grpc.examples.helloworldxds.XdsHelloWorldServer'
sanjaypujaref0915e72020-11-24 09:08:27 -080059 applicationName = 'xds-hello-world-server'
Eric Andersond44de502022-01-07 09:54:50 -080060 outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
Eric Anderson2e12b532020-01-31 11:13:44 -080061 classpath = startScripts.classpath
62}
63
64applicationDistribution.into('bin') {
Eric Anderson0be12b42020-11-24 12:12:22 -080065 from(xdsHelloWorldClient)
66 from(xdsHelloWorldServer)
Eric Anderson2e12b532020-01-31 11:13:44 -080067 fileMode = 0755
68}