Skip to content

Commit b6e7464

Browse files
redsun82Copilot
andcommitted
Address review: linux-arm64 docs + None-vs-falsey fallback
- codeql_pack docstring: include `linux-arm64` in the exhaustive list of values the `{CODEQL_PLATFORM}` placeholder expands to (both mentions). - codeql_platform_select: only fall back to `otherwise` on `None`, not on any falsey value, via a small `_or_otherwise` helper, matching the documented `None` defaults. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c5c5b0bf-4afa-468c-b2dd-197d80932b4b
1 parent d0b6e96 commit b6e7464

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

misc/bazel/os.bzl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ def codeql_platform_select(
1919
This works both in a macro context (`ctx = None`, returning a `select`) and in a rule context
2020
(passing `ctx`, which then needs `OS_DETECTION_ATTRS` on the rule attributes).
2121
"""
22+
23+
def _or_otherwise(value):
24+
return value if value != None else otherwise
25+
2226
choices = {
23-
"//misc/bazel:linux_arm64": linux_arm64 or otherwise,
24-
"@platforms//os:linux": linux64 or otherwise,
25-
"@platforms//os:macos": osx64 or otherwise,
26-
"@platforms//os:windows": win64 or otherwise,
27+
"//misc/bazel:linux_arm64": _or_otherwise(linux_arm64),
28+
"@platforms//os:linux": _or_otherwise(linux64),
29+
"@platforms//os:macos": _or_otherwise(osx64),
30+
"@platforms//os:windows": _or_otherwise(win64),
2731
}
2832
if not ctx:
2933
return select({

misc/bazel/pkg.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,12 @@ def codeql_pack(
464464
`zips` is a map from `.zip` files to prefixes to import.
465465
The distinction between arch-specific and common contents is made based on whether the paths (including possible
466466
prefixes added by rules) contain the special `{CODEQL_PLATFORM}` placeholder, which in case it is present will also
467-
be replaced by the appropriate platform (`linux64`, `win64` or `osx64`).
467+
be replaced by the appropriate platform (`linux64`, `linux-arm64`, `win64` or `osx64`).
468468
Specific file paths can be placed in the arch-specific package by adding them to `arch_overrides`, even if their
469469
path doesn't contain the `CODEQL_PLATFORM` placeholder.
470470
471471
The codeql pack rules will expand the `{CODEQL_PLATFORM}` marker in paths, and use that to split the files into a common and an arch-specific part.
472-
This placeholder will be replaced by the appropriate platform (`linux64`, `win64` or `osx64`).
472+
This placeholder will be replaced by the appropriate platform (`linux64`, `linux-arm64`, `win64` or `osx64`).
473473
`arch_overrides` is a list of files that should be included in the arch-specific bits of the pack, even if their path doesn't
474474
contain the `{CODEQL_PLATFORM}` marker.
475475
All files in the pack will be prefixed with `name`, unless `pack_prefix` is set, then is used instead.

0 commit comments

Comments
 (0)