summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3build/l3build-clean.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/l3build/l3build-clean.lua
Initial commit
Diffstat (limited to 'macros/latex/contrib/l3build/l3build-clean.lua')
-rw-r--r--macros/latex/contrib/l3build/l3build-clean.lua56
1 files changed, 56 insertions, 0 deletions
diff --git a/macros/latex/contrib/l3build/l3build-clean.lua b/macros/latex/contrib/l3build/l3build-clean.lua
new file mode 100644
index 0000000000..01927a71d0
--- /dev/null
+++ b/macros/latex/contrib/l3build/l3build-clean.lua
@@ -0,0 +1,56 @@
+--[[
+
+File l3build-clean.lua Copyright (C) 2018 The LaTeX3 Project
+
+It may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+license or (at your option) any later version. The latest version
+of this license is in the file
+
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3build bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
+
+-----------------------------------------------------------------------
+
+The development version of the bundle can be found at
+
+ https://github.com/latex3/l3build
+
+for those people who are interested.
+
+--]]
+
+-- Remove all generated files
+function clean()
+ -- To make sure that distribdir never contains any stray subdirs,
+ -- it is entirely removed then recreated rather than simply deleting
+ -- all of the files
+ local errorlevel =
+ rmdir(distribdir) +
+ mkdir(distribdir) +
+ cleandir(localdir) +
+ cleandir(testdir) +
+ cleandir(typesetdir) +
+ cleandir(unpackdir)
+ for _,i in ipairs(cleanfiles) do
+ for _,dir in pairs(remove_duplicates({maindir, sourcefiledir, docfiledir})) do
+ errorlevel = rm(dir, i) + errorlevel
+ end
+ end
+ return errorlevel
+end
+
+function bundleclean()
+ local errorlevel = call(modules, "clean")
+ for _,i in ipairs(cleanfiles) do
+ errorlevel = rm(currentdir, i) + errorlevel
+ end
+ return (
+ errorlevel +
+ rmdir(ctandir) +
+ rmdir(tdsdir)
+ )
+end
+