1plugins { 2 id 'application' // Provide convenience executables for trying out the examples. 3 id 'java' 4 5 id "com.google.protobuf" version "0.8.17" 6 7 // Generate IntelliJ IDEA's .idea & .iml project files 8 id 'idea' 9} 10 11repositories { 12 maven { // The google mirror is less flaky than mavenCentral() 13 url "https://maven-central.storage-download.googleapis.com/maven2/" } 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 protobufVersion = '3.22.3' 28 29dependencies { 30 implementation "io.grpc:grpc-protobuf:${grpcVersion}" 31 implementation "io.grpc:grpc-stub:${grpcVersion}" 32 implementation "io.grpc:grpc-services:${grpcVersion}" 33 compileOnly "org.apache.tomcat:annotations-api:6.0.53" 34 runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}" 35 36 testImplementation 'junit:junit:4.13.2' 37 testImplementation "io.grpc:grpc-testing:${grpcVersion}" 38} 39 40protobuf { 41 protoc { 42 artifact = "com.google.protobuf:protoc:${protobufVersion}" 43 } 44 plugins { 45 grpc { 46 artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" 47 } 48 } 49 generateProtoTasks { 50 all()*.plugins { 51 grpc {} 52 } 53 } 54} 55 56startScripts.enabled = false 57 58task HelloWorldDebuggableClient(type: CreateStartScripts) { 59 mainClass = 'io.grpc.examples.debug.HelloWorldDebuggableClient' 60 applicationName = 'hello-world-debuggable-client' 61 outputDir = new File(project.buildDir, 'tmp/scripts/' + name) 62 classpath = startScripts.classpath 63} 64 65task HostnameDebuggableServer(type: CreateStartScripts) { 66 mainClass = 'io.grpc.examples.debug.HostnameDebuggableServer' 67 applicationName = 'hostname-debuggable-server' 68 outputDir = new File(project.buildDir, 'tmp/scripts/' + name) 69 classpath = startScripts.classpath 70} 71 72applicationDistribution.into('bin') { 73 from(HelloWorldDebuggableClient) 74 from(HostnameDebuggableServer) 75 fileMode = 0755 76} 77