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: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "rules_mayhem",
version = "0.8.6",
version = "0.8.7",
)

bazel_dep(name = "bazel_skylib", version = "1.9.0")
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can add the following snippet:

```
## MODULE.bazel
bazel_dep(name = "rules_mayhem", version = "0.8.6")
bazel_dep(name = "rules_mayhem", version = "0.8.7")

rules_mayhem_extension = use_extension("@rules_mayhem//mayhem:extensions.bzl", "rules_mayhem_extension")
use_repo(rules_mayhem_extension, "bazel_skylib", "mayhem_cli_linux", "mayhem_cli_windows", "platforms", "yq_cli_linux", "yq_cli_windows")
Expand All @@ -21,8 +21,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_mayhem",
strip_prefix = "rules_mayhem",
urls = ["https://github.com/ForAllSecure/rules_mayhem/releases/download/0.8.6/rules_mayhem-0.8.6.tar.gz"],
sha256 = "0704d5d8443070924b153a709e9deb7e7ff71a268f6e7c88083d36dc65b85c0f",
urls = ["https://github.com/ForAllSecure/rules_mayhem/releases/download/0.8.7/rules_mayhem-0.8.7.tar.gz"],
sha256 = "911104c434cd01bfd993ed0b0395fd639526252a80710ad2830b60f1c30cceb2",
)

load("@rules_mayhem//mayhem:repositories.bzl", "rules_mayhem_repositories")
Expand Down
22 changes: 20 additions & 2 deletions mayhem/mayhem.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,26 @@ def _mayhem_run_impl(ctx):
py_content = """#!/usr/bin/env python3
import subprocess
import sys

mayhem_cli = "{mayhem_cli}"
import os

def resolve_runfile_mayhem_cli_path(mayhem_cli_short_path):
# Bazel sets the RUNFILES_MANIFEST_FILE environment variable on Windows
# which we can use to resolve the path to the mayhem CLI in the case that
# runfiles/symlinks are not available

manifest_path = os.environ.get("RUNFILES_MANIFEST_FILE")
if manifest_path and os.name == "nt":
with open(manifest_path, "r") as manifest_file:
for line in manifest_file:
key, value = line.strip().split(" ", 1)
if "mayhem" in key.lower() and "cli" in key.lower():
return value

# If the manifest file is not set or the mayhem CLI is not found in the manifest,
# fall back to the original path
return mayhem_cli_short_path

mayhem_cli = resolve_runfile_mayhem_cli_path("{mayhem_cli}")
run_args = {run_args}
wait_args = {wait_args}

Expand Down
Loading