Paul Yang | 6b27c1f | 2017-03-17 11:08:06 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Brian Wignall | a104dff | 2020-01-08 13:18:20 -0500 | [diff] [blame] | 3 | # Run this script to regenerate descriptor protos after the protocol compiler |
Paul Yang | 6b27c1f | 2017-03-17 11:08:06 -0700 | [diff] [blame] | 4 | # changes. |
| 5 | |
Joshua Haberman | ec4b194 | 2020-10-05 22:27:56 -0700 | [diff] [blame] | 6 | set -e |
| 7 | |
Mike Kruskal | 01c340d | 2022-09-19 09:50:19 -0700 | [diff] [blame] | 8 | if [[ -z "${PROTOC}" ]]; then |
Mike Kruskal | 0a480ad | 2023-02-27 15:36:10 -0800 | [diff] [blame] | 9 | PROTOC=$(pwd)/protoc |
Mike Kruskal | 01c340d | 2022-09-19 09:50:19 -0700 | [diff] [blame] | 10 | fi |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 11 | if [ ! -f $PROTOC ]; then |
Mike Kruskal | f0ef44d | 2023-02-02 15:53:04 -0800 | [diff] [blame] | 12 | ${BAZEL:-bazel} $BAZEL_STARTUP_FLAGS build -c opt //:protoc $BAZEL_FLAGS |
Mike Kruskal | 0a480ad | 2023-02-27 15:36:10 -0800 | [diff] [blame] | 13 | PROTOC=$(pwd)/bazel-bin/protoc |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 14 | fi |
| 15 | |
Paul Yang | 6b27c1f | 2017-03-17 11:08:06 -0700 | [diff] [blame] | 16 | if test ! -e src/google/protobuf/stubs/common.h; then |
| 17 | cat >&2 << __EOF__ |
| 18 | Could not find source code. Make sure you are running this script from the |
| 19 | root of the distribution tree. |
| 20 | __EOF__ |
| 21 | exit 1 |
| 22 | fi |
| 23 | |
Mike Kruskal | 4c5454b | 2022-08-11 20:53:29 -0700 | [diff] [blame] | 24 | pushd src |
| 25 | $PROTOC --php_out=internal:../php/src google/protobuf/descriptor.proto |
| 26 | $PROTOC --php_out=internal_generate_c_wkt:../php/src \ |
| 27 | google/protobuf/any.proto \ |
| 28 | google/protobuf/api.proto \ |
| 29 | google/protobuf/duration.proto \ |
| 30 | google/protobuf/empty.proto \ |
| 31 | google/protobuf/field_mask.proto \ |
| 32 | google/protobuf/source_context.proto \ |
| 33 | google/protobuf/struct.proto \ |
| 34 | google/protobuf/type.proto \ |
| 35 | google/protobuf/timestamp.proto \ |
| 36 | google/protobuf/wrappers.proto |
Paul Yang | 6b27c1f | 2017-03-17 11:08:06 -0700 | [diff] [blame] | 37 | popd |