diff --git a/MODULE.bazel b/MODULE.bazel index 8c8e380a8a..95964ba46c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -13,6 +13,7 @@ bazel_dep(name = "bazel_skylib", version = "1.2.0") bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "rules_proto", version = "6.0.0") bazel_dep(name = "protobuf", version = "3.19.2", repo_name = "com_google_protobuf") +bazel_dep(name = "rules_shell", version = "0.3.0") go_sdk = use_extension("//go:extensions.bzl", "go_sdk") go_sdk.download( diff --git a/WORKSPACE b/WORKSPACE index 49dd99320c..862aad8419 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -245,6 +245,19 @@ load( apple_support_dependencies() +http_archive( + name = "rules_shell", + sha256 = "d8cd4a3a91fc1dc68d4c7d6b655f09def109f7186437e3f50a9b60ab436a0c53", + strip_prefix = "rules_shell-0.3.0", + url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.3.0/rules_shell-v0.3.0.tar.gz", +) + +load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains") + +rules_shell_dependencies() + +rules_shell_toolchains() + load("@googleapis//:repository_rules.bzl", "switched_rules_by_language") switched_rules_by_language( diff --git a/docs/doc_helpers.bzl b/docs/doc_helpers.bzl index a05bab28d7..7e7267256b 100644 --- a/docs/doc_helpers.bzl +++ b/docs/doc_helpers.bzl @@ -15,6 +15,7 @@ load("@bazel_skylib//rules:diff_test.bzl", "diff_test") load("@bazel_skylib//rules:write_file.bzl", "write_file") load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc") +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") def stardoc_with_diff_test( bzl_library_target, @@ -91,7 +92,7 @@ def update_docs( content = content, ) - native.sh_binary( + sh_binary( name = name, srcs = [update_script], data = data, diff --git a/go/private/repositories.bzl b/go/private/repositories.bzl index 28bc4ab4c5..dab89597f1 100644 --- a/go/private/repositories.bzl +++ b/go/private/repositories.bzl @@ -300,6 +300,14 @@ def go_rules_dependencies(force = False): name = "io_bazel_rules_go_bazel_features", ) + wrapper( + http_archive, + name = "rules_shell", + sha256 = "d8cd4a3a91fc1dc68d4c7d6b655f09def109f7186437e3f50a9b60ab436a0c53", + strip_prefix = "rules_shell-0.3.0", + url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.3.0/rules_shell-v0.3.0.tar.gz", + ) + def _maybe(repo_rule, name, **kwargs): if name not in native.existing_rules(): repo_rule(name = name, **kwargs) diff --git a/go/private/tools/files_equal_test.bzl b/go/private/tools/files_equal_test.bzl index 90377bf32f..0e71682912 100644 --- a/go/private/tools/files_equal_test.bzl +++ b/go/private/tools/files_equal_test.bzl @@ -15,6 +15,8 @@ """Tests that two files contain the same data.""" +load("@rules_shell//shell:sh_test.bzl", "sh_test") + def files_equal_test(name, golden, actual, error_message = None, **kwargs): # This genrule creates a Bash script: the source of the actual test. # The script: @@ -105,7 +107,7 @@ fi eof""", ) - native.sh_test( + sh_test( name = name, srcs = [name + "-src.sh"], data = [