aboutsummaryrefslogtreecommitdiff
path: root/csharp/generate_protos.sh
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/generate_protos.sh')
-rwxr-xr-xcsharp/generate_protos.sh30
1 files changed, 11 insertions, 19 deletions
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh
index 0d217a9d..9899097d 100755
--- a/csharp/generate_protos.sh
+++ b/csharp/generate_protos.sh
@@ -3,16 +3,6 @@
# You first need to make sure protoc has been built (see instructions on
# building protoc in root of this repository)
-# This script performs a few fix-ups as part of generation. These are:
-# - descriptor.proto is renamed to descriptor_proto_file.proto before
-# generation, to avoid the naming collision between the class for the file
-# descriptor and its Descriptor property
-# - This change also impacts UnittestCustomOptions, which expects to
-# use a class of Descriptor when it's actually been renamed to
-# DescriptorProtoFile.
-# - Issue 307 (codegen for double-nested types) breaks Unittest.proto and
-# its lite equivalents.
-
set -ex
# cd to repository root
@@ -35,11 +25,10 @@ if [ -z "$PROTOC" ]; then
fi
fi
-# Descriptor proto
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf/Reflection \
- src/google/protobuf/descriptor.proto
-
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf/WellKnownTypes \
+# descriptor.proto and well-known types
+$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
+ --csharp_opt=base_namespace=Google.Protobuf \
+ src/google/protobuf/descriptor.proto \
src/google/protobuf/any.proto \
src/google/protobuf/api.proto \
src/google/protobuf/duration.proto \
@@ -51,20 +40,23 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf/WellKnownTypes \
src/google/protobuf/type.proto \
src/google/protobuf/wrappers.proto
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
+# Test protos where the namespace matches the target location
+$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \
+ --csharp_opt=base_namespace=Google.Protobuf \
src/google/protobuf/map_unittest_proto3.proto \
src/google/protobuf/unittest_proto3.proto \
src/google/protobuf/unittest_import_proto3.proto \
src/google/protobuf/unittest_import_public_proto3.proto \
src/google/protobuf/unittest_well_known_types.proto
-
-$PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
+# Different base namespace to the protos above
+$PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \
+ --csharp_opt=base_namespace=UnitTest.Issues \
csharp/protos/unittest_issues.proto
# AddressBook sample protos
$PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \
examples/addressbook.proto
-$PROTOC -Iconformance --csharp_out=csharp/src/Google.Protobuf.Conformance \
+$PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \
conformance/conformance.proto