Skip to content

Commit

Permalink
Try to get things working again with Bazel 7.
Browse files Browse the repository at this point in the history
Specifically, try passing `--platforms` as well as `--cpu`.
(The latter is going away eventually, but keep it for now.)

Change-Id: Id53ba7b91008c7b90b1e9d242a3eded3e65007b8
Reviewed-on: https://code-review.googlesource.com/c/re2/+/62370
Reviewed-by: Paul Wankadia <[email protected]>
Reviewed-by: Alex Chernyakhovsky <[email protected]>
  • Loading branch information
junyer committed Jan 16, 2024
1 parent 32c181e commit c644d9a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,39 @@ py_test(
"@abseil-py//absl/testing:parameterized",
],
)

# These are implementation details for `setup.py`, so they can be
# named however we want. For now, they are named to be consistent
# with the `--cpu` flag values that they will eventually replace.

platform(
name = "darwin_x86_64",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:macos",
],
)

platform(
name = "darwin_arm64",
constraint_values = [
"@platforms//cpu:arm64",
"@platforms//os:macos",
],
)

platform(
name = "x64_x86_windows",
constraint_values = [
"@platforms//cpu:x86_32",
"@platforms//os:windows",
],
)

platform(
name = "x64_windows",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
],
)
1 change: 1 addition & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def build_extension(self, ext):
cmd = ['bazel', 'build']
try:
cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
cmd.append(f'--platforms=//python:{os.environ["BAZEL_CPU"].lower()}')
except KeyError:
pass
cmd += ['--compilation_mode=opt', '--', ':all']
Expand Down

0 comments on commit c644d9a

Please sign in to comment.