diff --git a/BUILD.bazel b/BUILD.bazel index e69de29..7b767e5 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -0,0 +1,5 @@ +# Alias the target since the globals repo isn't visible to dependent workspaces. +alias( + name = "allow_unresolved_symlinks", + actual = "@bazel_features_globals//:allow_unresolved_symlinks", +) diff --git a/private/globals_repo.bzl b/private/globals_repo.bzl index 08c8db4..05cfd87 100644 --- a/private/globals_repo.bzl +++ b/private/globals_repo.bzl @@ -1,10 +1,29 @@ load("//private:parse.bzl", "parse_version") def _globals_repo_impl(rctx): - rctx.file("BUILD.bazel") - bazel_version = parse_version(native.bazel_version) + allow_unresolved_symlinks_flag = ( + "experimental_allow_unresolved_symlinks" + if bazel_version < parse_version("7.0.0") + else "allow_unresolved_symlinks" + ) + + rctx.file("BUILD.bazel", """\ +# @generated by bazel_features/private/globals_repo.bzl + +# Allow rules to sense the value of this flag, which was renamed. +config_setting( + name = "allow_unresolved_symlinks", + values = {allow_unresolved_symlinks}, + visibility = ["//visibility:public"], +) +""".format( + allow_unresolved_symlinks = { + allow_unresolved_symlinks_flag: "true" + }, +)) + lines = ["globals = struct("] for global_, version in rctx.attr.globals.items(): if not _is_valid_identifier(global_):