Skip to content

Commit 5c6c868

Browse files
authored
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
1 parent 3b4fdac commit 5c6c868

33 files changed

+19
-11
lines changed

csharp/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ lib/protoc.exe
3333

3434
# Benchmark output
3535
BenchmarkDotNet.Artifacts/
36+
37+
# Reinstate generated code for test files
38+
!any_test.pb.*
39+
!map*unittest.pb.*
40+
!unittest*.pb.*

csharp/BUILD.bazel

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ filegroup(
4545
filegroup(
4646
name = "wkt_cs_srcs",
4747
srcs = [
48-
"src/Google.Protobuf/Reflection/Descriptor.cs",
49-
"src/Google.Protobuf/WellKnownTypes/Any.cs",
50-
"src/Google.Protobuf/WellKnownTypes/Api.cs",
51-
"src/Google.Protobuf/WellKnownTypes/Duration.cs",
52-
"src/Google.Protobuf/WellKnownTypes/Empty.cs",
53-
"src/Google.Protobuf/WellKnownTypes/FieldMask.cs",
54-
"src/Google.Protobuf/WellKnownTypes/SourceContext.cs",
55-
"src/Google.Protobuf/WellKnownTypes/Struct.cs",
56-
"src/Google.Protobuf/WellKnownTypes/Timestamp.cs",
57-
"src/Google.Protobuf/WellKnownTypes/Type.cs",
58-
"src/Google.Protobuf/WellKnownTypes/Wrappers.cs",
48+
"src/Google.Protobuf/Reflection/Descriptor.pb.cs",
49+
"src/Google.Protobuf/WellKnownTypes/Any.pb.cs",
50+
"src/Google.Protobuf/WellKnownTypes/Api.pb.cs",
51+
"src/Google.Protobuf/WellKnownTypes/Duration.pb.cs",
52+
"src/Google.Protobuf/WellKnownTypes/Empty.pb.cs",
53+
"src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs",
54+
"src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs",
55+
"src/Google.Protobuf/WellKnownTypes/Struct.pb.cs",
56+
"src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs",
57+
"src/Google.Protobuf/WellKnownTypes/Type.pb.cs",
58+
"src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs",
5959
],
6060
visibility = ["//src/google/protobuf/compiler/csharp:__pkg__"],
6161
)

csharp/generate_protos.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fi
3232
# descriptor.proto and well-known types
3333
$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
3434
--csharp_opt=base_namespace=Google.Protobuf \
35+
--csharp_opt=file_extension=.pb.cs \
3536
src/google/protobuf/descriptor.proto \
3637
src/google/protobuf/any.proto \
3738
src/google/protobuf/api.proto \
@@ -52,6 +53,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
5253
$PROTOC -Isrc -Icsharp/protos \
5354
--experimental_allow_proto3_optional \
5455
--csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \
56+
--csharp_opt=file_extension=.pb.cs \
5557
--descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \
5658
--include_source_info \
5759
--include_imports \
@@ -75,4 +77,5 @@ $PROTOC -Isrc -Icsharp/protos \
7577

7678
# AddressBook sample protos
7779
$PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \
80+
--csharp_opt=file_extension=.pb.cs \
7881
examples/addressbook.proto

0 commit comments

Comments
 (0)