aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-08-13 12:01:41 +0100
committerGravatar Jon Skeet <jonskeet@google.com>2015-08-13 12:01:41 +0100
commita39ababb7cf8839d96b3347e0da87fbcc3d512e8 (patch)
treee08353c9677af5b1b200cb8189b45e91dc0840a3 /csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
parentf818183f9b0c0c8838dd99c54923d8dd6c11d4ed (diff)
Allow public access to descriptor.proto as a dependency.
With this in place, generating APIs on github.com/google/googleapis works - previously annotations.proto failed. Currently there's no access to the annotations (stored as extensions) but we could potentially expose those at a later date.
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs')
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
index 500e467c..bad58faa 100644
--- a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
@@ -368,5 +368,20 @@ namespace Google.Protobuf.Reflection
{
return "FileDescriptor for " + proto.Name;
}
+
+ /// <summary>
+ /// Returns the file descriptor for descriptor.proto.
+ /// </summary>
+ /// <remarks>
+ /// This is used for protos which take a direct dependency on <c>descriptor.proto</c>, typically for
+ /// annotations. While <c>descriptor.proto</c> is a proto2 file, it is built into the Google.Protobuf
+ /// runtime for reflection purposes. The messages are internal to the runtime as they would require
+ /// proto2 semantics for full support, but the file descriptor is available via this property. The
+ /// C# codegen in protoc automatically uses this property when it detects a dependency on <c>descriptor.proto</c>.
+ /// </remarks>
+ /// <value>
+ /// The file descriptor for <c>descriptor.proto</c>.
+ /// </value>
+ public static FileDescriptor DescriptorProtoFileDescriptor { get { return DescriptorProtoFile.Descriptor; } }
}
} \ No newline at end of file