Skip to content

Commit

Permalink
[rules] Don't create files for DT headers for non-existent IP
Browse files Browse the repository at this point in the history
This is a hack that will change when we have a better build system.

Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Nov 15, 2024
1 parent 6d819ab commit 199470e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions rules/autogen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ opentitan_ip_rust_header = rule(
def _opentitan_top_dt_gen(ctx):
outputs = []
outdir = "{}/{}".format(ctx.bin_dir.path, ctx.label.package)
top = ctx.attr.top[OpenTitanTopInfo]

# Make sure the requested IPs are all in the top.
for ipname in ctx.attr.gen_ips:
if ipname not in top.ip_hjson:
return []

groups = {}
for group, files in ctx.attr.output_groups.items():
Expand All @@ -121,8 +127,6 @@ def _opentitan_top_dt_gen(ctx):
outputs.extend(deps)
groups[group] = depset(deps)

top = ctx.attr.top[OpenTitanTopInfo]

inputs = [top.hjson]
ips = []
for (ipname, hjson) in top.ip_hjson.items():
Expand All @@ -137,9 +141,6 @@ def _opentitan_top_dt_gen(ctx):
outdir,
]
arguments.append("--gen-top" if ctx.attr.gen_top else "--gen-ip")
for ipname in ctx.attr.gen_ips:
if ipname not in top.ip_hjson:
fail("Cannot generate IP headers: top {} does not contain IP {}".format(top.name, ipname))

arguments.extend(ips)

Expand Down

0 comments on commit 199470e

Please sign in to comment.