Skip to content

Commit

Permalink
Add rules_shell dep to rules_bazel_integration_test (#368)
Browse files Browse the repository at this point in the history
native.{sh_test,sh_library} no longer exist in Bazel HEAD.

---------

Co-authored-by: Chuck Grindel <[email protected]>
  • Loading branch information
ted-xie and cgrindel authored Oct 18, 2024
1 parent 6f02081 commit 0b8c5ca
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 1,059 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ignore Bazel symlinks
bazel-*

MODULE.bazel.lock

1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_python", version = "0.19.0")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "cgrindel_bazel_starlib", version = "0.18.0")
bazel_dep(name = "rules_shell", version = "0.2.0")

# not a direct dependency, but required here for bazel starlib's difftest macros to work
bazel_dep(
Expand Down
1,055 changes: 0 additions & 1,055 deletions MODULE.bazel.lock

This file was deleted.

13 changes: 13 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,16 @@ http_file(
sha256 = "0baf36f9c3ef9d8b4833833e1d633707965c9850f69f04dd96712672b9e75cc0",
url = "https://raw.githubusercontent.com/bazel-contrib/rules_bazel_integration_test/v0.12.0/.bazelversion",
)

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()
1 change: 1 addition & 0 deletions bazel_integration_test/bzlmod/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load(
"//bazel_integration_test:defs.bzl",
"bazel_integration_test",
Expand Down
1 change: 1 addition & 0 deletions bazel_integration_test/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ bzl_library(
":integration_test_utils",
"@bazel_skylib//lib:paths",
"@bazel_skylib//rules:select_file",
"@rules_shell//shell:rules_bzl",
],
)

Expand Down
3 changes: 2 additions & 1 deletion bazel_integration_test/private/bazel_integration_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ an integration test.\
"""

load("@bazel_skylib//lib:paths.bzl", "paths")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
load(":integration_test_utils.bzl", "integration_test_utils")

# This was lovingly inspired by
Expand Down Expand Up @@ -168,7 +169,7 @@ def bazel_integration_test(

env["BIT_STARTUP_OPTIONS"] = startup_options

native.sh_test(
sh_test(
name = name,
srcs = [
"@rules_bazel_integration_test//bazel_integration_test/private:integration_test_wrapper.sh",
Expand Down
3 changes: 2 additions & 1 deletion bazel_integration_test/private/script_test.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"A facility for script tests that create workspaces and call Bazel."

load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load(
"//bazel_integration_test/private:bazel_integration_test.bzl",
"bazel_integration_test",
Expand Down Expand Up @@ -98,7 +99,7 @@ def script_test(
)

# Create the test runner that sets up and calls the test.
native.sh_binary(
sh_binary(
name = runner_target,
testonly = True,
srcs = [runner_script],
Expand Down
1 change: 1 addition & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load(
"//bazel_integration_test:defs.bzl",
"bazel_integration_test",
Expand Down
3 changes: 2 additions & 1 deletion release/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ load(
"release_archive",
"update_readme",
)
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load(
"//bazel_integration_test:defs.bzl",
"bazel_integration_test",
Expand Down Expand Up @@ -75,7 +76,7 @@ sh_binary(
name = "archive_test_runner",
testonly = True,
srcs = ["archive_test_runner.sh"],
data = ["//release:archive"],
data = [":archive"],
deps = [
"@bazel_tools//tools/bash/runfiles",
"@cgrindel_bazel_starlib//shlib/lib:assertions",
Expand Down
1 change: 1 addition & 0 deletions tests/tools_tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

bzlformat_pkg(name = "bzlformat")

Expand Down
1 change: 1 addition & 0 deletions tests/tools_tests/shared_fns_tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

bzlformat_pkg(name = "bzlformat")

Expand Down
1 change: 1 addition & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

exports_files(["fake_bazel.sh"])

Expand Down

0 comments on commit 0b8c5ca

Please sign in to comment.