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 id 'java' 9} 10 11repositories { 12 maven { // The google mirror is less flaky than mavenCentral() 13 url "https://maven-central.storage-download.googleapis.com/maven2/" 14 } 15 mavenCentral() 16 mavenLocal() 17} 18 19sourceCompatibility = 1.8 20targetCompatibility = 1.8 21 22// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you 23// are looking at a tagged version of the example and not "master"! 24 25// Feel free to delete the comment at the next line. It is just for safely 26// updating the version in our release process. 27def grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION 28def protocVersion = '3.22.3' 29 30dependencies { 31 implementation "io.grpc:grpc-protobuf:${grpcVersion}" 32 implementation "io.grpc:grpc-stub:${grpcVersion}" 33 implementation "io.grpc:grpc-gcp-observability:${grpcVersion}" 34 compileOnly "org.apache.tomcat:annotations-api:6.0.53" 35 runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}" 36} 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 } 46} 47 48startScripts.enabled = false 49 50task ObservabilityHelloWorldServer(type: CreateStartScripts) { 51 mainClass = 'io.grpc.examples.gcpobservability.GcpObservabilityServer' 52 applicationName = 'gcp-observability-server' 53 outputDir = new File(project.buildDir, 'tmp/scripts/' + name) 54 classpath = startScripts.classpath 55} 56 57task ObservabilityHelloWorldClient(type: CreateStartScripts) { 58 mainClass = 'io.grpc.examples.gcpobservability.GcpObservabilityClient' 59 applicationName = 'gcp-observability-client' 60 outputDir = new File(project.buildDir, 'tmp/scripts/' + name) 61 classpath = startScripts.classpath 62} 63 64applicationDistribution.into('bin') { 65 from(ObservabilityHelloWorldServer) 66 from(ObservabilityHelloWorldClient) 67 fileMode = 0755 68} 69