feat: expose a flag name for allow_unresolved_symlinks (#15)
* feat: expose a flag name for allow_unresolved_symlinks
Allows a principled solution for rules like rules_js that need to have starlark logic conditional on the value, without a breaking change in Bazel 7 as the flag has been renamed.
Unblocks aspect-build/rules_js#1102
Alternative to #14
* code review comments
* fix: be precise about which 7.0 release changes the flag name
diff --git a/features.bzl b/features.bzl
index fab9ca7..a868fda 100644
--- a/features.bzl
+++ b/features.bzl
@@ -16,6 +16,15 @@
is_bzlmod_enabled = str(Label("//:invalid")).startswith("@@"),
)
+_flags = struct(
+ # This flag was renamed in https://github.com/bazelbuild/bazel/pull/18313
+ allow_unresolved_symlinks = (
+ "allow_unresolved_symlinks"
+ if ge("7.0.0-pre.20230628.2")
+ else "experimental_allow_unresolved_symlinks"
+ )
+)
+
_rules = struct(
# Whether TemplateDict#add_joined allows the map_each callback to return a list of strings (#17306)
template_dict_map_each_can_return_list = ge("6.1.0"),
@@ -30,6 +39,7 @@
bazel_features = struct(
cc = _cc,
external_deps = _external_deps,
+ flags = _flags,
globals = globals,
rules = _rules,
toolchains = _toolchains,