From 6ae1b0848e0f11fe75808c01d864689cf19d58eb Mon Sep 17 00:00:00 2001 From: Alex Eagle <4322804+ngiloq6@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:02:55 -0700 Subject: [PATCH] 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 --- features.bzl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/features.bzl b/features.bzl index fab9ca7..a868fda 100644 --- a/features.bzl +++ b/features.bzl @@ -16,6 +16,15 @@ _external_deps = struct( 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 @@ _toolchains = struct( bazel_features = struct( cc = _cc, external_deps = _external_deps, + flags = _flags, globals = globals, rules = _rules, toolchains = _toolchains,