Generate C# directory hierarchy with new option#785
Generate C# directory hierarchy with new option#785jtattermusch merged 5 commits intoprotocolbuffers:masterfrom
Conversation
This introduces a new C# option, base_namespace. If the option is not specified, the behaviour is as before: no directories are generated. If the option *is* specified, all C# namespaces must be relative to the base namespace, and the directories are generated relative to that namespace. Example: - Any.proto declares csharp_namespace = "Google.Protobuf.WellKnownTypes" - We build with --csharp_out=Google.Protobuf --csharp_opt=base_namespace=Google.Protobuf - The Any.cs file is generated in Google.Protobuf/WellKnownTypes (where it currently lives) We need a change to descriptor.proto before this will all work (it wasn't in the right C# namespace) but that needs the other descriptors to be regenerated too. See next commit...
Other changes are due to the well-known types changing without us regenerating.
|
@jtattermusch Jan, have you had a chance to look at this? |
|
Yes, that's exactly what it will do - at least, that's what it's intended to do :) I'll double-check that it really does do that... |
|
@xfxyjwf is there a way to make a command line option "base_namespace" in "--csharp_opt=base_namespace=Google.Protobuf" shared across multiple protoc plugins (C# plugin and gRPC C# plugin in our case)? If so, is that something you would recommend? |
|
No, there isn't a way to share the command line options between different plugins. Protoc treat each plugin as an independent code generator and do not pass any information between them. |
|
Alright, it looks like exposing GetOutputFile in csharp_names.h should be easy, so I will merge this now and expose the function in a followup PR. |
Generate C# directory hierarchy with new option
This changes protoc-gen-go-grpc to always emit an UnimplementedServer type that implements the service interface. Users trying to implement the service interface can embed this type to ensure that new methods can be added in a forwards compatible manner.
Generate C# directory hierarchy with new option
This introduces a new C# option, base_namespace.
If the option is not specified, the behaviour is as before: no directories are generated.
If the option is specified, all C# namespaces must be relative to the base namespace, and the directories are generated relative to that namespace.
Example:
This PR fixes #773.
// cc @anandolee