aboutsummaryrefslogtreecommitdiff
path: root/csharp/generate_protos.sh
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@users.noreply.github.com>2015-05-18 17:13:50 -0700
committerJan Tattermusch <jtattermusch@users.noreply.github.com>2015-05-18 17:13:50 -0700
commita8b38c598d7f65b281a72809b28117afdb760931 (patch)
treefc31eb67324b17f5228ae344115eeb70389a1ff6 /csharp/generate_protos.sh
parent202f87f8de182b8d5d35c0ff0f833fcd90c7907c (diff)
parentb1a395ce07651d9a4658bec5aee5df777c85da0b (diff)
downloadprotobuf-a8b38c598d7f65b281a72809b28117afdb760931.tar.gz
protobuf-a8b38c598d7f65b281a72809b28117afdb760931.tar.bz2
protobuf-a8b38c598d7f65b281a72809b28117afdb760931.zip
Merge pull request #397 from jskeet/csharp
Generate *all* protos in the script, applying fixups.
Diffstat (limited to 'csharp/generate_protos.sh')
-rwxr-xr-xcsharp/generate_protos.sh27
1 files changed, 26 insertions, 1 deletions
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh
index 8c066cbe..9e89bf26 100755
--- a/csharp/generate_protos.sh
+++ b/csharp/generate_protos.sh
@@ -3,6 +3,16 @@
# 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
@@ -26,7 +36,12 @@ if [ -z "$PROTOC" ]; then
fi
# Descriptor proto
-#TODO(jtattermusch): generate descriptor.proto
+# TODO(jonskeet): Remove fixup
+cp src/google/protobuf/descriptor.proto src/google/protobuf/descriptor_proto_file.proto
+$PROTOC -Isrc --csharp_out=csharp/src/ProtocolBuffers/DescriptorProtos \
+ src/google/protobuf/descriptor_proto_file.proto
+rm src/google/protobuf/descriptor_proto_file.proto
+
# ProtocolBuffers.Test protos
$PROTOC -Isrc --csharp_out=csharp/src/ProtocolBuffers.Test/TestProtos \
@@ -63,6 +78,16 @@ $PROTOC -Icsharp/protos/extest --csharp_out=csharp/src/ProtocolBuffersLite.Test/
csharp/protos/extest/unittest_extras_full.proto \
csharp/protos/extest/unittest_extras_lite.proto
+# TODO(jonskeet): Remove fixup; see issue #307
+sed -i -e 's/RepeatedFieldsGenerator\.Group/RepeatedFieldsGenerator.Types.Group/g' \
+ csharp/src/ProtocolBuffers.Test/TestProtos/Unittest.cs \
+ csharp/src/ProtocolBuffersLite.Test/TestProtos/Unittest.cs \
+ csharp/src/ProtocolBuffersLite.Test/TestProtos/UnittestLite.cs
+
+# TODO(jonskeet): Remove fixup
+sed -i -e 's/DescriptorProtos\.Descriptor\./DescriptorProtos.DescriptorProtoFile./g' \
+ csharp/src/ProtocolBuffers.Test/TestProtos/UnittestCustomOptions.cs
+
# AddressBook sample protos
$PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \
examples/addressbook.proto