diff options
author | Jon Skeet <jonskeet@google.com> | 2015-09-01 15:05:03 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-09-01 15:05:03 +0100 |
commit | 5eb1fac9831676526ed9df4641b9740f977eaf4e (patch) | |
tree | 583b67b99a32318c6b671c024290f97701bdb09a /src/google/protobuf/compiler/main.cc | |
parent | 0101a59b62f5cc36c99bbe3bae6dbaa8db8e4f26 (diff) |
Generate a directory hierarchy based on namespace (C#)
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...
Diffstat (limited to 'src/google/protobuf/compiler/main.cc')
-rw-r--r-- | src/google/protobuf/compiler/main.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/main.cc b/src/google/protobuf/compiler/main.cc index 4815a726..584e5a40 100644 --- a/src/google/protobuf/compiler/main.cc +++ b/src/google/protobuf/compiler/main.cc @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) { // CSharp google::protobuf::compiler::csharp::Generator csharp_generator; - cli.RegisterGenerator("--csharp_out", &csharp_generator, + cli.RegisterGenerator("--csharp_out", "--csharp_opt", &csharp_generator, "Generate C# source file."); // Objective C |