1*e07d83d3SAndroid Build Coastguard Workerplugins { 2*e07d83d3SAndroid Build Coastguard Worker // Provide convenience executables for trying out the examples. 3*e07d83d3SAndroid Build Coastguard Worker id 'application' 4*e07d83d3SAndroid Build Coastguard Worker // ASSUMES GRADLE 5.6 OR HIGHER. Use plugin version 0.8.10 with earlier gradle versions 5*e07d83d3SAndroid Build Coastguard Worker id 'com.google.protobuf' version '0.8.17' 6*e07d83d3SAndroid Build Coastguard Worker // Generate IntelliJ IDEA's .idea & .iml project files 7*e07d83d3SAndroid Build Coastguard Worker id 'idea' 8*e07d83d3SAndroid Build Coastguard Worker} 9*e07d83d3SAndroid Build Coastguard Worker 10*e07d83d3SAndroid Build Coastguard Workerrepositories { 11*e07d83d3SAndroid Build Coastguard Worker maven { // The google mirror is less flaky than mavenCentral() 12*e07d83d3SAndroid Build Coastguard Worker url "https://maven-central.storage-download.googleapis.com/maven2/" 13*e07d83d3SAndroid Build Coastguard Worker } 14*e07d83d3SAndroid Build Coastguard Worker mavenCentral() 15*e07d83d3SAndroid Build Coastguard Worker mavenLocal() 16*e07d83d3SAndroid Build Coastguard Worker} 17*e07d83d3SAndroid Build Coastguard Worker 18*e07d83d3SAndroid Build Coastguard WorkersourceCompatibility = 1.8 19*e07d83d3SAndroid Build Coastguard WorkertargetCompatibility = 1.8 20*e07d83d3SAndroid Build Coastguard Worker 21*e07d83d3SAndroid Build Coastguard Worker// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you 22*e07d83d3SAndroid Build Coastguard Worker// are looking at a tagged version of the example and not "master"! 23*e07d83d3SAndroid Build Coastguard Worker 24*e07d83d3SAndroid Build Coastguard Worker// Feel free to delete the comment at the next line. It is just for safely 25*e07d83d3SAndroid Build Coastguard Worker// updating the version in our release process. 26*e07d83d3SAndroid Build Coastguard Workerdef grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION 27*e07d83d3SAndroid Build Coastguard Workerdef protocVersion = '3.22.3' 28*e07d83d3SAndroid Build Coastguard Worker 29*e07d83d3SAndroid Build Coastguard Workerdependencies { 30*e07d83d3SAndroid Build Coastguard Worker implementation "io.grpc:grpc-protobuf:${grpcVersion}" 31*e07d83d3SAndroid Build Coastguard Worker implementation "io.grpc:grpc-stub:${grpcVersion}" 32*e07d83d3SAndroid Build Coastguard Worker compileOnly "org.apache.tomcat:annotations-api:6.0.53" 33*e07d83d3SAndroid Build Coastguard Worker runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}" 34*e07d83d3SAndroid Build Coastguard Worker} 35*e07d83d3SAndroid Build Coastguard Worker 36*e07d83d3SAndroid Build Coastguard Workerprotobuf { 37*e07d83d3SAndroid Build Coastguard Worker protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" } 38*e07d83d3SAndroid Build Coastguard Worker plugins { 39*e07d83d3SAndroid Build Coastguard Worker grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" } 40*e07d83d3SAndroid Build Coastguard Worker } 41*e07d83d3SAndroid Build Coastguard Worker generateProtoTasks { 42*e07d83d3SAndroid Build Coastguard Worker all()*.plugins { grpc {} } 43*e07d83d3SAndroid Build Coastguard Worker } 44*e07d83d3SAndroid Build Coastguard Worker} 45*e07d83d3SAndroid Build Coastguard Worker 46*e07d83d3SAndroid Build Coastguard Worker// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code. 47*e07d83d3SAndroid Build Coastguard WorkersourceSets { 48*e07d83d3SAndroid Build Coastguard Worker main { 49*e07d83d3SAndroid Build Coastguard Worker java { 50*e07d83d3SAndroid Build Coastguard Worker srcDirs 'build/generated/source/proto/main/grpc' 51*e07d83d3SAndroid Build Coastguard Worker srcDirs 'build/generated/source/proto/main/java' 52*e07d83d3SAndroid Build Coastguard Worker } 53*e07d83d3SAndroid Build Coastguard Worker } 54*e07d83d3SAndroid Build Coastguard Worker} 55*e07d83d3SAndroid Build Coastguard Worker 56*e07d83d3SAndroid Build Coastguard WorkerstartScripts.enabled = false 57*e07d83d3SAndroid Build Coastguard Worker 58*e07d83d3SAndroid Build Coastguard Workertask helloWorldTlsServer(type: CreateStartScripts) { 59*e07d83d3SAndroid Build Coastguard Worker mainClass = 'io.grpc.examples.helloworldtls.HelloWorldServerTls' 60*e07d83d3SAndroid Build Coastguard Worker applicationName = 'hello-world-tls-server' 61*e07d83d3SAndroid Build Coastguard Worker outputDir = new File(project.buildDir, 'tmp/scripts/' + name) 62*e07d83d3SAndroid Build Coastguard Worker classpath = startScripts.classpath 63*e07d83d3SAndroid Build Coastguard Worker} 64*e07d83d3SAndroid Build Coastguard Worker 65*e07d83d3SAndroid Build Coastguard Workertask helloWorldTlsClient(type: CreateStartScripts) { 66*e07d83d3SAndroid Build Coastguard Worker mainClass = 'io.grpc.examples.helloworldtls.HelloWorldClientTls' 67*e07d83d3SAndroid Build Coastguard Worker applicationName = 'hello-world-tls-client' 68*e07d83d3SAndroid Build Coastguard Worker outputDir = new File(project.buildDir, 'tmp/scripts/' + name) 69*e07d83d3SAndroid Build Coastguard Worker classpath = startScripts.classpath 70*e07d83d3SAndroid Build Coastguard Worker} 71*e07d83d3SAndroid Build Coastguard Worker 72*e07d83d3SAndroid Build Coastguard WorkerapplicationDistribution.into('bin') { 73*e07d83d3SAndroid Build Coastguard Worker from(helloWorldTlsServer) 74*e07d83d3SAndroid Build Coastguard Worker from(helloWorldTlsClient) 75*e07d83d3SAndroid Build Coastguard Worker fileMode = 0755 76*e07d83d3SAndroid Build Coastguard Worker} 77