Skip to content

Commit

Permalink
Explicitly invoke Bazelisk rather than Bazel.
Browse files Browse the repository at this point in the history
Change-Id: Ic2fe3c5565bf798173f6f2edae2e4edfffc9a9b5
Reviewed-on: https://code-review.googlesource.com/c/re2/+/61591
Reviewed-by: Perry Lorier <[email protected]>
Reviewed-by: Paul Wankadia <[email protected]>
  • Loading branch information
junyer committed Jul 28, 2023
1 parent a61ae46 commit 8ad66d6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .github/bazel.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash
set -eux

bazel clean
bazel build --compilation_mode=dbg -- //:all
bazel test --compilation_mode=dbg -- //:all \
bazelisk clean
bazelisk build --compilation_mode=dbg -- //:all
bazelisk test --compilation_mode=dbg -- //:all \
-//:dfa_test \
-//:exhaustive1_test \
-//:exhaustive2_test \
-//:exhaustive3_test \
-//:exhaustive_test \
-//:random_test

bazel clean
bazel build --compilation_mode=opt -- //:all
bazel test --compilation_mode=opt -- //:all \
bazelisk clean
bazelisk build --compilation_mode=opt -- //:all
bazelisk test --compilation_mode=opt -- //:all \
-//:dfa_test \
-//:exhaustive1_test \
-//:exhaustive2_test \
Expand Down
12 changes: 6 additions & 6 deletions app/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -eux
SRCDIR=$(readlink --canonicalize $(dirname $0))
DSTDIR=$(mktemp --directory --tmpdir $(basename $0).XXXXXXXXXX)

BAZEL=/tmp/bazel
BAZELISK_RELEASE=v1.16.0
BAZELISK=/tmp/bazelisk
BAZELISK_RELEASE=v1.17.0

if [[ ${UID} -ne 0 ]]; then
if [[ -d deploy ]]; then
Expand All @@ -16,18 +16,18 @@ if [[ ${UID} -ne 0 ]]; then
sudo docker run -i -t --pull always --rm -v ${SRCDIR}/..:/src -v ${PWD}:/dst emscripten/emsdk /src/app/$(basename $0)
ls -l deploy
else
wget -O ${BAZEL} https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_RELEASE}/bazelisk-linux-amd64
chmod +x ${BAZEL}
wget -O ${BAZELISK} https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_RELEASE}/bazelisk-linux-amd64
chmod +x ${BAZELISK}

cd ${SRCDIR}
# Emscripten doesn't support `-fstack-protector`.
AR=emar CC=emcc \
${BAZEL} build --compilation_mode=opt \
${BAZELISK} build --compilation_mode=opt \
--copt=-fno-stack-protector \
-- :all
cp ../bazel-bin/app/_re2.js ${DSTDIR}
# Clean up the sundry Bazel output directories.
${BAZEL} clean --expunge
${BAZELISK} clean --expunge
cp app.ts index.html _re2.d.ts ${DSTDIR}
cp package.json rollup.config.js tsconfig.json ${DSTDIR}

Expand Down
4 changes: 2 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def build_extension(self, ext):
# For @pybind11_bazel's `python_configure()`.
os.environ['PYTHON_BIN_PATH'] = sys.executable

cmd = ['bazel', 'build']
cmd = ['bazelisk', 'build']
if 'BAZEL_CPU' in os.environ:
cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
cmd += ['--compilation_mode=opt', '--', ':all']
Expand All @@ -62,7 +62,7 @@ def build_extension(self, ext):
shutil.copyfile('../bazel-bin/python/_re2.so',
self.get_ext_fullpath(ext.name))

cmd = ['bazel', 'clean', '--expunge']
cmd = ['bazelisk', 'clean', '--expunge']
self.spawn(cmd)


Expand Down

0 comments on commit 8ad66d6

Please sign in to comment.