diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index 162f17512e..75e9ee4d54 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -12,7 +12,7 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.Reflection { /// Holder for reflection information generated from google/protobuf/descriptor.proto - internal static partial class DescriptorReflection { + public static partial class DescriptorReflection { #region Descriptor /// File descriptor for google/protobuf/descriptor.proto @@ -193,7 +193,7 @@ namespace Google.Protobuf.Reflection { /// The protocol compiler can output a FileDescriptorSet containing the .proto /// files it parses. /// - internal sealed partial class FileDescriptorSet : pb::IMessage { + public sealed partial class FileDescriptorSet : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorSet()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -317,7 +317,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes a complete .proto file. /// - internal sealed partial class FileDescriptorProto : pb::IMessage { + public sealed partial class FileDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -800,7 +800,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes a message type. /// - internal sealed partial class DescriptorProto : pb::IMessage { + public sealed partial class DescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DescriptorProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1151,7 +1151,7 @@ namespace Google.Protobuf.Reflection { /// Container for nested types declared in the DescriptorProto message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - internal sealed partial class ExtensionRange : pb::IMessage { + public sealed partial class ExtensionRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRange()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -1391,7 +1391,7 @@ namespace Google.Protobuf.Reflection { /// fields or extension ranges in the same message. Reserved ranges may /// not overlap. /// - internal sealed partial class ReservedRange : pb::IMessage { + public sealed partial class ReservedRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReservedRange()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -1753,7 +1753,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes a field within a message. /// - internal sealed partial class FieldDescriptorProto : pb::IMessage { + public sealed partial class FieldDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldDescriptorProto()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -2298,7 +2298,7 @@ namespace Google.Protobuf.Reflection { /// Container for nested types declared in the FieldDescriptorProto message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - internal enum Type { + public enum Type { /// /// 0 is reserved for errors. /// Order is weird for historical reasons. @@ -2349,7 +2349,7 @@ namespace Google.Protobuf.Reflection { [pbr::OriginalName("TYPE_SINT64")] Sint64 = 18, } - internal enum Label { + public enum Label { /// /// 0 is reserved for errors /// @@ -2366,7 +2366,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes a oneof. /// - internal sealed partial class OneofDescriptorProto : pb::IMessage { + public sealed partial class OneofDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofDescriptorProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2554,7 +2554,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes an enum type. /// - internal sealed partial class EnumDescriptorProto : pb::IMessage { + public sealed partial class EnumDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumDescriptorProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2818,7 +2818,7 @@ namespace Google.Protobuf.Reflection { /// is inclusive such that it can appropriately represent the entire int32 /// domain. /// - internal sealed partial class EnumReservedRange : pb::IMessage { + public sealed partial class EnumReservedRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumReservedRange()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -3017,7 +3017,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes a value within an enum. /// - internal sealed partial class EnumValueDescriptorProto : pb::IMessage { + public sealed partial class EnumValueDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueDescriptorProto()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -3248,7 +3248,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes a service. /// - internal sealed partial class ServiceDescriptorProto : pb::IMessage { + public sealed partial class ServiceDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceDescriptorProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3456,7 +3456,7 @@ namespace Google.Protobuf.Reflection { /// /// Describes a method of a service. /// - internal sealed partial class MethodDescriptorProto : pb::IMessage { + public sealed partial class MethodDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodDescriptorProto()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -4892,7 +4892,7 @@ namespace Google.Protobuf.Reflection { /// /// Generated classes can be optimized for speed or code size. /// - internal enum OptimizeMode { + public enum OptimizeMode { /// /// Generate complete code for parsing, serialization, /// @@ -5772,7 +5772,7 @@ namespace Google.Protobuf.Reflection { /// Container for nested types declared in the FieldOptions message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - internal enum CType { + public enum CType { /// /// Default mode. /// @@ -5781,7 +5781,7 @@ namespace Google.Protobuf.Reflection { [pbr::OriginalName("STRING_PIECE")] StringPiece = 2, } - internal enum JSType { + public enum JSType { /// /// Use the default type. /// @@ -6905,7 +6905,7 @@ namespace Google.Protobuf.Reflection { /// or neither? HTTP based RPC implementation may choose GET verb for safe /// methods, and PUT verb for idempotent methods instead of the default POST. /// - internal enum IdempotencyLevel { + public enum IdempotencyLevel { [pbr::OriginalName("IDEMPOTENCY_UNKNOWN")] IdempotencyUnknown = 0, /// /// implies idempotent @@ -6930,7 +6930,7 @@ namespace Google.Protobuf.Reflection { /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions /// in them. /// - internal sealed partial class UninterpretedOption : pb::IMessage { + public sealed partial class UninterpretedOption : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UninterpretedOption()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -7309,7 +7309,7 @@ namespace Google.Protobuf.Reflection { /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents /// "foo.(bar.baz).qux". /// - internal sealed partial class NamePart : pb::IMessage { + public sealed partial class NamePart : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NamePart()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; @@ -7502,7 +7502,7 @@ namespace Google.Protobuf.Reflection { /// Encapsulates information about the original source file from which a /// FileDescriptorProto was generated. /// - internal sealed partial class SourceCodeInfo : pb::IMessage { + public sealed partial class SourceCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceCodeInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -7670,7 +7670,7 @@ namespace Google.Protobuf.Reflection { /// Container for nested types declared in the SourceCodeInfo message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - internal sealed partial class Location : pb::IMessage { + public sealed partial class Location : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Location()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -8004,7 +8004,7 @@ namespace Google.Protobuf.Reflection { /// file. A GeneratedCodeInfo message is associated with only one generated /// source file, but may contain references to different source .proto files. /// - internal sealed partial class GeneratedCodeInfo : pb::IMessage { + public sealed partial class GeneratedCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GeneratedCodeInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -8131,7 +8131,7 @@ namespace Google.Protobuf.Reflection { /// Container for nested types declared in the GeneratedCodeInfo message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - internal sealed partial class Annotation : pb::IMessage { + public sealed partial class Annotation : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Annotation()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.cc b/src/google/protobuf/compiler/csharp/csharp_generator.cc index 2b353b3413..b335522032 100644 --- a/src/google/protobuf/compiler/csharp/csharp_generator.cc +++ b/src/google/protobuf/compiler/csharp/csharp_generator.cc @@ -63,12 +63,6 @@ bool Generator::Generate( std::vector > options; ParseGeneratorParameter(parameter, &options); - // We only support proto3 - but we make an exception for descriptor.proto. - if (file->syntax() != FileDescriptor::SYNTAX_PROTO3 && !IsDescriptorProto(file)) { - *error = "C# code generation only supports proto3 syntax"; - return false; - } - struct Options cli_options; for (int i = 0; i < options.size(); i++) {