summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthewsot@outlook.com>2020-09-16 13:59:36 -0700
committerMatthew Sotoudeh <matthewsot@outlook.com>2020-09-16 13:59:36 -0700
commit1f36c2eea158c48e3409356902a5797810850c11 (patch)
tree52dd8c071aec4f8336a06e6ad894751f3f5935a7
parent5d083c8ff8794c598f1e31c24d7f74f36b86cae9 (diff)
Simple build cachingmatthew-fast-rebuilds
-rw-r--r--run_latex.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/run_latex.py b/run_latex.py
index 9f4b75e..64220c0 100644
--- a/run_latex.py
+++ b/run_latex.py
@@ -21,6 +21,11 @@ import shutil
import subprocess
import sys
+# Copy any existing build cache here.
+cache_dir = "/tmp/bazel-latex.cache"
+if os.path.exists(cache_dir) and os.path.isdir(cache_dir):
+ shutil.copytree(cache_dir, "latex.out")
+
texlive, latexrun, job_name, main_file, output_file = sys.argv[1:6]
sources = sys.argv[6:]
if output_file == "--":
@@ -56,6 +61,11 @@ return_code = subprocess.call(
env=env,
)
+# Copy back to the build cache.
+if os.path.exists(cache_dir):
+ shutil.rmtree(cache_dir)
+shutil.copytree("latex.out", cache_dir)
+
if return_code != 0:
sys.exit(return_code)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback