-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example : generate for GO #263
Comments
You should follow the Step 2 from the protobuf documentation to install the Go protocol buffers plugin. Then add protobuf {
generateProtoTasks {
all().each { task ->
task.plugins {
go { }
}
}
}
} Run |
@zhangkun83 what about extending this to grpc? specifically im interested in C#, and I've been trying to create a workaround a le: generateProtoTasks {
all().each { task ->
task.plugins {
grpc {
logger.warn("TODO: currently not generating grpc for csharp, because protoc plugins on gradle plugins are NFG.")
// def path = file("$projectDir/../.kinda-nuget/packages/grpc.tools/1.15.0/tools/windows_x64/grpc_csharp_plugin.exe").absolutePath
// option "protoc-gen-grpc=$path"
}
}
task.builtins {
java { }
csharp { }
}
}
} |
@Groostav, to use the C# grpc plugin, you would need to first define it, with either an artifact spec or a local path, e.g., protobuf {
...
// Configure the codegen plugins
plugins {
// Define a plugin with name 'grpc'
grpc {
path = file("$projectDir/../.kinda-nuget/packages/grpc.tools/1.15.0/tools/windows_x64/grpc_csharp_plugin.exe").absolutePath
}
// Any other plugins
...
}
...
} |
Works like a charm. protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.5.1-1"
}
plugins {
grpc_java {
artifact = 'io.grpc:protoc-gen-grpc-java:1.15.1'
}
grpc_csharp {
path = file("$projectDir/../.kinda-nuget/packages/grpc.tools/1.15.0/tools/windows_x64/grpc_csharp_plugin.exe").absolutePath
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
grpc_java {}
grpc_csharp {}
}
task.builtins {
java { }
csharp {}
}
}
}
} The way I generated by But, @zhangkun83, I cant help but feel I've hijacked the OPs quesiton and others googling "go grpc gradle", given that you cant simply put a |
protoc will by default look for protoc-gen-${name} from system search path. In cases plugins need to be installed locally, this would allow projects to be able to use the locally installed plugins without having to check in their absolute paths. Resolves google#263
OP's problem could be solved by allowing referring "undefined" plugins, since Unfortunately the CI is broken and we are short-staffed, and we can't make a release with CI broken. Any help to fix the CI is welcome. |
protoc will by default look for protoc-gen-${name} from system search path. In cases plugins need to be installed locally, this would allow projects to be able to use the locally installed plugins without having to check in their absolute paths. Resolves #263
protoc will by default look for protoc-gen-${name} from system search path. In cases plugins need to be installed locally, this would allow projects to be able to use the locally installed plugins without having to check in their absolute paths. Resolves google#263
0.8.7 is released and includes #270 |
Hi,
From a set of proto files, I would like to generate stubs for both java and go.
Reading the doc I can't find a way of generating stubs for go even if it's mentioned in others issues.
Could you provide an example on how to generate for go alone and for java and go?
Thanks in advance
The text was updated successfully, but these errors were encountered: