mirror of https://github.com/grpc/grpc-java.git
50 lines
1.1 KiB
Groovy
50 lines
1.1 KiB
Groovy
apply plugin: "cpp"
|
|
apply plugin: "protobuf"
|
|
|
|
description = 'The protoc plugin for gRPC Java'
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath libraries.protobuf_plugin
|
|
}
|
|
}
|
|
|
|
executables {
|
|
java_plugin {}
|
|
}
|
|
|
|
dependencies {
|
|
compile project(':grpc-stub'),
|
|
libraries.protobuf
|
|
}
|
|
|
|
binaries.all {
|
|
if (toolChain in Gcc || toolChain in Clang) {
|
|
cppCompiler.args "-std=c++11"
|
|
if (System.env.CXXFLAGS) {
|
|
cppCompiler.args System.env.CXXFLAGS
|
|
}
|
|
if (System.env.CPPFLAGS) {
|
|
cppCompiler.args System.env.CPPFLAGS
|
|
}
|
|
linker.args "-lprotoc", "-lprotobuf"
|
|
if (System.env.LDFLAGS) {
|
|
linker.args System.env.LDFLAGS
|
|
}
|
|
}
|
|
}
|
|
|
|
protobufCodeGenPlugins = ["java_plugin:$buildDir/binaries/java_pluginExecutable/java_plugin"]
|
|
|
|
generateTestProto.dependsOn 'java_pluginExecutable'
|
|
test.dependsOn 'testGolden'
|
|
|
|
task testGolden(type: Exec, dependsOn: 'generateTestProto') {
|
|
executable "diff"
|
|
args "$buildDir/generated-sources/test/io/grpc/testing/integration/TestServiceGrpc.java",
|
|
"$projectDir/src/test/golden/TestService.java.txt"
|
|
}
|