mirror of
https://github.com/github/codeql.git
synced 2026-07-30 07:04:57 +02:00
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
This commit is contained in:
@@ -19,11 +19,15 @@ def codeql_platform_select(
|
||||
This works both in a macro context (`ctx = None`, returning a `select`) and in a rule context
|
||||
(passing `ctx`, which then needs `OS_DETECTION_ATTRS` on the rule attributes).
|
||||
"""
|
||||
|
||||
def _or_otherwise(value):
|
||||
return value if value != None else otherwise
|
||||
|
||||
choices = {
|
||||
"//misc/bazel:linux_arm64": linux_arm64 or otherwise,
|
||||
"@platforms//os:linux": linux64 or otherwise,
|
||||
"@platforms//os:macos": osx64 or otherwise,
|
||||
"@platforms//os:windows": win64 or otherwise,
|
||||
"//misc/bazel:linux_arm64": _or_otherwise(linux_arm64),
|
||||
"@platforms//os:linux": _or_otherwise(linux64),
|
||||
"@platforms//os:macos": _or_otherwise(osx64),
|
||||
"@platforms//os:windows": _or_otherwise(win64),
|
||||
}
|
||||
if not ctx:
|
||||
return select({
|
||||
|
||||
@@ -464,12 +464,12 @@ def codeql_pack(
|
||||
`zips` is a map from `.zip` files to prefixes to import.
|
||||
The distinction between arch-specific and common contents is made based on whether the paths (including possible
|
||||
prefixes added by rules) contain the special `{CODEQL_PLATFORM}` placeholder, which in case it is present will also
|
||||
be replaced by the appropriate platform (`linux64`, `win64` or `osx64`).
|
||||
be replaced by the appropriate platform (`linux64`, `linux-arm64`, `win64` or `osx64`).
|
||||
Specific file paths can be placed in the arch-specific package by adding them to `arch_overrides`, even if their
|
||||
path doesn't contain the `CODEQL_PLATFORM` placeholder.
|
||||
|
||||
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.
|
||||
This placeholder will be replaced by the appropriate platform (`linux64`, `win64` or `osx64`).
|
||||
This placeholder will be replaced by the appropriate platform (`linux64`, `linux-arm64`, `win64` or `osx64`).
|
||||
`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
|
||||
contain the `{CODEQL_PLATFORM}` marker.
|
||||
All files in the pack will be prefixed with `name`, unless `pack_prefix` is set, then is used instead.
|
||||
|
||||
Reference in New Issue
Block a user