grpc-java/compiler/build.gradle

61 lines
1.3 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','testNanoGolden')
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"
}
task testNanoGolden(type: Exec, dependsOn: 'java_pluginExecutable') {
doFirst {
temporaryDir.createNewFile();
}
environment 'TEST_TMP_DIR', temporaryDir
commandLine './src/test/run_nano_test.sh'
}