diff --git a/CHANGELOG.md b/CHANGELOG.md index f7818b3..87e8835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/MODULE.bazel b/MODULE.bazel index 04f8bd8..ebfea69 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -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") diff --git a/bashtest/BUILD.bazel b/bashtest/BUILD.bazel index a871cc6..cb98a0a 100644 --- a/bashtest/BUILD.bazel +++ b/bashtest/BUILD.bazel @@ -25,6 +25,7 @@ bzl_library( "tools.bzl", "windows.bzl", ], + deps = ["@mboworks_bzl//bzl/runfiles"], ) sh_library( diff --git a/bashtest/tools.bzl b/bashtest/tools.bzl index 31d4fcb..ad86cec 100644 --- a/bashtest/tools.bzl +++ b/bashtest/tools.bzl @@ -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_" @@ -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") @@ -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"]),