diff --git a/.bazelversion b/.bazelversion index 815da58b..ae9a76b9 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.4.1 +8.0.0 diff --git a/MODULE.bazel b/MODULE.bazel index 0c2a2bd0..8f90854a 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -3,11 +3,11 @@ module( version = "0.0.0", ) -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") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "rules_python", version = "0.40.0") +bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "cgrindel_bazel_starlib", version = "0.21.0") +bazel_dep(name = "rules_shell", version = "0.3.0") # not a direct dependency, but required here for bazel starlib's difftest macros to work bazel_dep( @@ -25,14 +25,14 @@ bazel_binaries = use_extension( dev_dependency = True, ) bazel_binaries.download(version_file = "//:.bazelversion") -bazel_binaries.download(version = "8.0.0rc2") +bazel_binaries.download(version = "last_green") bazel_binaries.local(path = "tools/fake_bazel.sh") use_repo( bazel_binaries, "bazel_binaries", "bazel_binaries_bazelisk", "build_bazel_bazel_.bazelversion", - "build_bazel_bazel_8_0_0rc2", + "build_bazel_bazel_last_green", "build_bazel_bazel_local", ) diff --git a/bazel_integration_test/bzlmod/e2e_test_runner.sh b/bazel_integration_test/bzlmod/e2e_test_runner.sh index f0eb7fa2..0a953fde 100755 --- a/bazel_integration_test/bzlmod/e2e_test_runner.sh +++ b/bazel_integration_test/bzlmod/e2e_test_runner.sh @@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ source "$0.runfiles/$f" 2>/dev/null || \ source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ - { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e + { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e # --- end runfiles.bash initialization v2 --- diff --git a/bazel_integration_test/private/bazel_binaries_script.template b/bazel_integration_test/private/bazel_binaries_script.template index a7cccdde..d5dfa3d1 100644 --- a/bazel_integration_test/private/bazel_binaries_script.template +++ b/bazel_integration_test/private/bazel_binaries_script.template @@ -1,23 +1,36 @@ #!/bin/bash - -# --- begin runfiles.bash initialization v2 --- -# Copy-pasted from the Bazel Bash runfiles library v2. -set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash -source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ - source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ - source "$0.runfiles/$f" 2>/dev/null || \ - source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ - source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ - { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e -# --- end runfiles.bash initialization v2 --- +# vi: ft=sh export USE_BAZEL_VERSION="{version}" -# Need to write data here, the default is read-obly inside tests. -export BAZELISK_HOME="${PWD}" +# Need to write data here, the default is read-only inside tests. +if [[ -z "${BAZELISK_HOME:-}" ]]; then + export BAZELISK_HOME="${PWD}" +fi + +# Find the bazelisk binary, if it has not already been found. +# +# Code that uses cgrindel/bazel-starlib's updatesrc utilities can execute Bazel +# invocations from directories that cannot find the runfiles. The first +# invocation will find the BIT_BAZELISK_BINARY. So, we export the value so that +# subsequent invocations can find it. This allows us to forgo the runfiles +# evaluation for this script in those cases. +if [[ -z "${BIT_BAZELISK_BINARY:-}" ]]; then + # --- begin runfiles.bash initialization v2 --- + # Copy-pasted from the Bazel Bash runfiles library v2. + set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash + # shellcheck disable=SC1090 + source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e + # --- end runfiles.bash initialization v2 --- -# Find the bazelisk binary. -BINARY="$(rlocation {bazelisk})" || \ - (echo >&2 "Failed to locate bazelisk at {bazelisk}" && exit 1) + BIT_BAZELISK_BINARY="$(rlocation {bazelisk})" || \ + (echo >&2 "Failed to locate bazelisk at {bazelisk}" && exit 1) + export BIT_BAZELISK_BINARY +fi -exec "${BINARY}" ${BIT_STARTUP_OPTIONS:-} "$@" +exec "${BIT_BAZELISK_BINARY}" ${BIT_STARTUP_OPTIONS:-} "$@" diff --git a/doc/integration_test_utils.md b/doc/integration_test_utils.md index 38a7d15b..287509a2 100755 --- a/doc/integration_test_utils.md +++ b/doc/integration_test_utils.md @@ -7,6 +7,8 @@ ## integration_test_utils.bazel_binary_label
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "integration_test_utils") + integration_test_utils.bazel_binary_label(version)@@ -17,7 +19,7 @@ Returns a label for the specified Bazel version as provided by https://github.co | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| version | A
string
value representing the semantic version of Bazel to use for the integration test. | none |
+| version | A `string` value representing the semantic version of Bazel to use for the integration test. | none |
**RETURNS**
@@ -29,6 +31,8 @@ A `string` representing a label for a version of Bazel.
## integration_test_utils.bazel_binary_repo_name
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "integration_test_utils") + integration_test_utils.bazel_binary_repo_name(version)@@ -39,7 +43,7 @@ Generates a Bazel binary repository name for the specified version. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| version | A
string
that represents a Bazel version or a label. | none |
+| version | A `string` that represents a Bazel version or a label. | none |
**RETURNS**
@@ -51,6 +55,8 @@ A `string` that is suitable for use as a repository name.
## integration_test_utils.bazel_integration_test_name
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "integration_test_utils") + integration_test_utils.bazel_integration_test_name(name, version)@@ -61,8 +67,8 @@ Generates a test name from the provided base name and the Bazel version. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| name | The base name as a
string
. | none |
-| version | The Bazel semantic version as a string
. | none |
+| name | The base name as a `string`. | none |
+| version | The Bazel semantic version as a `string`. | none |
**RETURNS**
@@ -74,6 +80,8 @@ A `string` that is suitable as an integration test name.
## integration_test_utils.bazel_integration_test_names
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "integration_test_utils") + integration_test_utils.bazel_integration_test_names(name, versions)@@ -84,8 +92,8 @@ Generates a `list` of integration test names based upon the provided base name a | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| name | The base name as a
string
. | none |
-| versions | A list
of semantic version string
values. | []
|
+| name | The base name as a `string`. | none |
+| versions | A `list` of semantic version `string` values. | `[]` |
**RETURNS**
@@ -97,6 +105,8 @@ A `list` of integration test names as `string` values.
## integration_test_utils.glob_workspace_files
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "integration_test_utils") + integration_test_utils.glob_workspace_files(workspace_path)@@ -107,7 +117,7 @@ Recursively globs the Bazel workspace files at the specified path. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| workspace_path | A
string
representing the path to glob. | none |
+| workspace_path | A `string` representing the path to glob. | none |
**RETURNS**
@@ -120,6 +130,8 @@ A `list` of the files under the specified path ignoring certain Bazel
## integration_test_utils.is_version_file
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "integration_test_utils") + integration_test_utils.is_version_file(version)@@ -130,7 +142,7 @@ Determines if the version string is a reference to a version file. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| version | A
string
that represents a Bazel version or a label. | none |
+| version | A `string` that represents a Bazel version or a label. | none |
**RETURNS**
@@ -142,6 +154,8 @@ A `bool` the specifies whether the string is a file reference.
## integration_test_utils.semantic_version_to_name
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "integration_test_utils") + integration_test_utils.semantic_version_to_name(version)@@ -152,7 +166,7 @@ Converts a semantic version string (e.g. X.Y.Z) to a suitable name string (e.g. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| version | A semantic version
string
. | none |
+| version | A semantic version `string`. | none |
**RETURNS**
diff --git a/doc/rules_and_macros_overview.md b/doc/rules_and_macros_overview.md
index cd62f9f1..2b36521e 100755
--- a/doc/rules_and_macros_overview.md
+++ b/doc/rules_and_macros_overview.md
@@ -16,6 +16,8 @@ On this page:
## default_test_runner
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "default_test_runner") + default_test_runner(name, bazel_cmds)@@ -27,7 +29,7 @@ default_test_runner(name, name | A unique name for this target. | Name | required | | -| bazel_cmds | The Bazel commands to be executed by the test runner in the test workspace. | List of strings | optional |
["info", "test //..."]
|
+| bazel_cmds | The Bazel commands to be executed by the test runner in the test workspace. | List of strings | optional | `["info", "test //..."]` |
@@ -35,9 +37,11 @@ default_test_runner(name, name, test_runner, bazel_version, bazel_binary, workspace_path,
workspace_files, tags, timeout, env, env_inherit, additional_env_inherit,
- bazel_binaries, data, startup_options, kwargs)
+ bazel_binaries, data, startup_options, **kwargs)
Macro that defines a set of targets for a single Bazel integration test.
@@ -58,19 +62,19 @@ default test runner is provided by the `default_test_runner` macro.
| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| name | name of the resulting py_test | none |
-| test_runner | A Label
for a test runner binary. (see description for details) | none |
-| bazel_version | Optional. A string
value representing the semantic version of Bazel to use for the integration test. If a version is not specified, then the bazel_binary
must be specified. | None
|
-| bazel_binary | Optional. A Label
for the Bazel binary to use for the execution of the integration test. Most users will not use this attribute. Use the bazel_version
instead. | None
|
-| workspace_path | Optional. A string
specifying the relative path to the child workspace. If not specified, then it is derived from the name. | None
|
-| workspace_files | Optional. A list
of files for the child workspace. If not specified, then it is derived from the workspace_path
. | None
|
-| tags | The Bazel tags to apply to the test declaration. | ["exclusive", "manual"]
|
-| timeout | A valid Bazel timeout value. https://docs.bazel.build/versions/main/test-encyclopedia.html#role-of-the-test-runner | "long"
|
-| env | Optional. A dictionary of strings
. Specifies additional environment variables to be passed to the test. | None
|
-| env_inherit | Optional. Override the env_inherit values passed to the test. Only do this if you understand what needs to be passed along. Most folks will want to use additional_env_inherit
to pass additional env_inherit values. | ["SUDO_ASKPASS", "HOME", "CC"]
|
-| additional_env_inherit | Optional. Specify additional env_inherit
values that should be passed to the test. | []
|
-| bazel_binaries | Optional for WORKSPACE loaded repositories. Required for repositories that enable bzlmod. The value for this parameter is loaded by adding load("@bazel_binaries//:defs.bzl", "bazel_binaries")
to your build file. | None
|
-| data | Optional. A list of files to make present at test runtime. | None
|
-| startup_options | Optional. Flags that should be passed to Bazel as startup options using the BIT_STARTUP_OPTIONS
environment variable. | ""
|
+| test_runner | A `Label` for a test runner binary. (see description for details) | none |
+| bazel_version | Optional. A `string` value representing the semantic version of Bazel to use for the integration test. If a version is not specified, then the `bazel_binary` must be specified. | `None` |
+| bazel_binary | Optional. A `Label` for the Bazel binary to use for the execution of the integration test. Most users will not use this attribute. Use the `bazel_version` instead. | `None` |
+| workspace_path | Optional. A `string` specifying the relative path to the child workspace. If not specified, then it is derived from the name. | `None` |
+| workspace_files | Optional. A `list` of files for the child workspace. If not specified, then it is derived from the `workspace_path`. | `None` |
+| tags | The Bazel tags to apply to the test declaration. | `["exclusive", "manual"]` |
+| timeout | A valid Bazel timeout value. https://docs.bazel.build/versions/main/test-encyclopedia.html#role-of-the-test-runner | `"long"` |
+| env | Optional. A dictionary of `strings`. Specifies additional environment variables to be passed to the test. | `None` |
+| env_inherit | Optional. Override the env_inherit values passed to the test. Only do this if you understand what needs to be passed along. Most folks will want to use `additional_env_inherit` to pass additional env_inherit values. | `["SUDO_ASKPASS", "HOME", "CC"]` |
+| additional_env_inherit | Optional. Specify additional `env_inherit` values that should be passed to the test. | `[]` |
+| bazel_binaries | Optional for WORKSPACE loaded repositories. Required for repositories that enable bzlmod. The value for this parameter is loaded by adding `load("@bazel_binaries//:defs.bzl", "bazel_binaries")` to your build file. | `None` |
+| data | Optional. A list of files to make present at test runtime. | `None` |
+| startup_options | Optional. Flags that should be passed to Bazel as startup options using the `BIT_STARTUP_OPTIONS` environment variable. | `""` |
| kwargs | additional attributes like timeout and visibility | none |
@@ -79,9 +83,11 @@ default test runner is provided by the `default_test_runner` macro.
## bazel_integration_tests
+load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "bazel_integration_tests") + bazel_integration_tests(name, test_runner, bazel_versions, workspace_path, workspace_files, tags, timeout, env_inherit, additional_env_inherit, bazel_binaries, startup_options, - kwargs) + **kwargs)Macro that defines a set Bazel integration tests each executed with a different version of Bazel. @@ -92,16 +98,16 @@ Macro that defines a set Bazel integration tests each executed with a different | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | name of the resulting py_test | none | -| test_runner | A
Label
for a test runner binary. | none |
-| bazel_versions | A list
of string
string values representing the semantic versions of Bazel to use for the integration tests. | []
|
-| workspace_path | A string
specifying the path to the child workspace. If not specified, then it is derived from the name. | None
|
-| workspace_files | Optional. A list
of files for the child workspace. If not specified, then it is derived from the workspace_path
. | None
|
-| tags | The Bazel tags to apply to the test declaration. | ["exclusive", "manual"]
|
-| timeout | A valid Bazel timeout value. https://docs.bazel.build/versions/main/test-encyclopedia.html#role-of-the-test-runner | "long"
|
-| env_inherit | Optional. Override the env_inherit values passed to the test. Only do this if you understand what needs to be passed along. Most folks will want to use additional_env_inherit
to pass additional env_inherit values. | ["SUDO_ASKPASS", "HOME", "CC"]
|
-| additional_env_inherit | Optional. Specify additional env_inherit
values that should be passed to the test. | []
|
-| bazel_binaries | Optional for WORKSPACE loaded repositories. Required for repositories that enable bzlmod. The value for this parameter is loaded by adding load("@bazel_binaries//:defs.bzl", "bazel_binaries")
to your build file. | None
|
-| startup_options | Optional. Flags that should be passed to Bazel as startup options using the BIT_STARTUP_OPTIONS
environment variable. | ""
|
+| test_runner | A `Label` for a test runner binary. | none |
+| bazel_versions | A `list` of `string` string values representing the semantic versions of Bazel to use for the integration tests. | `[]` |
+| workspace_path | A `string` specifying the path to the child workspace. If not specified, then it is derived from the name. | `None` |
+| workspace_files | Optional. A `list` of files for the child workspace. If not specified, then it is derived from the `workspace_path`. | `None` |
+| tags | The Bazel tags to apply to the test declaration. | `["exclusive", "manual"]` |
+| timeout | A valid Bazel timeout value. https://docs.bazel.build/versions/main/test-encyclopedia.html#role-of-the-test-runner | `"long"` |
+| env_inherit | Optional. Override the env_inherit values passed to the test. Only do this if you understand what needs to be passed along. Most folks will want to use `additional_env_inherit` to pass additional env_inherit values. | `["SUDO_ASKPASS", "HOME", "CC"]` |
+| additional_env_inherit | Optional. Specify additional `env_inherit` values that should be passed to the test. | `[]` |
+| bazel_binaries | Optional for WORKSPACE loaded repositories. Required for repositories that enable bzlmod. The value for this parameter is loaded by adding `load("@bazel_binaries//:defs.bzl", "bazel_binaries")` to your build file. | `None` |
+| startup_options | Optional. Flags that should be passed to Bazel as startup options using the `BIT_STARTUP_OPTIONS` environment variable. | `""` |
| kwargs | additional attributes like timeout and visibility | none |
diff --git a/examples/custom_test_runner/integration_tests/workspace/BUILD.bazel b/examples/custom_test_runner/integration_tests/workspace/BUILD.bazel
index 1c7d8404..6cfd71a2 100644
--- a/examples/custom_test_runner/integration_tests/workspace/BUILD.bazel
+++ b/examples/custom_test_runner/integration_tests/workspace/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_shell//shell:sh_test.bzl", "sh_test")
+
sh_test(
name = "foo_test",
srcs = ["foo_test.sh"],
diff --git a/examples/custom_test_runner/integration_tests/workspace/MODULE.bazel b/examples/custom_test_runner/integration_tests/workspace/MODULE.bazel
index 00bb1836..71ff01b8 100644
--- a/examples/custom_test_runner/integration_tests/workspace/MODULE.bazel
+++ b/examples/custom_test_runner/integration_tests/workspace/MODULE.bazel
@@ -1,6 +1,6 @@
-###############################################################################
-# Bazel now uses Bzlmod by default to manage external dependencies.
-# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
-#
-# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
-###############################################################################
+module(
+ name = "test_workspace",
+ version = "0.0.0",
+)
+
+bazel_dep(name = "rules_shell", version = "0.3.0")
diff --git a/examples/custom_test_runner/integration_tests/workspace/WORKSPACE b/examples/custom_test_runner/integration_tests/workspace/WORKSPACE
index f04d2d05..7fe687ae 100644
--- a/examples/custom_test_runner/integration_tests/workspace/WORKSPACE
+++ b/examples/custom_test_runner/integration_tests/workspace/WORKSPACE
@@ -1 +1,16 @@
workspace(name = "test_workspace")
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+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",
+)
+
+load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
+
+rules_shell_dependencies()
+
+rules_shell_toolchains()
diff --git a/examples/dynamic_workspace_test_runner.sh b/examples/dynamic_workspace_test_runner.sh
index f0eb7fa2..0a953fde 100755
--- a/examples/dynamic_workspace_test_runner.sh
+++ b/examples/dynamic_workspace_test_runner.sh
@@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
diff --git a/examples/env_var_with_rootpath/sample_workspace/BUILD.bazel b/examples/env_var_with_rootpath/sample_workspace/BUILD.bazel
index 2c7b824c..3a4c9ccb 100644
--- a/examples/env_var_with_rootpath/sample_workspace/BUILD.bazel
+++ b/examples/env_var_with_rootpath/sample_workspace/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_shell//shell:sh_test.bzl", "sh_test")
+
sh_test(
name = "test",
srcs = ["test.sh"],
diff --git a/examples/env_var_with_rootpath/sample_workspace/MODULE.bazel b/examples/env_var_with_rootpath/sample_workspace/MODULE.bazel
new file mode 100644
index 00000000..1038a534
--- /dev/null
+++ b/examples/env_var_with_rootpath/sample_workspace/MODULE.bazel
@@ -0,0 +1 @@
+bazel_dep(name = "rules_shell", version = "0.3.0")
diff --git a/examples/env_var_with_rootpath/sample_workspace/WORKSPACE.bazel b/examples/env_var_with_rootpath/sample_workspace/WORKSPACE.bazel
index e69de29b..1935e554 100644
--- a/examples/env_var_with_rootpath/sample_workspace/WORKSPACE.bazel
+++ b/examples/env_var_with_rootpath/sample_workspace/WORKSPACE.bazel
@@ -0,0 +1,14 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+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",
+)
+
+load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
+
+rules_shell_dependencies()
+
+rules_shell_toolchains()
diff --git a/examples/local_bazel_binary_test.sh b/examples/local_bazel_binary_test.sh
index 64849283..0adeb604 100755
--- a/examples/local_bazel_binary_test.sh
+++ b/examples/local_bazel_binary_test.sh
@@ -9,7 +9,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -o errexit
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -o errexit
# --- end runfiles.bash initialization v2 ---
# MARK - Locate Deps
diff --git a/examples/sample_script_test.sh b/examples/sample_script_test.sh
index 91053df7..66ff19d3 100755
--- a/examples/sample_script_test.sh
+++ b/examples/sample_script_test.sh
@@ -12,7 +12,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
# Use shlib assertions for testing.
diff --git a/examples/simple/WORKSPACE b/examples/simple/WORKSPACE
index 38c84730..a5a3ddc7 100644
--- a/examples/simple/WORKSPACE
+++ b/examples/simple/WORKSPACE
@@ -2,6 +2,19 @@ workspace(name = "simple_example")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+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",
+)
+
+load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
+
+rules_shell_dependencies()
+
+rules_shell_toolchains()
+
http_archive(
name = "cgrindel_bazel_starlib",
sha256 = "43e375213dabe0c3928e65412ea7ec16850db93285c8c6f8b0eaa41cacd0f882",
diff --git a/examples/use_create_scratch_dir_test.sh b/examples/use_create_scratch_dir_test.sh
index 2ee194f5..19156b14 100755
--- a/examples/use_create_scratch_dir_test.sh
+++ b/examples/use_create_scratch_dir_test.sh
@@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
assertions_sh_location=cgrindel_bazel_starlib/shlib/lib/assertions.sh
diff --git a/release/archive_test_runner.sh b/release/archive_test_runner.sh
index 8321bb4d..2d818673 100755
--- a/release/archive_test_runner.sh
+++ b/release/archive_test_runner.sh
@@ -9,7 +9,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -o errexit
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -o errexit
# --- end runfiles.bash initialization v2 ---
# MARK - Locate Deps
diff --git a/tests/e2e_tests/workspace/child_workspace/BUILD.bazel b/tests/e2e_tests/workspace/child_workspace/BUILD.bazel
index 35a19d64..f963a0cd 100644
--- a/tests/e2e_tests/workspace/child_workspace/BUILD.bazel
+++ b/tests/e2e_tests/workspace/child_workspace/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_shell//shell:sh_test.bzl", "sh_test")
+
sh_test(
name = "child_test",
srcs = ["child_test.sh"],
diff --git a/tests/e2e_tests/workspace/child_workspace/MODULE.bazel b/tests/e2e_tests/workspace/child_workspace/MODULE.bazel
index aedea8b1..efc6fde3 100644
--- a/tests/e2e_tests/workspace/child_workspace/MODULE.bazel
+++ b/tests/e2e_tests/workspace/child_workspace/MODULE.bazel
@@ -2,3 +2,5 @@ module(
name = "e2e_child",
version = "0.0.0",
)
+
+bazel_dep(name = "rules_shell", version = "0.3.0")
diff --git a/tests/params_tests/env_inherit_attr_test.bzl b/tests/params_tests/env_inherit_attr_test.bzl
index 91df9119..ca1577f0 100644
--- a/tests/params_tests/env_inherit_attr_test.bzl
+++ b/tests/params_tests/env_inherit_attr_test.bzl
@@ -1,5 +1,7 @@
"""Macro for asserting the existence of `env_inherit` values."""
+load("@rules_shell//shell:sh_test.bzl", "sh_test")
+
def env_inherit_attr_test(name, integration_test, expected_values):
"""Test for the existence of the specified values for a test target's `env_inherit` attribute.
@@ -20,7 +22,7 @@ def env_inherit_attr_test(name, integration_test, expected_values):
scope = [integration_test],
)
- native.sh_test(
+ sh_test(
name = name,
srcs = ["env_inherit_attr_test.sh"],
args = [
diff --git a/tests/params_tests/env_inherit_attr_test.sh b/tests/params_tests/env_inherit_attr_test.sh
index 1a1991f3..cbf59559 100755
--- a/tests/params_tests/env_inherit_attr_test.sh
+++ b/tests/params_tests/env_inherit_attr_test.sh
@@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
# MARK - Locate Deps
diff --git a/tests/params_tests/workspace/BUILD.bazel b/tests/params_tests/workspace/BUILD.bazel
index 08b8645e..aad1e80d 100644
--- a/tests/params_tests/workspace/BUILD.bazel
+++ b/tests/params_tests/workspace/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_shell//shell:sh_test.bzl", "sh_test")
+
sh_test(
name = "noop_test",
srcs = ["noop_test.sh"],
diff --git a/tests/params_tests/workspace/MODULE.bazel b/tests/params_tests/workspace/MODULE.bazel
index 00bb1836..1038a534 100644
--- a/tests/params_tests/workspace/MODULE.bazel
+++ b/tests/params_tests/workspace/MODULE.bazel
@@ -1,6 +1 @@
-###############################################################################
-# Bazel now uses Bzlmod by default to manage external dependencies.
-# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
-#
-# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
-###############################################################################
+bazel_dep(name = "rules_shell", version = "0.3.0")
diff --git a/tests/tools_tests/BUILD.bazel b/tests/tools_tests/BUILD.bazel
index 9bf57f54..4286e014 100644
--- a/tests/tools_tests/BUILD.bazel
+++ b/tests/tools_tests/BUILD.bazel
@@ -1,4 +1,5 @@
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
+load("@rules_shell//shell:sh_library.bzl", "sh_library")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
bzlformat_pkg(name = "bzlformat")
diff --git a/tests/tools_tests/create_scratch_dir_test.sh b/tests/tools_tests/create_scratch_dir_test.sh
index 8f02ac94..efe07eab 100755
--- a/tests/tools_tests/create_scratch_dir_test.sh
+++ b/tests/tools_tests/create_scratch_dir_test.sh
@@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
assertions_lib="$(rlocation cgrindel_bazel_starlib/shlib/lib/assertions.sh)"
diff --git a/tests/tools_tests/find_child_workspace_packages_test.sh b/tests/tools_tests/find_child_workspace_packages_test.sh
index d7b41cc0..88b0a9eb 100755
--- a/tests/tools_tests/find_child_workspace_packages_test.sh
+++ b/tests/tools_tests/find_child_workspace_packages_test.sh
@@ -9,7 +9,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
assertions_lib="$(rlocation cgrindel_bazel_starlib/shlib/lib/assertions.sh)"
diff --git a/tests/tools_tests/remove_child_wksp_bazel_symlinks_test.sh b/tests/tools_tests/remove_child_wksp_bazel_symlinks_test.sh
index 16fe799c..2098467e 100755
--- a/tests/tools_tests/remove_child_wksp_bazel_symlinks_test.sh
+++ b/tests/tools_tests/remove_child_wksp_bazel_symlinks_test.sh
@@ -9,7 +9,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -o errexit
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -o errexit
# --- end runfiles.bash initialization v2 ---
# MARK - Locate Deps
diff --git a/tests/tools_tests/shared_fns_tests/find_any_file_test.sh b/tests/tools_tests/shared_fns_tests/find_any_file_test.sh
index afcb7f18..7ee7b918 100755
--- a/tests/tools_tests/shared_fns_tests/find_any_file_test.sh
+++ b/tests/tools_tests/shared_fns_tests/find_any_file_test.sh
@@ -9,7 +9,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -o errexit
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -o errexit
# --- end runfiles.bash initialization v2 ---
# MARK - Locate Deps
diff --git a/tests/tools_tests/shared_fns_tests/find_workspace_dirs_test.sh b/tests/tools_tests/shared_fns_tests/find_workspace_dirs_test.sh
index 9112cf0a..78e51581 100755
--- a/tests/tools_tests/shared_fns_tests/find_workspace_dirs_test.sh
+++ b/tests/tools_tests/shared_fns_tests/find_workspace_dirs_test.sh
@@ -9,7 +9,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -o errexit
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -o errexit
# --- end runfiles.bash initialization v2 ---
# MARK - Locate Deps
diff --git a/tests/tools_tests/update_deleted_packages_test.sh b/tests/tools_tests/update_deleted_packages_test.sh
index 0166cf24..70e6c615 100755
--- a/tests/tools_tests/update_deleted_packages_test.sh
+++ b/tests/tools_tests/update_deleted_packages_test.sh
@@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
assertions_lib="$(rlocation cgrindel_bazel_starlib/shlib/lib/assertions.sh)"
diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel
index a47a4569..70a4cfa1 100644
--- a/tools/BUILD.bazel
+++ b/tools/BUILD.bazel
@@ -1,5 +1,6 @@
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
+load("@rules_shell//shell:sh_library.bzl", "sh_library")
exports_files(["fake_bazel.sh"])
diff --git a/tools/create_scratch_dir.sh b/tools/create_scratch_dir.sh
index ce011e09..5c3e0ad3 100755
--- a/tools/create_scratch_dir.sh
+++ b/tools/create_scratch_dir.sh
@@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
diff --git a/tools/find_child_workspace_packages.sh b/tools/find_child_workspace_packages.sh
index 136f8298..2c00ccf6 100755
--- a/tools/find_child_workspace_packages.sh
+++ b/tools/find_child_workspace_packages.sh
@@ -16,7 +16,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
arrays_lib="$(rlocation cgrindel_bazel_starlib/shlib/lib/arrays.sh)"
diff --git a/tools/remove_child_wksp_bazel_symlinks.sh b/tools/remove_child_wksp_bazel_symlinks.sh
index 7388f456..241d34a0 100755
--- a/tools/remove_child_wksp_bazel_symlinks.sh
+++ b/tools/remove_child_wksp_bazel_symlinks.sh
@@ -8,7 +8,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -o errexit
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -o errexit
# --- end runfiles.bash initialization v2 ---
# MARK - Locate Deps
diff --git a/tools/update_deleted_packages.sh b/tools/update_deleted_packages.sh
index 259155f0..e375f0c6 100755
--- a/tools/update_deleted_packages.sh
+++ b/tools/update_deleted_packages.sh
@@ -23,7 +23,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
- { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+ { echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
find_pkgs_script="$(rlocation rules_bazel_integration_test/tools/find_child_workspace_packages.sh)"