Skip to content

Commit 1822c8a

Browse files
protobuf-github-botcomius
authored andcommitted
Load Shell rules everywhere in protobuf
Autoloads don't work in repositories where they load from. Protobuf thus needs to have Shell loads. PiperOrigin-RevId: 684493665
1 parent a18f0de commit 1822c8a

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

MODULE.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ bazel_dep(
8484
repo_name = "proto_bazel_features",
8585
)
8686

87+
bazel_dep(
88+
name = "rules_shell",
89+
version = "0.2.0"
90+
)
91+
8792
# Proto toolchains
8893
register_toolchains("//bazel/private/toolchains:all")
8994

build_defs/internal_shell.bzl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Internal tools to migrate shell commands to Bazel as an intermediate step
33
to wider Bazelification.
44
"""
55

6+
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
7+
load("@rules_shell//shell:sh_test.bzl", "sh_test")
8+
69
def inline_sh_binary(
710
name,
811
srcs = [],
@@ -41,7 +44,7 @@ def inline_sh_binary(
4144
testonly = kwargs["testonly"] if "testonly" in kwargs else None,
4245
)
4346

44-
native.sh_binary(
47+
sh_binary(
4548
name = name,
4649
srcs = [name + "_genrule"],
4750
data = srcs + tools + deps,
@@ -86,7 +89,7 @@ def inline_sh_test(
8689
testonly = kwargs["testonly"] if "testonly" in kwargs else None,
8790
)
8891

89-
native.sh_test(
92+
sh_test(
9093
name = name,
9194
srcs = [name + "_genrule"],
9295
data = srcs + tools + deps,

conformance/defs.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE.
44
"""
55

6+
load("@rules_shell//shell:sh_test.bzl", "sh_test")
7+
68
def conformance_test(
79
name,
810
testee,
@@ -31,7 +33,7 @@ def conformance_test(
3133
if maximum_edition:
3234
args = args + ["--maximum_edition %s" % maximum_edition]
3335

34-
native.sh_test(
36+
sh_test(
3537
name = name,
3638
srcs = ["//conformance:bazel_conformance_test_runner.sh"],
3739
data = [testee] + failure_lists + [

protobuf_deps.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ def protobuf_deps():
104104
sha256 = "6f3ce0e9fba979a844faba2d60467843fbf5191d8ca61fa3d2ea17655b56bb8c",
105105
)
106106

107+
if not native.existing_rule("rules_shell"):
108+
http_archive(
109+
name = "rules_shell",
110+
sha256 = "410e8ff32e018b9efd2743507e7595c26e2628567c42224411ff533b57d27c28",
111+
strip_prefix = "rules_shell-0.2.0",
112+
url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.2.0/rules_shell-v0.2.0.tar.gz",
113+
)
114+
107115
if not native.existing_rule("proto_bazel_features"):
108116
proto_bazel_features(name = "proto_bazel_features")
109117

0 commit comments

Comments
 (0)