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: 686244006
pull/18769/head
Protobuf Team Bot 5 months ago committed by Copybara-Service
parent 96cce6249e
commit 8ec13ede1f
  1. 5
      MODULE.bazel
  2. 7
      build_defs/internal_shell.bzl
  3. 4
      conformance/defs.bzl
  4. 8
      protobuf_deps.bzl

@ -28,6 +28,11 @@ bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "zlib", version = "1.3.1")
bazel_dep(name = "bazel_features", version = "1.17.0", repo_name = "proto_bazel_features")
bazel_dep(
name = "rules_shell",
version = "0.2.0"
)
# Proto toolchains
register_toolchains("//bazel/private/toolchains:all")

@ -3,6 +3,9 @@ Internal tools to migrate shell commands to Bazel as an intermediate step
to wider Bazelification.
"""
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
def inline_sh_binary(
name,
srcs = [],
@ -41,7 +44,7 @@ def inline_sh_binary(
testonly = kwargs["testonly"] if "testonly" in kwargs else None,
)
native.sh_binary(
sh_binary(
name = name,
srcs = [name + "_genrule"],
data = srcs + tools + deps,
@ -86,7 +89,7 @@ def inline_sh_test(
testonly = kwargs["testonly"] if "testonly" in kwargs else None,
)
native.sh_test(
sh_test(
name = name,
srcs = [name + "_genrule"],
data = srcs + tools + deps,

@ -3,6 +3,8 @@
PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE.
"""
load("@rules_shell//shell:sh_test.bzl", "sh_test")
def conformance_test(
name,
testee,
@ -31,7 +33,7 @@ def conformance_test(
if maximum_edition:
args = args + ["--maximum_edition %s" % maximum_edition]
native.sh_test(
sh_test(
name = name,
srcs = ["//conformance:bazel_conformance_test_runner.sh"],
data = [testee] + failure_lists + [

@ -104,6 +104,14 @@ def protobuf_deps():
sha256 = "6f3ce0e9fba979a844faba2d60467843fbf5191d8ca61fa3d2ea17655b56bb8c",
)
if not native.existing_rule("rules_shell"):
http_archive(
name = "rules_shell",
sha256 = "410e8ff32e018b9efd2743507e7595c26e2628567c42224411ff533b57d27c28",
strip_prefix = "rules_shell-0.2.0",
url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.2.0/rules_shell-v0.2.0.tar.gz",
)
if not native.existing_rule("proto_bazel_features"):
proto_bazel_features(name = "proto_bazel_features")

Loading…
Cancel
Save