Skip to content

Commit ba3fce1

Browse files
redsun82Copilot
andcommitted
Add posix convenience to os_select
`posix` sets the shared value for both `linux` and `macos`. It is mutually exclusive with either of them and fails if supplied together with `linux` or `macos`. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c5c5b0bf-4afa-468c-b2dd-197d80932b4b
1 parent b6e7464 commit ba3fce1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

misc/bazel/os.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,19 @@ def os_select(
5757
linux = None,
5858
windows = None,
5959
macos = None,
60+
posix = None,
6061
default = None):
6162
"""
6263
Choose a value based on the target OS, ignoring the architecture. This is a thin, OS-only wrapper
6364
around `codeql_platform_select` (Linux gets the same value on both x86_64 and arm64).
64-
See `codeql_platform_select` for macro vs rule usage.
65+
`posix` is a convenience for the value shared by `linux` and `macos`; it is mutually exclusive
66+
with both. See `codeql_platform_select` for macro vs rule usage.
6567
"""
68+
if posix != None:
69+
if linux != None or macos != None:
70+
fail("`posix` is mutually exclusive with `linux` and `macos`")
71+
linux = posix
72+
macos = posix
6673
return codeql_platform_select(
6774
ctx,
6875
linux64 = linux,

0 commit comments

Comments
 (0)