From 6e00b6b2f57ec0d0c8686afc2b5ed5e78a0ec03d Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 10 Feb 2023 10:28:12 -0800 Subject: [PATCH] Skip bazel build in objectivec/generate_well_known_types.sh. Every where the script is invoked from protoc is already built, and this more follows the model used by similar scripts for other languages. PiperOrigin-RevId: 508694936 --- objectivec/DevTools/full_mac_build.sh | 2 +- objectivec/generate_well_known_types.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh index d091a95088..84b0aab2ce 100755 --- a/objectivec/DevTools/full_mac_build.sh +++ b/objectivec/DevTools/full_mac_build.sh @@ -204,7 +204,7 @@ else fi # Ensure the WKT sources checked in are current. -time objectivec/generate_well_known_types.sh --check-only $BazelFlags +objectivec/generate_well_known_types.sh --check-only header "Checking on the ObjC Runtime Code" # Some of the kokoro machines don't have python3 yet, so fall back to python if need be. diff --git a/objectivec/generate_well_known_types.sh b/objectivec/generate_well_known_types.sh index 7e23a99d10..4b77412056 100755 --- a/objectivec/generate_well_known_types.sh +++ b/objectivec/generate_well_known_types.sh @@ -9,8 +9,7 @@ readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") readonly ObjCDir="${ScriptDir}" readonly ProtoRootDir="${ObjCDir}/.." -# Invoke with BAZEL=bazelisk to use that instead. -readonly BazelBin="${BAZEL:-bazel} ${BAZEL_STARTUP_FLAGS:-}" +cd "${ProtoRootDir}" # Flag for continuous integration to check that everything is current. CHECK_ONLY=0 @@ -19,7 +18,11 @@ if [[ $# -ge 1 && ( "$1" == "--check-only" ) ]] ; then shift fi -cd "${ProtoRootDir}" +readonly PROTOC_PATH="${PROTOC:-${ProtoRootDir}/bazel-bin/protoc}" +if [[ ! -x "${PROTOC_PATH}" ]] ; then + echo "Failed to find executable protoc: ${PROTOC_PATH}" + exit 1 +fi if [[ ! -e src/google/protobuf/stubs/common.h ]]; then cat >&2 << __EOF__ @@ -29,9 +32,6 @@ __EOF__ exit 1 fi -# Make sure the compiler is current. -${BazelBin} build //:protoc $@ - cd src declare -a RUNTIME_PROTO_FILES=( \ google/protobuf/any.proto \ @@ -50,7 +50,7 @@ declare -a OBJC_EXTENSIONS=( .pbobjc.h .pbobjc.m ) # Generate to a temp directory to see if they match. TMP_DIR=$(mktemp -d) trap "rm -rf ${TMP_DIR}" EXIT -${ProtoRootDir}/bazel-bin/protoc --objc_out="${TMP_DIR}" ${RUNTIME_PROTO_FILES[@]} +"${PROTOC_PATH}" --objc_out="${TMP_DIR}" ${RUNTIME_PROTO_FILES[@]} DID_COPY=0 for PROTO_FILE in "${RUNTIME_PROTO_FILES[@]}"; do