瀏覽代碼

Merge pull request #348 from jskeet/csharp

Add C# namespace to .proto files (e.g. descriptors, unit tests)
Jon Skeet 10 年之前
父節點
當前提交
34fb666955
共有 30 個文件被更改,包括 44 次插入9 次删除
  1. 3 0
      benchmarks/google_size.proto
  2. 3 0
      benchmarks/google_speed.proto
  3. 1 1
      src/google/protobuf/any.proto
  4. 3 2
      src/google/protobuf/descriptor.pb.cc
  5. 1 0
      src/google/protobuf/descriptor.proto
  6. 1 1
      src/google/protobuf/duration.proto
  7. 1 1
      src/google/protobuf/field_mask.proto
  8. 1 0
      src/google/protobuf/map_lite_unittest.proto
  9. 2 0
      src/google/protobuf/map_proto2_unittest.proto
  10. 1 0
      src/google/protobuf/map_unittest.proto
  11. 1 1
      src/google/protobuf/struct.proto
  12. 1 1
      src/google/protobuf/timestamp.proto
  13. 1 0
      src/google/protobuf/unittest.proto
  14. 1 0
      src/google/protobuf/unittest_custom_options.proto
  15. 2 0
      src/google/protobuf/unittest_drop_unknown_fields.proto
  16. 2 0
      src/google/protobuf/unittest_embed_optimize_for.proto
  17. 3 1
      src/google/protobuf/unittest_enormous_descriptor.proto
  18. 1 0
      src/google/protobuf/unittest_import.proto
  19. 1 0
      src/google/protobuf/unittest_import_lite.proto
  20. 1 0
      src/google/protobuf/unittest_import_public.proto
  21. 1 0
      src/google/protobuf/unittest_import_public_lite.proto
  22. 1 0
      src/google/protobuf/unittest_lite.proto
  23. 1 0
      src/google/protobuf/unittest_lite_imports_nonlite.proto
  24. 1 0
      src/google/protobuf/unittest_mset.proto
  25. 2 0
      src/google/protobuf/unittest_no_field_presence.proto
  26. 1 0
      src/google/protobuf/unittest_optimize_for.proto
  27. 2 0
      src/google/protobuf/unittest_preserve_unknown_enum.proto
  28. 2 0
      src/google/protobuf/unittest_preserve_unknown_enum2.proto
  29. 1 0
      src/google/protobuf/unknown_enum_test.proto
  30. 1 1
      src/google/protobuf/wrappers.proto

+ 3 - 0
benchmarks/google_size.proto

@@ -1,7 +1,10 @@
+syntax = "proto2";
+
 package benchmarks;
 package benchmarks;
 
 
 option java_outer_classname = "GoogleSize";
 option java_outer_classname = "GoogleSize";
 option optimize_for = CODE_SIZE;
 option optimize_for = CODE_SIZE;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 message SizeMessage1 {
 message SizeMessage1 {
   required string field1 = 1;
   required string field1 = 1;

+ 3 - 0
benchmarks/google_speed.proto

@@ -1,7 +1,10 @@
+syntax = "proto2";
+
 package benchmarks;
 package benchmarks;
 
 
 option java_outer_classname = "GoogleSpeed";
 option java_outer_classname = "GoogleSpeed";
 option optimize_for = SPEED;
 option optimize_for = SPEED;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 message SpeedMessage1 {
 message SpeedMessage1 {
   required string field1 = 1;
   required string field1 = 1;

+ 1 - 1
src/google/protobuf/any.proto

@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
 option java_multiple_files = true;
 option java_multiple_files = true;
 option java_outer_classname = "AnyProto";
 option java_outer_classname = "AnyProto";
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
-
+option csharp_namespace = "Google.ProtocolBuffers";
 
 
 // `Any` contains an arbitrary serialized message along with a URL
 // `Any` contains an arbitrary serialized message along with a URL
 // that describes the type of the serialized message.
 // that describes the type of the serialized message.

+ 3 - 2
src/google/protobuf/descriptor.pb.cc

@@ -719,8 +719,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() {
     "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead"
     "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead"
     "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030"
     "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030"
     "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t"
     "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t"
-    "B)\n\023com.google.protobufB\020DescriptorProto"
-    "sH\001", 4643);
+    "BS\n\023com.google.protobufB\020DescriptorProto"
+    "sH\001\252\002\'Google.ProtocolBuffers.DescriptorP"
+    "rotos", 4685);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
     "google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
   FileDescriptorSet::default_instance_ = new FileDescriptorSet();
   FileDescriptorSet::default_instance_ = new FileDescriptorSet();

+ 1 - 0
src/google/protobuf/descriptor.proto

@@ -42,6 +42,7 @@ syntax = "proto2";
 package google.protobuf;
 package google.protobuf;
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
 option java_outer_classname = "DescriptorProtos";
 option java_outer_classname = "DescriptorProtos";
+option csharp_namespace = "Google.ProtocolBuffers.DescriptorProtos";
 
 
 // descriptor.proto must be optimized for speed because reflection-based
 // descriptor.proto must be optimized for speed because reflection-based
 // algorithms don't work during bootstrapping.
 // algorithms don't work during bootstrapping.

+ 1 - 1
src/google/protobuf/duration.proto

@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
 option java_multiple_files = true;
 option java_multiple_files = true;
 option java_outer_classname = "DurationProto";
 option java_outer_classname = "DurationProto";
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
-
+option csharp_namespace = "Google.ProtocolBuffers";
 
 
 // A Duration represents a signed, fixed-length span of time represented
 // A Duration represents a signed, fixed-length span of time represented
 // as a count of seconds and fractions of seconds at nanosecond
 // as a count of seconds and fractions of seconds at nanosecond

+ 1 - 1
src/google/protobuf/field_mask.proto

@@ -34,7 +34,7 @@ package google.protobuf;
 option java_multiple_files = true;
 option java_multiple_files = true;
 option java_outer_classname = "FieldMaskProto";
 option java_outer_classname = "FieldMaskProto";
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
-
+option csharp_namespace = "Google.ProtocolBuffers";
 
 
 // `FieldMask` represents a set of symbolic field paths, for example:
 // `FieldMask` represents a set of symbolic field paths, for example:
 //
 //

+ 1 - 0
src/google/protobuf/map_lite_unittest.proto

@@ -32,6 +32,7 @@ syntax = "proto2";
 
 
 option cc_enable_arenas = true;
 option cc_enable_arenas = true;
 option optimize_for = LITE_RUNTIME;
 option optimize_for = LITE_RUNTIME;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 import "google/protobuf/unittest_lite.proto";
 import "google/protobuf/unittest_lite.proto";
 
 

+ 2 - 0
src/google/protobuf/map_proto2_unittest.proto

@@ -36,6 +36,8 @@ syntax = "proto2";
 // In map_test_util.h we do "using namespace unittest = protobuf_unittest".
 // In map_test_util.h we do "using namespace unittest = protobuf_unittest".
 package protobuf_unittest;
 package protobuf_unittest;
 
 
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
 enum Proto2MapEnum {
 enum Proto2MapEnum {
   PROTO2_MAP_ENUM_FOO   = 0;
   PROTO2_MAP_ENUM_FOO   = 0;
   PROTO2_MAP_ENUM_BAR   = 1;
   PROTO2_MAP_ENUM_BAR   = 1;

+ 1 - 0
src/google/protobuf/map_unittest.proto

@@ -31,6 +31,7 @@
 syntax = "proto3";
 syntax = "proto3";
 
 
 option cc_enable_arenas = true;
 option cc_enable_arenas = true;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 import "google/protobuf/unittest.proto";
 import "google/protobuf/unittest.proto";
 
 

+ 1 - 1
src/google/protobuf/struct.proto

@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
 option java_multiple_files = true;
 option java_multiple_files = true;
 option java_outer_classname = "StructProto";
 option java_outer_classname = "StructProto";
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
-
+option csharp_namespace = "Google.ProtocolBuffers";
 
 
 // `Struct` represents a structured data value, consisting of fields
 // `Struct` represents a structured data value, consisting of fields
 // which map to dynamically typed values. In some languages, `Struct`
 // which map to dynamically typed values. In some languages, `Struct`

+ 1 - 1
src/google/protobuf/timestamp.proto

@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
 option java_multiple_files = true;
 option java_multiple_files = true;
 option java_outer_classname = "TimestampProto";
 option java_outer_classname = "TimestampProto";
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
-
+option csharp_namespace = "Google.ProtocolBuffers";
 
 
 // A Timestamp represents a point in time independent of any time zone
 // A Timestamp represents a point in time independent of any time zone
 // or calendar, represented as seconds and fractions of seconds at
 // or calendar, represented as seconds and fractions of seconds at

+ 1 - 0
src/google/protobuf/unittest.proto

@@ -42,6 +42,7 @@ option cc_generic_services = true;     // auto-added
 option java_generic_services = true;   // auto-added
 option java_generic_services = true;   // auto-added
 option py_generic_services = true;     // auto-added
 option py_generic_services = true;     // auto-added
 option cc_enable_arenas = true;
 option cc_enable_arenas = true;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 import "google/protobuf/unittest_import.proto";
 import "google/protobuf/unittest_import.proto";
 
 

+ 1 - 0
src/google/protobuf/unittest_custom_options.proto

@@ -41,6 +41,7 @@ syntax = "proto2";
 option cc_generic_services = true;     // auto-added
 option cc_generic_services = true;     // auto-added
 option java_generic_services = true;   // auto-added
 option java_generic_services = true;   // auto-added
 option py_generic_services = true;
 option py_generic_services = true;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 // A custom file option (defined below).
 // A custom file option (defined below).
 option (file_opt1) = 9876543210;
 option (file_opt1) = 9876543210;

+ 2 - 0
src/google/protobuf/unittest_drop_unknown_fields.proto

@@ -32,6 +32,8 @@ syntax = "proto3";
 
 
 package unittest_drop_unknown_fields;
 package unittest_drop_unknown_fields;
 
 
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
 message Foo {
 message Foo {
   enum NestedEnum {
   enum NestedEnum {
     FOO = 0;
     FOO = 0;

+ 2 - 0
src/google/protobuf/unittest_embed_optimize_for.proto

@@ -39,6 +39,8 @@ import "google/protobuf/unittest_optimize_for.proto";
 
 
 package protobuf_unittest;
 package protobuf_unittest;
 
 
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
 // We optimize for speed here, but we are importing a proto that is optimized
 // We optimize for speed here, but we are importing a proto that is optimized
 // for code size.
 // for code size.
 option optimize_for = SPEED;
 option optimize_for = SPEED;

+ 3 - 1
src/google/protobuf/unittest_enormous_descriptor.proto

@@ -33,12 +33,14 @@
 //  Sanjay Ghemawat, Jeff Dean, and others.
 //  Sanjay Ghemawat, Jeff Dean, and others.
 //
 //
 // A proto file that has an extremely large descriptor.  Used to test that
 // A proto file that has an extremely large descriptor.  Used to test that
-// descriptors over 64k don't break the string literal length limit in Java.
+// descriptors over 64k don't break language-specific limits in generated code,
+// such as the string literal length limit in Java.
 
 
 syntax = "proto2";
 syntax = "proto2";
 
 
 package google.protobuf;
 package google.protobuf;
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 // Avoid generating insanely long methods.
 // Avoid generating insanely long methods.
 option optimize_for = CODE_SIZE;
 option optimize_for = CODE_SIZE;

+ 1 - 0
src/google/protobuf/unittest_import.proto

@@ -47,6 +47,7 @@ option cc_enable_arenas = true;
 
 
 // Exercise the java_package option.
 // Exercise the java_package option.
 option java_package = "com.google.protobuf.test";
 option java_package = "com.google.protobuf.test";
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 // Do not set a java_outer_classname here to verify that Proto2 works without
 // Do not set a java_outer_classname here to verify that Proto2 works without
 // one.
 // one.

+ 1 - 0
src/google/protobuf/unittest_import_lite.proto

@@ -38,6 +38,7 @@ package protobuf_unittest_import;
 option optimize_for = LITE_RUNTIME;
 option optimize_for = LITE_RUNTIME;
 
 
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 import public "google/protobuf/unittest_import_public_lite.proto";
 import public "google/protobuf/unittest_import_public_lite.proto";
 
 

+ 1 - 0
src/google/protobuf/unittest_import_public.proto

@@ -35,6 +35,7 @@ syntax = "proto2";
 package protobuf_unittest_import;
 package protobuf_unittest_import;
 
 
 option java_package = "com.google.protobuf.test";
 option java_package = "com.google.protobuf.test";
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 message PublicImportMessage {
 message PublicImportMessage {
   optional int32 e = 1;
   optional int32 e = 1;

+ 1 - 0
src/google/protobuf/unittest_import_public_lite.proto

@@ -37,6 +37,7 @@ package protobuf_unittest_import;
 option optimize_for = LITE_RUNTIME;
 option optimize_for = LITE_RUNTIME;
 
 
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 message PublicImportMessageLite {
 message PublicImportMessageLite {
   optional int32 e = 1;
   optional int32 e = 1;

+ 1 - 0
src/google/protobuf/unittest_lite.proto

@@ -40,6 +40,7 @@ import "google/protobuf/unittest_import_lite.proto";
 option optimize_for = LITE_RUNTIME;
 option optimize_for = LITE_RUNTIME;
 
 
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 // Same as TestAllTypes but with the lite runtime.
 // Same as TestAllTypes but with the lite runtime.
 message TestAllTypesLite {
 message TestAllTypesLite {

+ 1 - 0
src/google/protobuf/unittest_lite_imports_nonlite.proto

@@ -38,6 +38,7 @@ package protobuf_unittest;
 import "google/protobuf/unittest.proto";
 import "google/protobuf/unittest.proto";
 
 
 option optimize_for = LITE_RUNTIME;
 option optimize_for = LITE_RUNTIME;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 message TestLiteImportsNonlite {
 message TestLiteImportsNonlite {
   optional TestAllTypes message = 1;
   optional TestAllTypes message = 1;

+ 1 - 0
src/google/protobuf/unittest_mset.proto

@@ -39,6 +39,7 @@ package protobuf_unittest;
 
 
 option cc_enable_arenas = true;
 option cc_enable_arenas = true;
 option optimize_for = SPEED;
 option optimize_for = SPEED;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 // A message with message_set_wire_format.
 // A message with message_set_wire_format.
 message TestMessageSet {
 message TestMessageSet {

+ 2 - 0
src/google/protobuf/unittest_no_field_presence.proto

@@ -37,6 +37,8 @@ import "google/protobuf/unittest.proto";
 
 
 package proto2_nofieldpresence_unittest;
 package proto2_nofieldpresence_unittest;
 
 
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
 // This proto includes every type of field in both singular and repeated
 // This proto includes every type of field in both singular and repeated
 // forms.
 // forms.
 message TestAllTypes {
 message TestAllTypes {

+ 1 - 0
src/google/protobuf/unittest_optimize_for.proto

@@ -40,6 +40,7 @@ import "google/protobuf/unittest.proto";
 package protobuf_unittest;
 package protobuf_unittest;
 
 
 option optimize_for = CODE_SIZE;
 option optimize_for = CODE_SIZE;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 message TestOptimizedForSize {
 message TestOptimizedForSize {
   optional int32 i = 1;
   optional int32 i = 1;

+ 2 - 0
src/google/protobuf/unittest_preserve_unknown_enum.proto

@@ -32,6 +32,8 @@ syntax = "proto3";
 
 
 package proto3_preserve_unknown_enum_unittest;
 package proto3_preserve_unknown_enum_unittest;
 
 
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
 enum MyEnum {
 enum MyEnum {
   FOO = 0;
   FOO = 0;
   BAR = 1;
   BAR = 1;

+ 2 - 0
src/google/protobuf/unittest_preserve_unknown_enum2.proto

@@ -32,6 +32,8 @@ syntax = "proto2";
 
 
 package proto2_preserve_unknown_enum_unittest;
 package proto2_preserve_unknown_enum_unittest;
 
 
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
 enum MyEnum {
 enum MyEnum {
   FOO = 0;
   FOO = 0;
   BAR = 1;
   BAR = 1;

+ 1 - 0
src/google/protobuf/unknown_enum_test.proto

@@ -36,6 +36,7 @@ syntax = "proto2";
 
 
 package google.protobuf.util;
 package google.protobuf.util;
 
 
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
 
 
 message DownRevision {
 message DownRevision {
   enum Enum {
   enum Enum {

+ 1 - 1
src/google/protobuf/wrappers.proto

@@ -40,7 +40,7 @@ package google.protobuf;
 option java_multiple_files = true;
 option java_multiple_files = true;
 option java_outer_classname = "WrappersProto";
 option java_outer_classname = "WrappersProto";
 option java_package = "com.google.protobuf";
 option java_package = "com.google.protobuf";
-
+option csharp_namespace = "Google.ProtocolBuffers";
 
 
 // Wrapper message for double.
 // Wrapper message for double.
 message DoubleValue {
 message DoubleValue {