diff --git a/csharp/.gitignore b/csharp/.gitignore index 62c96383ce..56ac1494d6 100644 --- a/csharp/.gitignore +++ b/csharp/.gitignore @@ -33,3 +33,8 @@ lib/protoc.exe # Benchmark output BenchmarkDotNet.Artifacts/ + +# Reinstate generated code for test files +!any_test.pb.* +!map*unittest.pb.* +!unittest*.pb.* diff --git a/csharp/BUILD.bazel b/csharp/BUILD.bazel index 9f9e83a511..23fbe411f9 100644 --- a/csharp/BUILD.bazel +++ b/csharp/BUILD.bazel @@ -45,17 +45,17 @@ filegroup( filegroup( name = "wkt_cs_srcs", srcs = [ - "src/Google.Protobuf/Reflection/Descriptor.cs", - "src/Google.Protobuf/WellKnownTypes/Any.cs", - "src/Google.Protobuf/WellKnownTypes/Api.cs", - "src/Google.Protobuf/WellKnownTypes/Duration.cs", - "src/Google.Protobuf/WellKnownTypes/Empty.cs", - "src/Google.Protobuf/WellKnownTypes/FieldMask.cs", - "src/Google.Protobuf/WellKnownTypes/SourceContext.cs", - "src/Google.Protobuf/WellKnownTypes/Struct.cs", - "src/Google.Protobuf/WellKnownTypes/Timestamp.cs", - "src/Google.Protobuf/WellKnownTypes/Type.cs", - "src/Google.Protobuf/WellKnownTypes/Wrappers.cs", + "src/Google.Protobuf/Reflection/Descriptor.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Any.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Api.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Duration.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Empty.pb.cs", + "src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs", + "src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Struct.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Type.pb.cs", + "src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs", ], visibility = ["//src/google/protobuf/compiler/csharp:__pkg__"], ) diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index cfd6082708..8be4428405 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -32,6 +32,7 @@ fi # descriptor.proto and well-known types $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \ --csharp_opt=base_namespace=Google.Protobuf \ + --csharp_opt=file_extension=.pb.cs \ src/google/protobuf/descriptor.proto \ src/google/protobuf/any.proto \ src/google/protobuf/api.proto \ @@ -52,6 +53,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \ $PROTOC -Isrc -Icsharp/protos \ --experimental_allow_proto3_optional \ --csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \ + --csharp_opt=file_extension=.pb.cs \ --descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \ --include_source_info \ --include_imports \ @@ -75,4 +77,5 @@ $PROTOC -Isrc -Icsharp/protos \ # AddressBook sample protos $PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \ + --csharp_opt=file_extension=.pb.cs \ examples/addressbook.proto diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.pb.cs similarity index 100% rename from csharp/src/AddressBook/Addressbook.cs rename to csharp/src/AddressBook/Addressbook.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs b/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/Unittest.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.pb.cs diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs diff --git a/csharp/src/Google.Protobuf/Compiler/Plugin.cs b/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/Compiler/Plugin.cs rename to csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/Reflection/Descriptor.cs rename to csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Any.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Any.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Api.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Duration.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Empty.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Struct.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Type.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Type.pb.cs diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs similarity index 100% rename from csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs rename to csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs