Commit 34fb6669 authored by Jon Skeet's avatar Jon Skeet

Merge pull request #348 from jskeet/csharp

Add C# namespace to .proto files (e.g. descriptors, unit tests)
parents e0afc002 81725619
syntax = "proto2";
package benchmarks;
option java_outer_classname = "GoogleSize";
option optimize_for = CODE_SIZE;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message SizeMessage1 {
required string field1 = 1;
......
syntax = "proto2";
package benchmarks;
option java_outer_classname = "GoogleSpeed";
option optimize_for = SPEED;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message SpeedMessage1 {
required string field1 = 1;
......
......@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
option java_multiple_files = true;
option java_outer_classname = "AnyProto";
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers";
// `Any` contains an arbitrary serialized message along with a URL
// that describes the type of the serialized message.
......
......@@ -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"
"ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030"
"\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/descriptor.proto", &protobuf_RegisterTypes);
FileDescriptorSet::default_instance_ = new FileDescriptorSet();
......
......@@ -42,6 +42,7 @@ syntax = "proto2";
package google.protobuf;
option java_package = "com.google.protobuf";
option java_outer_classname = "DescriptorProtos";
option csharp_namespace = "Google.ProtocolBuffers.DescriptorProtos";
// descriptor.proto must be optimized for speed because reflection-based
// algorithms don't work during bootstrapping.
......
......@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
option java_multiple_files = true;
option java_outer_classname = "DurationProto";
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers";
// A Duration represents a signed, fixed-length span of time represented
// as a count of seconds and fractions of seconds at nanosecond
......
......@@ -34,7 +34,7 @@ package google.protobuf;
option java_multiple_files = true;
option java_outer_classname = "FieldMaskProto";
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers";
// `FieldMask` represents a set of symbolic field paths, for example:
//
......
......@@ -32,6 +32,7 @@ syntax = "proto2";
option cc_enable_arenas = true;
option optimize_for = LITE_RUNTIME;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
import "google/protobuf/unittest_lite.proto";
......
......@@ -36,6 +36,8 @@ syntax = "proto2";
// In map_test_util.h we do "using namespace unittest = protobuf_unittest".
package protobuf_unittest;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
enum Proto2MapEnum {
PROTO2_MAP_ENUM_FOO = 0;
PROTO2_MAP_ENUM_BAR = 1;
......
......@@ -31,6 +31,7 @@
syntax = "proto3";
option cc_enable_arenas = true;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
import "google/protobuf/unittest.proto";
......
......@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
option java_multiple_files = true;
option java_outer_classname = "StructProto";
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers";
// `Struct` represents a structured data value, consisting of fields
// which map to dynamically typed values. In some languages, `Struct`
......
......@@ -35,7 +35,7 @@ option java_generate_equals_and_hash = true;
option java_multiple_files = true;
option java_outer_classname = "TimestampProto";
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers";
// A Timestamp represents a point in time independent of any time zone
// or calendar, represented as seconds and fractions of seconds at
......
......@@ -42,6 +42,7 @@ option cc_generic_services = true; // auto-added
option java_generic_services = true; // auto-added
option py_generic_services = true; // auto-added
option cc_enable_arenas = true;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
import "google/protobuf/unittest_import.proto";
......
......@@ -41,6 +41,7 @@ syntax = "proto2";
option cc_generic_services = true; // auto-added
option java_generic_services = true; // auto-added
option py_generic_services = true;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
// A custom file option (defined below).
option (file_opt1) = 9876543210;
......
......@@ -32,6 +32,8 @@ syntax = "proto3";
package unittest_drop_unknown_fields;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message Foo {
enum NestedEnum {
FOO = 0;
......
......@@ -39,6 +39,8 @@ import "google/protobuf/unittest_optimize_for.proto";
package protobuf_unittest;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
// We optimize for speed here, but we are importing a proto that is optimized
// for code size.
option optimize_for = SPEED;
......
......@@ -33,12 +33,14 @@
// Sanjay Ghemawat, Jeff Dean, and others.
//
// 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";
package google.protobuf;
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
// Avoid generating insanely long methods.
option optimize_for = CODE_SIZE;
......
......@@ -47,6 +47,7 @@ option cc_enable_arenas = true;
// Exercise the java_package option.
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
// one.
......
......@@ -38,6 +38,7 @@ package protobuf_unittest_import;
option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
import public "google/protobuf/unittest_import_public_lite.proto";
......
......@@ -35,6 +35,7 @@ syntax = "proto2";
package protobuf_unittest_import;
option java_package = "com.google.protobuf.test";
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message PublicImportMessage {
optional int32 e = 1;
......
......@@ -37,6 +37,7 @@ package protobuf_unittest_import;
option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message PublicImportMessageLite {
optional int32 e = 1;
......
......@@ -40,6 +40,7 @@ import "google/protobuf/unittest_import_lite.proto";
option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
// Same as TestAllTypes but with the lite runtime.
message TestAllTypesLite {
......
......@@ -38,6 +38,7 @@ package protobuf_unittest;
import "google/protobuf/unittest.proto";
option optimize_for = LITE_RUNTIME;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message TestLiteImportsNonlite {
optional TestAllTypes message = 1;
......
......@@ -39,6 +39,7 @@ package protobuf_unittest;
option cc_enable_arenas = true;
option optimize_for = SPEED;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
// A message with message_set_wire_format.
message TestMessageSet {
......
......@@ -37,6 +37,8 @@ import "google/protobuf/unittest.proto";
package proto2_nofieldpresence_unittest;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
// This proto includes every type of field in both singular and repeated
// forms.
message TestAllTypes {
......
......@@ -40,6 +40,7 @@ import "google/protobuf/unittest.proto";
package protobuf_unittest;
option optimize_for = CODE_SIZE;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message TestOptimizedForSize {
optional int32 i = 1;
......
......@@ -32,6 +32,8 @@ syntax = "proto3";
package proto3_preserve_unknown_enum_unittest;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
enum MyEnum {
FOO = 0;
BAR = 1;
......
......@@ -32,6 +32,8 @@ syntax = "proto2";
package proto2_preserve_unknown_enum_unittest;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
enum MyEnum {
FOO = 0;
BAR = 1;
......
......@@ -36,6 +36,7 @@ syntax = "proto2";
package google.protobuf.util;
option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message DownRevision {
enum Enum {
......
......@@ -40,7 +40,7 @@ package google.protobuf;
option java_multiple_files = true;
option java_outer_classname = "WrappersProto";
option java_package = "com.google.protobuf";
option csharp_namespace = "Google.ProtocolBuffers";
// Wrapper message for double.
message DoubleValue {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment