extension: add yosys_plugins attribute to orfs.default()#712
Merged
Conversation
Lets consumers expose out-of-tree yosys plugins (e.g. yosys-slang) without having to materialize a custom yosys_share tree. bazel-orfs now derives YOSYS_PLUGIN_PATH from the dirnames of the plugin files passed via `yosys_plugins`, and adds them to the input set of yosys actions. The old single-tree-artifact yosys_share path is preserved as a fallback when no plugins are specified, so existing consumers (including downstream/test) keep working. Tested via The-OpenROAD-Project/OpenROAD#10237 (ditch-docker): - bazelisk build //:openroad clean - bazelisk test //test/orfs/... -- all 19 tests pass - merge_yosys_share custom rule removed in OpenROAD; orfs.default() uses yosys_plugins = ["@yosys-slang//src/yosys_plugin:slang.so"] Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets consumers expose out-of-tree yosys plugins (e.g. yosys-slang) without having to materialize a custom merged `yosys_share` tree.
Motivation
OpenROAD's PR The-OpenROAD-Project/OpenROAD#10237 carries a custom `merge_yosys_share` rule that materializes a TreeArtifact merging `@yosys//:yosys_share` with a locally-built `slang.so`. @hzeller flagged it as fragile (manual `/bin/bash` shell-out, breaks on NixOS) and asked for the `pkg_files` pattern. `pkg_files` doesn't fit because bazel-orfs requires a TreeArtifact for `yosys_share` — but accepting plugins as a separate label_list sidesteps the merge entirely.
With this change, OpenROAD's `orfs.default()` becomes:
```python
orfs.default(
openroad = "//:openroad",
yosys_plugins = ["@yosys-slang//src/yosys_plugin:slang.so"],
)
```
and `bazel/merge_share.bzl` + `//:yosys_share_with_slang` are deleted.
Test plan