OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Generates C# source files from .proto files. | 2 # Generates C# source files from .proto files. |
3 # You first need to make sure protoc has been built (see instructions on | 3 # You first need to make sure protoc has been built (see instructions on |
4 # building protoc in root of this repository) | 4 # building protoc in root of this repository) |
5 | 5 |
6 # This script performs a few fix-ups as part of generation. These are: | |
7 # - descriptor.proto is renamed to descriptor_proto_file.proto before | |
8 # generation, to avoid the naming collision between the class for the file | |
9 # descriptor and its Descriptor property | |
10 # - This change also impacts UnittestCustomOptions, which expects to | |
11 # use a class of Descriptor when it's actually been renamed to | |
12 # DescriptorProtoFile. | |
13 # - Issue 307 (codegen for double-nested types) breaks Unittest.proto and | |
14 # its lite equivalents. | |
15 | |
16 set -ex | 6 set -ex |
17 | 7 |
18 # cd to repository root | 8 # cd to repository root |
19 cd $(dirname $0)/.. | 9 pushd $(dirname $0)/.. |
20 | 10 |
21 # Protocol buffer compiler to use. If the PROTOC variable is set, | 11 # Protocol buffer compiler to use. If the PROTOC variable is set, |
22 # use that. Otherwise, probe for expected locations under both | 12 # use that. Otherwise, probe for expected locations under both |
23 # Windows and Unix. | 13 # Windows and Unix. |
24 if [ -z "$PROTOC" ]; then | 14 if [ -z "$PROTOC" ]; then |
25 # TODO(jonskeet): Use an array and a for loop instead? | 15 # TODO(jonskeet): Use an array and a for loop instead? |
26 if [ -x cmake/build/Debug/protoc.exe ]; then | 16 if [ -x cmake/build/Debug/protoc.exe ]; then |
27 PROTOC=cmake/build/Debug/protoc.exe | 17 PROTOC=cmake/build/Debug/protoc.exe |
28 elif [ -x cmake/build/Release/protoc.exe ]; then | 18 elif [ -x cmake/build/Release/protoc.exe ]; then |
29 PROTOC=cmake/build/Release/protoc.exe | 19 PROTOC=cmake/build/Release/protoc.exe |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 51 |
62 # Different base namespace to the protos above | 52 # Different base namespace to the protos above |
63 $PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \ | 53 $PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \ |
64 --csharp_opt=base_namespace=UnitTest.Issues \ | 54 --csharp_opt=base_namespace=UnitTest.Issues \ |
65 csharp/protos/unittest_issues.proto | 55 csharp/protos/unittest_issues.proto |
66 | 56 |
67 # AddressBook sample protos | 57 # AddressBook sample protos |
68 $PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \ | 58 $PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \ |
69 examples/addressbook.proto | 59 examples/addressbook.proto |
70 | 60 |
71 $PROTOC -Iconformance --csharp_out=csharp/src/Google.Protobuf.Conformance \ | 61 $PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance
\ |
72 conformance/conformance.proto | 62 conformance/conformance.proto |
OLD | NEW |