bazelbuild / rules_fuzzing

Bazel Starlark extensions for defining fuzz tests in Bazel projects
Apache License 2.0
81 stars 19 forks source link

rules_fuzzing incompatible with rules_python > 0.26 #239

Closed tpudlik closed 7 months ago

tpudlik commented 7 months ago

Expected Behavior

rules_fuzzing is compatible with recent versions of rules_python.

Actual Behavior

rules_fuzzing_init calls pip_parse, but the signature of that function changed in rules_python 0.13 (specifically in https://github.com/bazelbuild/rules_python/pull/807). Instead of a single requirements attribute, there's now three per-OS attributes (requirements_linux, requirements_windows, requirements_darwin).

This means a project that uses rules_fuzzing needs to replace a call to rules_fuzzing_init with a reimplementation that looks like,

pip_parse(
    name = "fuzzing_py_deps",
    extra_pip_args = ["--require-hashes"],
    python_interpreter_target = interpreter,
    requirements_darwin = "@rules_fuzzing//fuzzing:requirements.txt",
    requirements_linux = "@rules_fuzzing//fuzzing:requirements.txt",
    requirements_windows = "@rules_fuzzing//fuzzing:requirements.txt",
)

The fix is simple enough (change the rules_fuzzing_init to look like this), but will make rules_fuzzing incompatible with versions of rules_python older than 0.13. That version is a little over a year old, it came out on September 25, 2022.

I'll send a PR.

Specifications

tpudlik commented 7 months ago

I ended up a little confused about what's going on here, because rules_fuzzing apparently already uses rules_python 0.20, in which pip_parse should expect per-OS requirements.

It turns out that until https://github.com/bazelbuild/rules_python/pull/1514, pip_parse had a wrapper that accepted requirements as an argument, and passed them to pip_repository as requirements_lock. So the incompatibility will only be with the next version of rules_python. I'll update the issue title accordingly.