From 6d819ab178df3aa570190b397c7d65a912700fae Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Fri, 15 Nov 2024 13:48:33 +0000 Subject: [PATCH] fixup! [rules] Create an empty file for missing IPS in opentitan_ip_c_header --- rules/autogen.bzl | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/rules/autogen.bzl b/rules/autogen.bzl index fdd5fff481f151..3bfd4c17cae0f1 100644 --- a/rules/autogen.bzl +++ b/rules/autogen.bzl @@ -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])),