aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/csharp/csharp_helpers.cc
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-08-25 14:32:28 +0100
committerGravatar Jon Skeet <jonskeet@google.com>2015-08-25 14:32:28 +0100
commitca89a1a118c98d107421d40c4513e5aefdd2c3e3 (patch)
tree8c4310bebb4a01ea859f439f850df3ec49079534 /src/google/protobuf/compiler/csharp/csharp_helpers.cc
parent3253634dcb2cbd5917d10aebc1a18a7692b237a3 (diff)
Change where we rename Descriptor.cs to DescriptorProtoFile.cs.
We now do this in protoc instead of the generation simpler. Benefits: - Generation script is simpler - Detection is simpler as we now only need to care about one filename - The embedded descriptor knows itself as "google/protobuf/descriptor.proto" avoiding dependency issues This PR also makes the "invalid dependency" exception clearer in terms of expected and actual dependencies.
Diffstat (limited to 'src/google/protobuf/compiler/csharp/csharp_helpers.cc')
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_helpers.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
index d25dcba9..333b4912 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
@@ -118,6 +118,12 @@ std::string GetFileNamespace(const FileDescriptor* descriptor) {
}
std::string GetUmbrellaClassUnqualifiedName(const FileDescriptor* descriptor) {
+ // We manually rename Descriptor to DescriptorProtoFile to avoid collisions with
+ // the static Descriptor property. It would be nice to be able to do this with an
+ // option, but it would be rarely used.
+ if (IsDescriptorProto(descriptor)) {
+ return "DescriptorProtoFile";
+ }
// umbrella_classname can no longer be set using message option.
std::string proto_file = descriptor->name();
int lastslash = proto_file.find_last_of("/");