From 0810e14a37ef552b91aa8f4c9949420427588179 Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Wed, 21 Aug 2024 18:35:23 +0200
Subject: [PATCH] elisp_manual: Support additional input files.
Fixes #570.
---
elisp/defs.bzl | 7 ++++++-
examples/BUILD | 1 +
examples/config.org | 16 ++++++++++++++++
examples/doc.org | 5 ++---
4 files changed, 25 insertions(+), 4 deletions(-)
create mode 100644 examples/config.org
diff --git a/elisp/defs.bzl b/elisp/defs.bzl
index 6a934b86..e2cea8ae 100644
--- a/elisp/defs.bzl
+++ b/elisp/defs.bzl
@@ -740,7 +740,7 @@ def _elisp_manual_impl(ctx):
fail("Output filename {} doesn’t end in “.texi”".format(out.short_path))
ctx.actions.run(
outputs = [out],
- inputs = [src],
+ inputs = [src] + ctx.files.additional_inputs,
executable = ctx.executable._export,
arguments = [ctx.actions.args().add(src).add(out)],
mnemonic = "Export",
@@ -759,6 +759,11 @@ elisp_manual = rule(
doc = "Texinfo manual file to write; must end in `.texi`.",
mandatory = True,
),
+ "additional_inputs": attr.label_list(
+ doc = "List of additional files made available during export",
+ allow_files = True,
+ cfg = "exec",
+ ),
"_export": attr.label(
allow_single_file = True,
executable = True,
diff --git a/examples/BUILD b/examples/BUILD
index 86aa9f79..cc1f9915 100644
--- a/examples/BUILD
+++ b/examples/BUILD
@@ -103,6 +103,7 @@ elisp_manual(
name = "doc",
src = "doc.org",
out = "doc.texi",
+ additional_inputs = ["config.org"],
)
genrule(
diff --git a/examples/config.org b/examples/config.org
new file mode 100644
index 00000000..6c482bf9
--- /dev/null
+++ b/examples/config.org
@@ -0,0 +1,16 @@
+# Copyright 2021, 2022, 2024 Philipp Stephani
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#+LANGUAGE: en
+#+OPTIONS: author:nil date:nil
diff --git a/examples/doc.org b/examples/doc.org
index bc33dcae..0def131a 100644
--- a/examples/doc.org
+++ b/examples/doc.org
@@ -1,4 +1,4 @@
-# Copyright 2021, 2022 Google LLC
+# Copyright 2021, 2022, 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,8 +13,7 @@
# limitations under the License.
#+TITLE: Example documentation
-#+LANGUAGE: en
-#+OPTIONS: author:nil date:nil
+#+SETUPFILE: examples/config.org
* Chapter