Skip to content

Commit 0c20a33

Browse files
redsun82Copilot
andcommitted
Anchor linux_arm64 select key to the codeql repo
When `codeql_platform_select` builds its `select` from a macro invoked in another workspace (e.g. semmle-code consuming this repo as `@codeql`), a bare `//misc/bazel:linux_arm64` string key resolves against the consuming repo and fails with "no such package 'misc/bazel'". Use `Label(...)`, which resolves relative to this file's own repo, so the key always binds to `@codeql//misc/bazel:linux_arm64` regardless of the calling workspace. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c5c5b0bf-4afa-468c-b2dd-197d80932b4b
1 parent ba3fce1 commit 0c20a33

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

misc/bazel/os.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ def codeql_platform_select(
2323
def _or_otherwise(value):
2424
return value if value != None else otherwise
2525

26+
linux_arm64_setting = Label("//misc/bazel:linux_arm64")
2627
choices = {
27-
"//misc/bazel:linux_arm64": _or_otherwise(linux_arm64),
28+
linux_arm64_setting: _or_otherwise(linux_arm64),
2829
"@platforms//os:linux": _or_otherwise(linux64),
2930
"@platforms//os:macos": _or_otherwise(osx64),
3031
"@platforms//os:windows": _or_otherwise(win64),
@@ -40,7 +41,7 @@ def codeql_platform_select(
4041
return ctx.target_platform_has_constraint(getattr(ctx.attr, "_%s_constraint" % constraint)[platform_common.ConstraintValueInfo])
4142

4243
if has("linux"):
43-
result = choices["//misc/bazel:linux_arm64"] if has("arm64") else choices["@platforms//os:linux"]
44+
result = choices[linux_arm64_setting] if has("arm64") else choices["@platforms//os:linux"]
4445
elif has("macos"):
4546
result = choices["@platforms//os:macos"]
4647
elif has("windows"):

0 commit comments

Comments
 (0)