From b6e7464da20bbb8b5d0c60cf993ff79f7bebeae2 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 29 Jul 2026 14:25:13 +0200 Subject: [PATCH] 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 --- misc/bazel/os.bzl | 12 ++++++++---- misc/bazel/pkg.bzl | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/misc/bazel/os.bzl b/misc/bazel/os.bzl index f8e5c13cfe1..a3fee479dbc 100644 --- a/misc/bazel/os.bzl +++ b/misc/bazel/os.bzl @@ -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({ diff --git a/misc/bazel/pkg.bzl b/misc/bazel/pkg.bzl index efec21e761f..684bcbb8c3b 100644 --- a/misc/bazel/pkg.bzl +++ b/misc/bazel/pkg.bzl @@ -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.