Skip to content

Commit

Permalink
Load variables only once (see #50)
Browse files Browse the repository at this point in the history
This should allow both forms of usage, for the present,
but without having to reload files.
  • Loading branch information
josephwright committed Mar 6, 2018
1 parent 7229893 commit f636f03
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions l3build.lua
Expand Up @@ -41,14 +41,14 @@ local tonumber = tonumber
local exit = os.exit
-- l3build setup and functions
-- Note that global (config) variables are done a little later
kpse.set_program_name("kpsewhich")
build_kpse_path = string.match(lookup("l3build.lua"),"(.*[/])")
local function build_require(s)
require(lookup("l3build-"..s..".lua", { path = build_kpse_path } ) )
end
build_require("variables")
build_require("arguments")
build_require("file-functions")
build_require("typesetting")
Expand Down Expand Up @@ -78,15 +78,16 @@ if match(arg[0], "l3build(%.lua)$") then
elseif fileexists("build.lua") then
-- Force these to be undefined: needed for the reloading step
dofile("build.lua")
-- Reload the variables to set things up correctly
-- Has to be dofile() as require() doesn't reload
dofile(lookup("l3build-variables.lua", { path = build_kpse_path } ))
else
print("Error: Cannot find configuration build.lua")
exit(1)
end
end
-- Load standard settings for variables:
-- comes after any user versions
build_require("variables")
-- Tidy up the epoch setting
-- Force an epoch if set at the command line
-- Must be done after loading variables, etc.
Expand Down

0 comments on commit f636f03

Please sign in to comment.