I want to integrate protobuf support into my go code, but cannot figure out how to integrate it using gogradle
I want to integrate protobuf support into my go code, and am using gogradle as a build tool. I do not want to install protoc/protoc-gen-go on my machine, I want to all dependencies to be resolved when I run ./gradlew goBuild. Presently I am looking at https://github.com/innobead/gogradle/blob/5636bd09c701743b65f5da295cf28b6515b8c0bf/README.md but cannot figure out where the grpc tag would go. I tried putting it in the build.gradle file:
....
task grpc() {
// Protobuf schemas root folder. Default: file("proto")
protoDir = file("$projectDir/metriclibrary/publish/proto")
// Append the module path as prefix path of below packages when referenced in other protobuf gnerated stub go files
referencePackages = []
}
dependencies {
...
golang {
build 'github.com/golang/protobuf@v1.2.0'
build 'google.golang.org/grpc@v1.14.0'
}
}
.....
goGrpc.dependsOn grpc
OUTPUT:
Configuration on demand is an incubating feature.
Configure project :agt Found go 1.12 in /usr/local/go/bin/go, use it.
FAILURE: Build failed with an exception.
Where: Build file '...../build.gradle' line: 43
-
What went wrong: A problem occurred evaluating project ':agt'.
Could not set unknown property 'protoDir' for task ':agt' of type org.gradle.api.DefaultTask.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org