Switch `toolchain_local_select#map` to a `label_keyed_string_dict`
bazelbuild/bazel#6fabb1f changed Bazel 7.4.0+ to not overfetch repository rule labels.
Switching toolchain_local_select#map
to a label_keyed_string_dict
is a breaking change but has few benefits:
- It correctly creates the dependencies between the
toolchain_local_select
and the repositories that should be selected - The internals of the rule do not have to do janky canonical label calculation
- It works with the isolation of
use_repo_rule
usage
Whilst a breaking change, this removes one of the warts in the module and increases the confidence to move to a stable 1.0.0
release.
The fix for downstream modules is simple: flip the key/value pairs. Usage such as:
toolchain_local_select(
name = "abc",
map = {
"arm64-linux-gnu": "@abc-arm64-linux-gnu",
"arm64-linux-musl": "@abc-arm64-linux-musl",
},
)
Would switch to:
toolchain_local_select(
name = "abc",
map = {
"@abc-arm64-linux-gnu", "arm64-linux-gnu" ,
"@abc-arm64-linux-musl", "arm64-linux-musl",
},
)
Edited by Matthew Clarkson