Skip to content

Commit

Permalink
Use rules_shell for shell targets
Browse files Browse the repository at this point in the history
  • Loading branch information
ted-xie committed Oct 18, 2024
1 parent b160ccd commit 723446f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bazel_dep(name = "protobuf", version = "3.19.6", repo_name = "com_google_protobu
bazel_dep(name = "rules_go", version = "0.50.1", repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_proto", version = "4.0.0")
bazel_dep(name = "rules_shell", version = "0.2.0")

go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")

Expand Down
13 changes: 13 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ http_archive(
],
)

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",
)

load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")

rules_shell_dependencies()

rules_shell_toolchains()

# Stardoc pulls in a lot of deps, which we need to declare here.
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")

Expand Down
5 changes: 4 additions & 1 deletion def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ load(
"@bazel_skylib//lib:shell.bzl",
"shell",
)
load("@rules_shell//shell:sh_binary.bzl",
"sh_binary"
)
load(
"//internal:gazelle_binary.bzl",
_gazelle_binary = "gazelle_binary_wrapper",
Expand Down Expand Up @@ -218,7 +221,7 @@ def gazelle(name, **kwargs):
tags_set = {t: "" for t in kwargs.pop("tags", [])}
tags_set["manual"] = ""
tags = tags_set.keys()
native.sh_binary(
sh_binary(
name = name,
tags = tags,
srcs = [runner_name],
Expand Down
1 change: 1 addition & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ the stardoc repository, which is not a dependency users should install.
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")

# gazelle:ignore
_DOC_SRCS = {
Expand Down
5 changes: 4 additions & 1 deletion tests/bzl_deps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ load(":bzl_test.bzl", "bzl_test")
bzl_test(
name = "def_bzl_test",
src = "do_nothing_macro.bzl",
deps = ["//:def"],
deps = [
"//:def",
"@rules_shell//shell:rules_bzl",
],
)
1 change: 1 addition & 0 deletions tests/cli/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load(":env_variables_test.bzl", "env_variables_test_suite")

env_variables_test_suite()
1 change: 1 addition & 0 deletions tests/visibility_attr/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("//:def.bzl", "gazelle")

gazelle(
Expand Down
1 change: 1 addition & 0 deletions tests/visibility_attr/child/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

build_test(
name = "visibility_test",
Expand Down

0 comments on commit 723446f

Please sign in to comment.