Rename C# files to indicate generated code (#10801)

* Change C# generation script to use .pb.cs extension

* Rename generated C# files

This was performed by running generate_protos.sh and then removing the old files.

Notes:
- This does not change the conformance test generated C# code
- This does not change the compatibility C# code
- There's currently no clean-up operation in generate_protos.sh to remove old .pb.cs files (which would now be feasible)
- The changes to TestMessagesProto2.pb.cs are just due to formatting and a new Objective-C option

* Fix well-known type source files for C# Bazel build
pull/10821/head
Jon Skeet 2022-10-25 16:13:27 +01:00 committed by GitHub
parent 3b4fdac42a
commit 5c6c868588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 19 additions and 11 deletions

5
csharp/.gitignore vendored
View File

@ -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.*

View File

@ -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__"],
)

View File

@ -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