|
|
@ -77,18 +77,13 @@ for _index_0 = 1, #_list_0 do |
|
|
|
local f = _list_0[_index_0] |
|
|
|
local f = _list_0[_index_0] |
|
|
|
local orig = cmd[f] |
|
|
|
local orig = cmd[f] |
|
|
|
cmd[f] = function(...) |
|
|
|
cmd[f] = function(...) |
|
|
|
local cli = cmdline(...) |
|
|
|
verbose("[" .. tostring(f) .. "] " .. tostring(cmdline(...))) |
|
|
|
verbose(function() |
|
|
|
|
|
|
|
return print("[" .. tostring(f) .. "] " .. tostring(cli)) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
return orig(...) |
|
|
|
return orig(...) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
local _sh = cmd.sh |
|
|
|
local _sh = cmd.sh |
|
|
|
cmd.sh = function(cli) |
|
|
|
cmd.sh = function(cli) |
|
|
|
verbose(function() |
|
|
|
verbose("[sh] " .. tostring(cli)) |
|
|
|
return print("[sh] " .. tostring(cli)) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
return _sh(cli) |
|
|
|
return _sh(cli) |
|
|
|
end |
|
|
|
end |
|
|
|
local _cmd = cmd.cmd |
|
|
|
local _cmd = cmd.cmd |
|
|
@ -679,8 +674,12 @@ verbose = function(arg) |
|
|
|
end |
|
|
|
end |
|
|
|
elseif (type(arg)) == 'boolean' then |
|
|
|
elseif (type(arg)) == 'boolean' then |
|
|
|
_verbose = arg |
|
|
|
_verbose = arg |
|
|
|
|
|
|
|
elseif (type(arg)) == 'string' then |
|
|
|
|
|
|
|
if _verbose then |
|
|
|
|
|
|
|
return print(arg) |
|
|
|
|
|
|
|
end |
|
|
|
else |
|
|
|
else |
|
|
|
return error("_.verbose takes either no argument, a boolean or a function") |
|
|
|
return error("_.verbose takes either no argument, a boolean, a function or a string") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
common.flatten = flatten |
|
|
|
common.flatten = flatten |
|
|
@ -1382,9 +1381,7 @@ writefile = function(filename, data) |
|
|
|
end |
|
|
|
end |
|
|
|
local moonc |
|
|
|
local moonc |
|
|
|
moonc = function(infile, outfile) |
|
|
|
moonc = function(infile, outfile) |
|
|
|
verbose(function() |
|
|
|
verbose("[moonc] " .. tostring(infile) .. " " .. tostring(outfile)) |
|
|
|
return print("[moonc] " .. tostring(infile) .. " " .. tostring(outfile)) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
local code, err = to_lua(readfile(infile)) |
|
|
|
local code, err = to_lua(readfile(infile)) |
|
|
|
if not (code) then |
|
|
|
if not (code) then |
|
|
|
error("Failed to compile " .. tostring(self.infile) .. ": " .. tostring(err)) |
|
|
|
error("Failed to compile " .. tostring(self.infile) .. ": " .. tostring(err)) |
|
|
@ -2887,28 +2884,17 @@ moonbuild = function(...) |
|
|
|
_.verbose(verbose) |
|
|
|
_.verbose(verbose) |
|
|
|
local ctx = Context() |
|
|
|
local ctx = Context() |
|
|
|
ctx:load((loadfile(buildfile)), opts) |
|
|
|
ctx:load((loadfile(buildfile)), opts) |
|
|
|
_.verbose(function() |
|
|
|
_.verbose("Loaded buildfile") |
|
|
|
return print("Loaded buildfile") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
ctx:init() |
|
|
|
ctx:init() |
|
|
|
_.verbose(function() |
|
|
|
_.verbose("Initialized buildfile") |
|
|
|
return print("Initialized buildfile") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
local targets = #opts == 0 and ctx.defaulttargets or opts |
|
|
|
local targets = #opts == 0 and ctx.defaulttargets or opts |
|
|
|
local dag = DepGraph(ctx, targets) |
|
|
|
local dag = DepGraph(ctx, targets) |
|
|
|
_.verbose(function() |
|
|
|
_.verbose("Created dependancy graph") |
|
|
|
return print("Created dependancy graph") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
local nparallel = parallel == true and Executor:getmaxparallel() or parallel |
|
|
|
local nparallel = parallel == true and Executor:getmaxparallel() or parallel |
|
|
|
_.verbose(function() |
|
|
|
_.verbose("Building with " .. tostring(nparallel) .. " max parallel process" .. tostring(nparallel > 1 and "es" or "")) |
|
|
|
return print("Building with " .. tostring(nparallel) .. " max parallel process" .. tostring(nparallel > 1 and "es" or "")) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
local executor = Executor(dag, nparallel) |
|
|
|
local executor = Executor(dag, nparallel) |
|
|
|
executor:execute(opts) |
|
|
|
executor:execute(opts) |
|
|
|
_.verbose(function() |
|
|
|
return _.verbose("Finished") |
|
|
|
return print("Finished") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
return print(_.verbose()) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
local table = { |
|
|
|
local table = { |
|
|
|
moonbuild = moonbuild, |
|
|
|
moonbuild = moonbuild, |
|
|
|