diff options
author | Dan O'Reilly <oreilldf@gmail.com> | 2015-08-12 23:57:46 -0400 |
---|---|---|
committer | Dan O'Reilly <oreilldf@gmail.com> | 2015-08-12 23:57:46 -0400 |
commit | e47cdd5a559f488ba52756927ce68f4cf93874fa (patch) | |
tree | 8ce2723e822808baf58e96f569c86035717ea351 /csharp/generate_protos.sh | |
parent | daeaa6a28b81195f24d89222e649d79c9555af8b (diff) | |
parent | 38a56ee4b19d72c2e9d81a08b018704d1addf561 (diff) | |
download | protobuf-e47cdd5a559f488ba52756927ce68f4cf93874fa.tar.gz protobuf-e47cdd5a559f488ba52756927ce68f4cf93874fa.tar.bz2 protobuf-e47cdd5a559f488ba52756927ce68f4cf93874fa.zip |
Merge remote-tracking branch 'upstream/master' into py2_py3_straddle
Conflicts:
python/google/protobuf/descriptor_pool.py
python/google/protobuf/internal/api_implementation_default_test.py
python/google/protobuf/internal/cpp_message.py
python/google/protobuf/internal/descriptor_database_test.py
python/google/protobuf/internal/descriptor_pool_test.py
python/google/protobuf/internal/descriptor_python_test.py
python/google/protobuf/internal/descriptor_test.py
python/google/protobuf/internal/generator_test.py
python/google/protobuf/internal/message_factory_python_test.py
python/google/protobuf/internal/message_factory_test.py
python/google/protobuf/internal/message_test.py
python/google/protobuf/internal/proto_builder_test.py
python/google/protobuf/internal/python_message.py
python/google/protobuf/internal/reflection_test.py
python/google/protobuf/internal/service_reflection_test.py
python/google/protobuf/internal/symbol_database_test.py
python/google/protobuf/internal/text_encoding_test.py
python/google/protobuf/internal/text_format_test.py
python/google/protobuf/internal/unknown_fields_test.py
python/google/protobuf/internal/wire_format_test.py
python/google/protobuf/pyext/descriptor_cpp2_test.py
python/google/protobuf/pyext/message_factory_cpp2_test.py
python/google/protobuf/pyext/reflection_cpp2_generated_test.py
python/setup.py
ruby/lib/google/protobuf/message_exts.rb
Diffstat (limited to 'csharp/generate_protos.sh')
-rwxr-xr-x | csharp/generate_protos.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh new file mode 100755 index 00000000..962f2a9c --- /dev/null +++ b/csharp/generate_protos.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# Generates C# source files from .proto files. +# 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 +cd $(dirname $0)/.. + +# Protocol buffer compiler to use. If the PROTOC variable is set, +# use that. Otherwise, probe for expected locations under both +# Windows and Unix. +if [ -z "$PROTOC" ]; then + # TODO(jonskeet): Use an array and a for loop instead? + if [ -x cmake/build/Debug/protoc.exe ]; then + PROTOC=cmake/build/Debug/protoc.exe + elif [ -x cmake/build/Release/protoc.exe ]; then + PROTOC=cmake/build/Release/protoc.exe + elif [ -x src/protoc ]; then + PROTOC=src/protoc + else + echo "Unable to find protocol buffer compiler." + exit 1 + fi +fi + +# 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/Google.Protobuf/Reflection \ + src/google/protobuf/descriptor_proto_file.proto +rm src/google/protobuf/descriptor_proto_file.proto + +$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf/WellKnownTypes \ + src/google/protobuf/any.proto \ + src/google/protobuf/api.proto \ + src/google/protobuf/duration.proto \ + src/google/protobuf/empty.proto \ + src/google/protobuf/field_mask.proto \ + src/google/protobuf/source_context.proto \ + src/google/protobuf/struct.proto \ + src/google/protobuf/timestamp.proto \ + src/google/protobuf/type.proto \ + src/google/protobuf/wrappers.proto + +$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \ + 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 \ + 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 \ + conformance/conformance.proto |