Eric Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 1 | plugins { |
| 2 | id 'application' // Provide convenience executables for trying out the examples. |
sanjaypujare | b6601ba | 2020-10-23 08:38:27 -0700 | [diff] [blame] | 3 | // ASSUMES GRADLE 5.6 OR HIGHER. Use plugin version 0.8.10 with earlier gradle versions |
Chengyuan Zhang | f2ed41a | 2021-07-21 19:30:38 -0700 | [diff] [blame] | 4 | id 'com.google.protobuf' version '0.8.17' |
sanjaypujare | b6601ba | 2020-10-23 08:38:27 -0700 | [diff] [blame] | 5 | // Generate IntelliJ IDEA's .idea & .iml project files |
| 6 | id 'idea' |
Eric Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 7 | id 'java' |
| 8 | } |
| 9 | |
| 10 | repositories { |
| 11 | maven { // The google mirror is less flaky than mavenCentral() |
Eric Anderson | dc30d85 | 2020-07-09 09:38:24 -0700 | [diff] [blame] | 12 | url "https://maven-central.storage-download.googleapis.com/maven2/" } |
Eric Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 13 | mavenCentral() |
| 14 | mavenLocal() |
| 15 | } |
| 16 | |
Eric Anderson | 7cf048e | 2022-01-18 07:17:51 -0800 | [diff] [blame] | 17 | sourceCompatibility = 1.8 |
| 18 | targetCompatibility = 1.8 |
Eric Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 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. |
Sergii Tkachenko | 558b5b0 | 2023-06-13 15:39:30 -0700 | [diff] [blame] | 25 | def grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION |
Eric Anderson | 1551cc7 | 2023-04-13 08:52:20 -0700 | [diff] [blame] | 26 | def protocVersion = '3.22.3' |
Eric Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 27 | |
| 28 | dependencies { |
sanjaypujare | b6601ba | 2020-10-23 08:38:27 -0700 | [diff] [blame] | 29 | implementation "io.grpc:grpc-protobuf:${grpcVersion}" |
Eric Anderson | 7480dad | 2020-11-24 12:09:02 -0800 | [diff] [blame] | 30 | implementation "io.grpc:grpc-services:${grpcVersion}" |
sanjaypujare | b6601ba | 2020-10-23 08:38:27 -0700 | [diff] [blame] | 31 | implementation "io.grpc:grpc-stub:${grpcVersion}" |
| 32 | implementation "io.grpc:grpc-xds:${grpcVersion}" |
| 33 | compileOnly "org.apache.tomcat:annotations-api:6.0.53" |
Eric Anderson | 7480dad | 2020-11-24 12:09:02 -0800 | [diff] [blame] | 34 | |
| 35 | runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}" |
sanjaypujare | b6601ba | 2020-10-23 08:38:27 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | protobuf { |
| 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 Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | startScripts.enabled = false |
| 49 | |
Eric Anderson | 0be12b4 | 2020-11-24 12:12:22 -0800 | [diff] [blame] | 50 | task xdsHelloWorldClient(type: CreateStartScripts) { |
Eric Anderson | d44de50 | 2022-01-07 09:54:50 -0800 | [diff] [blame] | 51 | mainClass = 'io.grpc.examples.helloworldxds.XdsHelloWorldClient' |
sanjaypujare | f0915e7 | 2020-11-24 09:08:27 -0800 | [diff] [blame] | 52 | applicationName = 'xds-hello-world-client' |
Eric Anderson | d44de50 | 2022-01-07 09:54:50 -0800 | [diff] [blame] | 53 | outputDir = new File(project.buildDir, 'tmp/scripts/' + name) |
sanjaypujare | b6601ba | 2020-10-23 08:38:27 -0700 | [diff] [blame] | 54 | classpath = startScripts.classpath |
| 55 | } |
| 56 | |
Eric Anderson | 0be12b4 | 2020-11-24 12:12:22 -0800 | [diff] [blame] | 57 | task xdsHelloWorldServer(type: CreateStartScripts) { |
Eric Anderson | d44de50 | 2022-01-07 09:54:50 -0800 | [diff] [blame] | 58 | mainClass = 'io.grpc.examples.helloworldxds.XdsHelloWorldServer' |
sanjaypujare | f0915e7 | 2020-11-24 09:08:27 -0800 | [diff] [blame] | 59 | applicationName = 'xds-hello-world-server' |
Eric Anderson | d44de50 | 2022-01-07 09:54:50 -0800 | [diff] [blame] | 60 | outputDir = new File(project.buildDir, 'tmp/scripts/' + name) |
Eric Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 61 | classpath = startScripts.classpath |
| 62 | } |
| 63 | |
| 64 | applicationDistribution.into('bin') { |
Eric Anderson | 0be12b4 | 2020-11-24 12:12:22 -0800 | [diff] [blame] | 65 | from(xdsHelloWorldClient) |
| 66 | from(xdsHelloWorldServer) |
Eric Anderson | 2e12b53 | 2020-01-31 11:13:44 -0800 | [diff] [blame] | 67 | fileMode = 0755 |
| 68 | } |