Skip to content

Commit

Permalink
fixup! [rules] Create an empty file for missing IPS in opentitan_ip_c…
Browse files Browse the repository at this point in the history
…_header
  • Loading branch information
pamaury committed Nov 15, 2024
1 parent f27475d commit 6d819ab
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions rules/autogen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,28 @@ def _opentitan_ip_rust_header_impl(ctx):
tock = ctx.actions.declare_file("{}.rs".format(ctx.attr.ip))
top = ctx.attr.top[OpenTitanTopInfo]
if ctx.attr.ip not in top.ip_hjson:
fail("Cannot generate headers: top {} does not contain IP {}".format(top.name, ctx.attr.ip))
hjson = top.ip_hjson[ctx.attr.ip]
# If this IP is not in the top, simply generate an an empty file.
ctx.actions.write(tock, "")
else:
hjson = top.ip_hjson[ctx.attr.ip]

stamp_args = []
stamp_files = []
if stamping_enabled(ctx):
stamp_files = [ctx.version_file]
stamp_args.append("--version-stamp={}".format(ctx.version_file.path))
stamp_args = []
stamp_files = []
if stamping_enabled(ctx):
stamp_files = [ctx.version_file]
stamp_args.append("--version-stamp={}".format(ctx.version_file.path))

ctx.actions.run(
outputs = [tock],
inputs = [hjson] + stamp_files,
arguments = [
"--tock",
"-q",
"-o",
tock.path,
] + stamp_args + [hjson.path],
executable = ctx.executable._regtool,
)
ctx.actions.run(
outputs = [tock],
inputs = [hjson] + stamp_files,
arguments = [
"--tock",
"-q",
"-o",
tock.path,
] + stamp_args + [hjson.path],
executable = ctx.executable._regtool,
)

return [
DefaultInfo(files = depset([tock])),
Expand Down

0 comments on commit 6d819ab

Please sign in to comment.