diff --git a/WORKSPACE b/WORKSPACE index e69de29..b8d89d9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -0,0 +1,7 @@ +workspace(name = "rules_shell") + +load("//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains") + +rules_shell_dependencies() + +rules_shell_toolchains() diff --git a/shell/private/root_symlinks.bzl b/shell/private/root_symlinks.bzl index 44d1233..46f494a 100644 --- a/shell/private/root_symlinks.bzl +++ b/shell/private/root_symlinks.bzl @@ -14,6 +14,11 @@ """Helper rule to preserve the legacy runfiles path for the runfiles lib.""" +# Requires the private skip_conflict_checking parameter on ctx.runfiles, which +# is only available as of Bazel 7, which also the version in which `attr` +# objects started to have value equality. +ROOT_SYMLINKS_SUPPORTED = attr.string() == attr.string() + def _single_file_or_fail(target): files = target[DefaultInfo].files.to_list() if len(files) != 1: diff --git a/shell/runfiles/BUILD b/shell/runfiles/BUILD index 417af06..fb86e50 100644 --- a/shell/runfiles/BUILD +++ b/shell/runfiles/BUILD @@ -1,15 +1,22 @@ load("//shell:sh_library.bzl", "sh_library") -load("//shell/private:root_symlinks.bzl", "root_symlinks") +load("//shell/private:root_symlinks.bzl", "ROOT_SYMLINKS_SUPPORTED", "root_symlinks") -sh_library( +alias( name = "runfiles", - data = [":runfiles_at_legacy_location"], + actual = ":runfiles_impl" if ROOT_SYMLINKS_SUPPORTED else "@bazel_tools//tools/bash/runfiles", visibility = ["//visibility:public"], ) +sh_library( + name = "runfiles_impl", + data = [":runfiles_at_legacy_location"], + tags = ["manual"], +) + root_symlinks( name = "runfiles_at_legacy_location", root_symlinks = { "runfiles.bash": "bazel_tools/tools/bash/runfiles/runfiles.bash", }, + tags = ["manual"], )