Skip to content

Commit

Permalink
Add dependency on rules_shell (#1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsharpe authored Dec 6, 2024
1 parent 0b43bd6 commit bcf899f
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .bazelci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ tasks:
- //...
min_supported_version:
name: "Minimum Supported Version"
bazel: "5.4.0"
bazel: "6.5.0"
skip_in_bazel_downstream_pipeline: "Duplicates tests in other targets"
platform: ubuntu1804
build_targets:
Expand All @@ -242,7 +242,7 @@ tasks:
- "//..."
min_supported_version_examples:
name: "Minimum Supported Version Examples"
bazel: "5.4.0"
bazel: "6.5.0"
skip_in_bazel_downstream_pipeline: "Duplicates tests in other targets"
platform: ubuntu1804
working_directory: examples
Expand Down
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bazel_dep(name = "bazel_features", version = "1.15.0")
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "rules_python", version = "0.23.1")
bazel_dep(name = "rules_shell", version = "0.3.0")

# Dev dependencies
bazel_dep(name = "gazelle", version = "0.34.0", dev_dependency = True, repo_name = "bazel_gazelle")
Expand Down
6 changes: 6 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

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

rules_shell_dependencies()

rules_shell_toolchains()

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()
Expand Down
1 change: 1 addition & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

genrule(
name = "flatten_header_vm",
Expand Down
1 change: 1 addition & 0 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bazel_dep(name = "rules_apple", version = "3.4.0", repo_name = "build_bazel_rule
bazel_dep(name = "apple_support", version = "1.12.0", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_python", version = "0.23.0")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_shell", version = "0.3.0")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand Down
1 change: 1 addition & 0 deletions examples/cmake_crosstool/static/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

filegroup(
name = "srcs",
Expand Down
1 change: 1 addition & 0 deletions examples/cmake_hello_world_lib/static/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

filegroup(
name = "srcs",
Expand Down
2 changes: 2 additions & 0 deletions examples/third_party/gn/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_shell//shell:sh_test.bzl", "sh_test")

exports_files(
[
"BUILD.curl.bazel",
Expand Down
1 change: 1 addition & 0 deletions examples/third_party/libpng/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

cc_binary(
name = "libpng_usage_example",
Expand Down
1 change: 1 addition & 0 deletions examples/third_party/openssl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_cc//cc:defs.bzl", "cc_test")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

exports_files(
[
Expand Down
1 change: 1 addition & 0 deletions examples/third_party/zlib/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake", "runnable_binary")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

exports_files(
[
Expand Down
1 change: 1 addition & 0 deletions foreign_cc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ bzl_library(
name = "utils",
srcs = ["utils.bzl"],
visibility = ["//visibility:public"],
deps = ["@rules_shell//shell:rules_bzl"],
)
8 changes: 8 additions & 0 deletions foreign_cc/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,11 @@ def rules_foreign_cc_dependencies(
strip_prefix = "rules_python-0.23.1",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.23.1.tar.gz",
)

maybe(
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",
)
4 changes: 3 additions & 1 deletion foreign_cc/utils.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
""" This file contains useful utilities """

load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

def full_label(label):
return native.repository_name() + "//" + native.package_name() + ":" + label

Expand Down Expand Up @@ -61,7 +63,7 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False,
tags = tags + ["manual"],
)

native.sh_binary(
sh_binary(
name = binary if match_binary_name else name,
deps = ["@bazel_tools//tools/bash/runfiles"],
data = [name + "_fg", foreign_cc_target],
Expand Down

0 comments on commit bcf899f

Please sign in to comment.