blob: 56d95d8c146249a06c57fd05315543b06cdeb55c [file] [log] [blame]
Paul Yang6b27c1f2017-03-17 11:08:06 -07001#!/usr/bin/env bash
2
Brian Wignalla104dff2020-01-08 13:18:20 -05003# Run this script to regenerate descriptor protos after the protocol compiler
Paul Yang6b27c1f2017-03-17 11:08:06 -07004# changes.
5
Joshua Habermanec4b1942020-10-05 22:27:56 -07006set -e
7
Mike Kruskal01c340d2022-09-19 09:50:19 -07008if [[ -z "${PROTOC}" ]]; then
Mike Kruskal0a480ad2023-02-27 15:36:10 -08009 PROTOC=$(pwd)/protoc
Mike Kruskal01c340d2022-09-19 09:50:19 -070010fi
Mike Kruskaled5c57a2022-08-10 22:51:29 -070011if [ ! -f $PROTOC ]; then
Mike Kruskalf0ef44d2023-02-02 15:53:04 -080012 ${BAZEL:-bazel} $BAZEL_STARTUP_FLAGS build -c opt //:protoc $BAZEL_FLAGS
Mike Kruskal0a480ad2023-02-27 15:36:10 -080013 PROTOC=$(pwd)/bazel-bin/protoc
Mike Kruskaled5c57a2022-08-10 22:51:29 -070014fi
15
Paul Yang6b27c1f2017-03-17 11:08:06 -070016if test ! -e src/google/protobuf/stubs/common.h; then
17 cat >&2 << __EOF__
18Could not find source code. Make sure you are running this script from the
19root of the distribution tree.
20__EOF__
21 exit 1
22fi
23
Mike Kruskal4c5454b2022-08-11 20:53:29 -070024pushd 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 Yang6b27c1f2017-03-17 11:08:06 -070037popd