mirror of https://github.com/grpc/grpc-java.git
68 lines
1.9 KiB
Groovy
68 lines
1.9 KiB
Groovy
apply plugin: 'java'
|
|
|
|
description = "Thrift Examples"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
mavenLocal()
|
|
}
|
|
|
|
// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
|
|
// are looking at a tagged version of the example and not "master"!
|
|
|
|
// Feel free to delete the comment at the next line. It is just for safely
|
|
// updating the version in our release process.
|
|
def grpcVersion = '1.7.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
|
|
|
dependencies {
|
|
compile "io.grpc:grpc-stub:${grpcVersion}"
|
|
compile "io.grpc:grpc-thrift:${grpcVersion}"
|
|
compile "io.grpc:grpc-netty:${grpcVersion}"
|
|
}
|
|
|
|
// Add pre-generated code to build path
|
|
String generatedSourcePath = "${projectDir}/src/generated"
|
|
project.sourceSets {
|
|
main {
|
|
java {
|
|
srcDir "${generatedSourcePath}/main/java"
|
|
srcDir "${generatedSourcePath}/main/grpc"
|
|
}
|
|
}
|
|
}
|
|
|
|
// Inform IntelliJ projects about the generated code.
|
|
apply plugin: 'idea'
|
|
|
|
idea {
|
|
module {
|
|
sourceDirs += file("${projectDir}/src/generated/main/java");
|
|
sourceDirs += file("${projectDir}/src/generated/main/grpc");
|
|
}
|
|
}
|
|
|
|
// Provide convenience executables for trying out the examples.
|
|
apply plugin: 'application'
|
|
|
|
startScripts.enabled = false
|
|
|
|
task thriftHelloWorldServer(type: CreateStartScripts) {
|
|
mainClassName = "io.grpc.examples.thrift.helloworld.HelloWorldServer"
|
|
applicationName = "thrift-hello-world-server"
|
|
outputDir = new File(project.buildDir, 'tmp')
|
|
classpath = jar.outputs.files + project.configurations.runtime
|
|
}
|
|
|
|
task thriftHelloWorldClient(type: CreateStartScripts) {
|
|
mainClassName = "io.grpc.examples.thrift.helloworld.HelloWorldClient"
|
|
applicationName = "thrift-hello-world-client"
|
|
outputDir = new File(project.buildDir, 'tmp')
|
|
classpath = jar.outputs.files + project.configurations.runtime
|
|
}
|
|
|
|
applicationDistribution.into("bin") {
|
|
from(thriftHelloWorldServer)
|
|
from(thriftHelloWorldClient)
|
|
fileMode = 0755
|
|
}
|