| // Don't consider this build file part of the example! It is much more complex |
| // than yours needs to be. For your own build file, please follow ../README.md |
| // instead. For a starting point you can make a build.gradle file with: |
| // |
| // apply plugin: 'java' |
| // repositories { |
| // mavenCentral() |
| // } |
| // |
| // Then copy the snippets from README.md. |
| |
| apply plugin: 'application' |
| |
| description = "grpc Examples" |
| |
| startScripts.enabled = false |
| |
| buildscript { |
| repositories { |
| mavenCentral() |
| } |
| dependencies { |
| classpath libraries.protobuf_plugin |
| } |
| } |
| |
| dependencies { |
| compile project(':grpc-core'), |
| project(':grpc-netty'), |
| project(':grpc-protobuf'), |
| project(':grpc-stub'), |
| libraries.protobuf_util |
| } |
| |
| configureProtoCompilation() |
| |
| task routeGuideServer(type: CreateStartScripts) { |
| mainClassName = "io.grpc.examples.routeguide.RouteGuideServer" |
| applicationName = "route-guide-server" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + project.configurations.runtime |
| } |
| |
| task routeGuideClient(type: CreateStartScripts) { |
| mainClassName = "io.grpc.examples.routeguide.RouteGuideClient" |
| applicationName = "route-guide-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + project.configurations.runtime |
| } |
| |
| task helloWorldServer(type: CreateStartScripts) { |
| mainClassName = "io.grpc.examples.helloworld.HelloWorldServer" |
| applicationName = "hello-world-server" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + project.configurations.runtime |
| } |
| |
| task helloWorldClient(type: CreateStartScripts) { |
| mainClassName = "io.grpc.examples.helloworld.HelloWorldClient" |
| applicationName = "hello-world-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + project.configurations.runtime |
| } |
| |
| task compressingHelloWorldClient(type: CreateStartScripts) { |
| mainClassName = "io.grpc.examples.experimental.CompressingHelloWorldClient" |
| applicationName = "compressing-hello-world-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + project.configurations.runtime |
| } |
| |
| applicationDistribution.into("bin") { |
| from(routeGuideServer) |
| from(routeGuideClient) |
| from(helloWorldServer) |
| from(helloWorldClient) |
| from(compressingHelloWorldClient) |
| fileMode = 0755 |
| } |
| |
| // Let intellij projects refer to generated code |
| idea { |
| module { |
| sourceDirs += file("${projectDir}/src/generated/main/java"); |
| sourceDirs += file("${projectDir}/src/generated/main/grpc"); |
| } |
| } |