Use bazelisk as first choice for api.sh

api.sh should prefer bazelisk as first choice for running
bazel, falling back to the current bazel binary.

Change-Id: I047112b81ad90d2f6c00c6592ba856f2a7108b43
This commit is contained in:
Luca Milanesio
2019-10-16 13:45:13 +01:00
parent b7879ea14a
commit 001246b02a

View File

@@ -60,7 +60,13 @@ if [[ "${VERBOSE:-x}" != "x" ]]; then
set -o xtrace
fi
bazel build //tools/maven:gen_${command} "$@" || \
{ echo "bazel failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; }
if [[ `which bazelisk` ]]; then
BAZEL_CMD=bazelisk
else
BAZEL_CMD=bazel
fi
${BAZEL_CMD} build //tools/maven:gen_${command} "$@" || \
{ echo "${BAZEL_CMD} failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; }
./bazel-bin/tools/maven/${command}.sh