Skip to content

Commit

Permalink
Use implicit Verilator lint log name
Browse files Browse the repository at this point in the history
Internal-tag: [#68242]
Signed-off-by: Maciej Kurc <[email protected]>
  • Loading branch information
mkurc-ant committed Nov 20, 2024
1 parent 73a5a82 commit 9a96ec2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
17 changes: 5 additions & 12 deletions verilator/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -543,18 +543,14 @@ def _verilator_lint(ctx):
args, vlog_srcs, vlog_hdrs, runfiles = _verilator_args(ctx, srcs, vopts)

# Capture stderr to the log file
log_file = ctx.actions.declare_file(ctx.label.name + ".log")

args.add("--stderr")
if ctx.outputs.log:
args.add(ctx.outputs.log.path)
outputs = [ctx.outputs.log]
else:
log_file = ctx.actions.declare_file(ctx.label.name + ".log")
args.add(log_file.path)
outputs = [log_file]
args.add(log_file.path)

# Run
ctx.actions.run(
outputs = outputs,
outputs = [log_file],
inputs = vlog_srcs + vlog_hdrs,
tools = [verilator_toolchain.all_files, ctx.executable._run_wrapper],
env = _verilator_toolchain_env(verilator_toolchain),
Expand All @@ -565,16 +561,13 @@ def _verilator_lint(ctx):
)

return DefaultInfo(
files = depset(outputs),
files = depset([log_file]),
runfiles = ctx.runfiles(files = vlog_srcs + vlog_hdrs),
)

verilator_lint = rule(
implementation = _verilator_lint,
attrs = {
"log": attr.output(
doc = "Name of the output log file. Defaults to '<name>.log'",
),
"module": attr.label(
doc = "The top level module target to verilate.",
providers = [VerilogInfo],
Expand Down
1 change: 0 additions & 1 deletion verilator/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ verilator_run(

verilator_lint(
name = "nested_module_2_verilator_lint",
log = "lint.log",
module = ":nested_module_2",
vopts = [
"-Wall",
Expand Down

0 comments on commit 9a96ec2

Please sign in to comment.