Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 0.7.1

* Use mboworks_bzl 0.8.0 runfiles keys for helper executables and tool manifests.

* Derive consumer fixture versions from the module and automate the README
version update during release preparation. Test development/release version
consistency and post-release version bumps.
Expand Down
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.9.2")
bazel_dep(name = "mboworks_bzl", version = "0.8.0")
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "rules_shell", version = "0.8.0")

Expand Down
1 change: 1 addition & 0 deletions bashtest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ bzl_library(
"tools.bzl",
"windows.bzl",
],
deps = ["@mboworks_bzl//bzl/runfiles"],
)

sh_library(
Expand Down
9 changes: 3 additions & 6 deletions bashtest/tools.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

"""Bind helper executables to the execution platform of the actual test action."""

def _rlocation_path(ctx, file):
if file.short_path.startswith("../"):
return file.short_path[3:]
return ctx.workspace_name + "/" + file.short_path
load("@mboworks_bzl//bzl/runfiles:runfiles.bzl", _runfiles = "runfiles")

def _validate_name(name):
letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
Expand Down Expand Up @@ -54,7 +51,7 @@ def _tools_test_impl(ctx):
if name in names or name in environment.environment or name in environment.inherited_environment:
fail("tool environment variable is already defined: " + name)
names.append(name)
entries.append(name + "\t" + _rlocation_path(ctx, executable) + "\n")
entries.append(name + "\t" + _runfiles.key(ctx, executable) + "\n")
tool_files.append(executable)
tool_runfiles.extend([info.default_runfiles, info.data_runfiles])
manifest = ctx.actions.declare_file(ctx.label.name + ".tools")
Expand All @@ -68,7 +65,7 @@ def _tools_test_impl(ctx):
return [
DefaultInfo(executable = executable, runfiles = runfiles),
RunEnvironmentInfo(
environment = environment.environment | ({"_BASHTEST_TOOLS_MANIFEST": _rlocation_path(ctx, manifest)} if ctx.attr.tools else {}),
environment = environment.environment | ({"_BASHTEST_TOOLS_MANIFEST": _runfiles.key(ctx, manifest)} if ctx.attr.tools else {}),
inherited_environment = environment.inherited_environment,
),
coverage_common.instrumented_files_info(ctx, dependency_attributes = ["runner"]),
Expand Down
Loading