google / google/xls

bazel ir rules should no rely on implicit output

Open
#1,257 0 comments 0 reactions 0 assignees View on GitHub
build enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Currently the many bazel rules relies on implicit output from other rules, ex:
- https://google.github.io/xls/bazel_rules_macros/#xls_ir_opt_ir
- https://google.github.io/xls/bazel_rules_macros/#xls_ir_verilog
all expect their `src` attribute to ends with `.ir` and won't accept a vanilla rule name as a dependency.

For example:
```
xls_dslx_library(
name = "foo_dslx",
srcs = ["foo.x"],
)

xls_dslx_ir(
name = "foo_ir",
dslx_top = "foo",
library = ":foo_dslx",
)

xls_ir_opt_ir(
name = "foo_opt_ir",
src = ":foo_ir",
)

xls_ir_verilog(
name = "foo_sv",
src = ":foo_opt_ir",
codegen_args = {
"generator": "combinational",
"use_system_verilog": "true",
},
verilog_file = "foo.sv",
)
```

will throw the following error:
```
ERROR: BUILD:24:14: in src attribute of xls_ir_opt_ir rule foo_opt_ir: ':foo_ir' must produce a single file. Since this rule was created by the macro 'xls_ir_opt_ir_macro', the error might have been caused by the macro implementation
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.