Skip to content

Commit 03da4fc

Browse files
committed
Use --enable_platform_specific_config in .bazelrc.
This magically applies the `linux`, `macos` or `windows` configuration depending on the OS. Apart from simplifying things for us, this should hopefully also unbreak the RE2 build that Bazel folks run in their CI. Fixes #428. Change-Id: I2f4192dd728661558a8c4c4c8dd68a720af3ff71 Reviewed-on: https://code-review.googlesource.com/c/re2/+/61370 Reviewed-by: Perry Lorier <[email protected]> Reviewed-by: Paul Wankadia <[email protected]>
1 parent 63aeffa commit 03da4fc

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# `BAZEL_USE_CPP_ONLY_TOOLCHAIN` since Bazel wouldn't respect the former without
88
# the latter. However, the latter stopped Bazel from using Xcode and `-framework
99
# Foundation`, which CCTZ (vendored into Abseil) requires.
10+
build --enable_platform_specific_config
1011
build:linux --cxxopt=-std=c++14
1112
build:macos --cxxopt=-std=c++14
1213
build:windows --cxxopt=/std:c++14

.github/bazel.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/bin/bash
22
set -eux
33

4-
# macOS has GNU bash 3.x, so ${RUNNER_OS,,} isn't supported.
5-
config=--config=$(echo ${RUNNER_OS} | tr '[:upper:]' '[:lower:]')
6-
74
bazel clean
8-
bazel build ${config} --compilation_mode=dbg -- //:all
9-
bazel test ${config} --compilation_mode=dbg -- //:all \
5+
bazel build --compilation_mode=dbg -- //:all
6+
bazel test --compilation_mode=dbg -- //:all \
107
-//:dfa_test \
118
-//:exhaustive1_test \
129
-//:exhaustive2_test \
@@ -15,8 +12,8 @@ bazel test ${config} --compilation_mode=dbg -- //:all \
1512
-//:random_test
1613

1714
bazel clean
18-
bazel build ${config} --compilation_mode=opt -- //:all
19-
bazel test ${config} --compilation_mode=opt -- //:all \
15+
bazel build --compilation_mode=opt -- //:all
16+
bazel test --compilation_mode=opt -- //:all \
2017
-//:dfa_test \
2118
-//:exhaustive1_test \
2219
-//:exhaustive2_test \

app/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ else
2323
# Emscripten doesn't support `-fstack-protector`.
2424
AR=emar CC=emcc \
2525
${BAZEL} build --compilation_mode=opt \
26-
--config=linux --copt=-fno-stack-protector \
26+
--copt=-fno-stack-protector \
2727
-- :all
2828
# Bazel doesn't retain the `_re2.wasm` artifact;
2929
# we have to redo the link command to obtain it.

python/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
class BuildExt(setuptools.command.build_ext.build_ext):
4646

4747
def build_extension(self, ext):
48-
if 'RUNNER_OS' not in os.environ:
48+
if 'GITHUB_ACTIONS' not in os.environ:
4949
return super().build_extension(ext)
5050

5151
# For @pybind11_bazel's `python_configure()`.
@@ -55,7 +55,6 @@ def build_extension(self, ext):
5555
self.spawn(cmd)
5656

5757
cmd = ['bazel', 'build']
58-
cmd.append(f'--config={os.environ["RUNNER_OS"].lower()}')
5958
if 'BAZEL_CPU' in os.environ:
6059
cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
6160
cmd += ['--compilation_mode=opt', '--', ':all']

0 commit comments

Comments
 (0)