diff --git a/.bazelci/config.yaml b/.bazelci/config.yaml index cb1c214b0..cf6e9a556 100644 --- a/.bazelci/config.yaml +++ b/.bazelci/config.yaml @@ -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: @@ -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 diff --git a/MODULE.bazel b/MODULE.bazel index a18a292c4..d8005946c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -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") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 820d37665..4f18c76b4 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -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() diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index b24eea8d0..a4a55ad17 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -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", diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index b45694c20..b13b893bc 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -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( diff --git a/examples/cmake_crosstool/static/BUILD.bazel b/examples/cmake_crosstool/static/BUILD.bazel index c5a162c5a..eff902906 100644 --- a/examples/cmake_crosstool/static/BUILD.bazel +++ b/examples/cmake_crosstool/static/BUILD.bazel @@ -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", diff --git a/examples/cmake_hello_world_lib/static/BUILD.bazel b/examples/cmake_hello_world_lib/static/BUILD.bazel index b32e9ad3e..8bd4fa10e 100644 --- a/examples/cmake_hello_world_lib/static/BUILD.bazel +++ b/examples/cmake_hello_world_lib/static/BUILD.bazel @@ -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", diff --git a/examples/third_party/gn/BUILD.bazel b/examples/third_party/gn/BUILD.bazel index fb9639f02..caa05a68a 100644 --- a/examples/third_party/gn/BUILD.bazel +++ b/examples/third_party/gn/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_shell//shell:sh_test.bzl", "sh_test") + exports_files( [ "BUILD.curl.bazel", diff --git a/examples/third_party/libpng/BUILD.bazel b/examples/third_party/libpng/BUILD.bazel index 29c9bbd6e..ab449b866 100644 --- a/examples/third_party/libpng/BUILD.bazel +++ b/examples/third_party/libpng/BUILD.bazel @@ -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", diff --git a/examples/third_party/openssl/BUILD.bazel b/examples/third_party/openssl/BUILD.bazel index f02b1ae44..bea7d6422 100644 --- a/examples/third_party/openssl/BUILD.bazel +++ b/examples/third_party/openssl/BUILD.bazel @@ -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( [ diff --git a/examples/third_party/zlib/BUILD.bazel b/examples/third_party/zlib/BUILD.bazel index 23d01225b..2aeccc5e3 100644 --- a/examples/third_party/zlib/BUILD.bazel +++ b/examples/third_party/zlib/BUILD.bazel @@ -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( [ diff --git a/foreign_cc/BUILD.bazel b/foreign_cc/BUILD.bazel index 36ff30803..0c965128f 100644 --- a/foreign_cc/BUILD.bazel +++ b/foreign_cc/BUILD.bazel @@ -132,4 +132,5 @@ bzl_library( name = "utils", srcs = ["utils.bzl"], visibility = ["//visibility:public"], + deps = ["@rules_shell//shell:rules_bzl"], ) diff --git a/foreign_cc/repositories.bzl b/foreign_cc/repositories.bzl index 7a8183892..308a0dacb 100644 --- a/foreign_cc/repositories.bzl +++ b/foreign_cc/repositories.bzl @@ -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", + ) diff --git a/foreign_cc/utils.bzl b/foreign_cc/utils.bzl index 8e7e47729..1414b508d 100644 --- a/foreign_cc/utils.bzl +++ b/foreign_cc/utils.bzl @@ -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 @@ -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],