Allow depending on files in jinja2_template
This lets us use the {% include %} directive in jinja2 to more cleanly
compose JSON files.
Change-Id: Ifdeb6f890c05ae1c20f4ffdd1540c64eb8e24be0
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/tools/build_rules/template.bzl b/tools/build_rules/template.bzl
index d4807e8..0b9167e 100644
--- a/tools/build_rules/template.bzl
+++ b/tools/build_rules/template.bzl
@@ -2,7 +2,7 @@
out = ctx.actions.declare_file(ctx.attr.name)
ctx.actions.run_shell(
- inputs = ctx.files.src,
+ inputs = ctx.files.src + ctx.files.includes,
tools = [ctx.executable._jinja2],
progress_message = "Generating " + out.short_path,
outputs = [out],
@@ -22,6 +22,10 @@
mandatory = True,
doc = """The parameters to supply to Jinja2.""",
),
+ "includes": attr.label_list(
+ allow_files = True,
+ doc = """Files which are included by the template.""",
+ ),
"_jinja2": attr.label(
default = "//tools/build_rules:jinja2_generator",
cfg = "host",