|
|
@ -1,5 +1,3 @@ |
|
|
|
do |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do |
|
|
|
do |
|
|
|
local _ENV = _ENV |
|
|
|
local _ENV = _ENV |
|
|
|
package.preload[ "moonbuild._" ] = function( ... ) local arg = _G.arg; |
|
|
|
package.preload[ "moonbuild._" ] = function( ... ) local arg = _G.arg; |
|
|
@ -1750,7 +1748,7 @@ do |
|
|
|
if self.nodes[name] then |
|
|
|
if self.nodes[name] then |
|
|
|
return |
|
|
|
return |
|
|
|
end |
|
|
|
end |
|
|
|
local elected = self:resolvedeps(name) |
|
|
|
local elected = self:topresolvedeps(name) |
|
|
|
self.nodes[name] = elected |
|
|
|
self.nodes[name] = elected |
|
|
|
local _list_0 = (transclosure(elected, 'deps')) |
|
|
|
local _list_0 = (transclosure(elected, 'deps')) |
|
|
|
for _index_0 = 1, #_list_0 do |
|
|
|
for _index_0 = 1, #_list_0 do |
|
|
@ -1760,10 +1758,42 @@ do |
|
|
|
end |
|
|
|
end |
|
|
|
elected.deps = nil |
|
|
|
elected.deps = nil |
|
|
|
end, |
|
|
|
end, |
|
|
|
resolvedeps = function(self, name) |
|
|
|
topresolvedeps = function(self, name) |
|
|
|
|
|
|
|
local errors = { } |
|
|
|
|
|
|
|
local ok, rst = pcall(function() |
|
|
|
|
|
|
|
return self:resolvedeps(name, nil, errors) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
if ok then |
|
|
|
|
|
|
|
return rst |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
local msg = { |
|
|
|
|
|
|
|
"Failed to resolve target \'" .. tostring(name) .. "\'\n" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for _index_0 = 1, #errors do |
|
|
|
|
|
|
|
local e = errors[_index_0] |
|
|
|
|
|
|
|
if e.err:match('^moonbuild') then |
|
|
|
|
|
|
|
e.err = e.err:match(': (.+)$') |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
for i = #errors, 1, -1 do |
|
|
|
|
|
|
|
local e = errors[i] |
|
|
|
|
|
|
|
insert(msg, tostring(string.rep('| ', e.level - 1)) .. "+-[" .. tostring(e.name) .. "] level " .. tostring(e.level) .. ": " .. tostring(e.err)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
insert(msg, '') |
|
|
|
|
|
|
|
return error(table.concat(msg, '\n')) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end, |
|
|
|
|
|
|
|
resolvedeps = function(self, name, level, errors) |
|
|
|
|
|
|
|
if level == nil then |
|
|
|
|
|
|
|
level = 1 |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
if errors == nil then |
|
|
|
|
|
|
|
errors = { } |
|
|
|
|
|
|
|
end |
|
|
|
do |
|
|
|
do |
|
|
|
local node = self.nodes[name] |
|
|
|
local node = self.nodes[name] |
|
|
|
if node then |
|
|
|
if node then |
|
|
|
|
|
|
|
print("deps(" .. tostring(name) .. ") = " .. tostring(node.name or '[noname]')) |
|
|
|
return node, { } |
|
|
|
return node, { } |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -1777,7 +1807,7 @@ do |
|
|
|
return { |
|
|
|
return { |
|
|
|
a = { |
|
|
|
a = { |
|
|
|
pcall(function() |
|
|
|
pcall(function() |
|
|
|
return DepNode(self, candidate, name) |
|
|
|
return DepNode(self, candidate, name, level, errors) |
|
|
|
end) |
|
|
|
end) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1788,7 +1818,16 @@ do |
|
|
|
return node.a[2] |
|
|
|
return node.a[2] |
|
|
|
end) |
|
|
|
end) |
|
|
|
sort(resolved, nodepriority) |
|
|
|
sort(resolved, nodepriority) |
|
|
|
return resolved[1] or error("Cannot resolve target " .. tostring(name) .. ": " .. tostring(#candidates) .. " candidates, " .. tostring(#resolved) .. " resolved") |
|
|
|
if not (resolved[1]) then |
|
|
|
|
|
|
|
local err = "Cannot resolve target " .. tostring(name) .. ": " .. tostring(#candidates) .. " candidates, " .. tostring(#resolved) .. " resolved" |
|
|
|
|
|
|
|
table.insert(errors, { |
|
|
|
|
|
|
|
name = name, |
|
|
|
|
|
|
|
level = level, |
|
|
|
|
|
|
|
err = err |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
error(err) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
return resolved[1] |
|
|
|
end, |
|
|
|
end, |
|
|
|
buildablenodes = function(self) |
|
|
|
buildablenodes = function(self) |
|
|
|
local _accum_0 = { } |
|
|
|
local _accum_0 = { } |
|
|
@ -1917,7 +1956,7 @@ do |
|
|
|
return false |
|
|
|
return false |
|
|
|
end |
|
|
|
end |
|
|
|
if not (quiet) then |
|
|
|
if not (quiet) then |
|
|
|
print(tostring(self.type == 'virtual' and "Running" or "Building") .. " " .. tostring(self.name)) |
|
|
|
print(tostring(self.type == 'virtual' and "Running" or "Building") .. " " .. tostring(self.name) .. " [level " .. tostring(self.level) .. "]") |
|
|
|
end |
|
|
|
end |
|
|
|
self:actuallybuild() |
|
|
|
self:actuallybuild() |
|
|
|
return true |
|
|
|
return true |
|
|
@ -1999,8 +2038,8 @@ do |
|
|
|
} |
|
|
|
} |
|
|
|
_base_0.__index = _base_0 |
|
|
|
_base_0.__index = _base_0 |
|
|
|
_class_0 = setmetatable({ |
|
|
|
_class_0 = setmetatable({ |
|
|
|
__init = function(self, dag, target, name) |
|
|
|
__init = function(self, dag, target, name, level, errors) |
|
|
|
self.dag, self.name = dag, name |
|
|
|
self.dag, self.name, self.level = dag, name, level |
|
|
|
self.priority = target.priority |
|
|
|
self.priority = target.priority |
|
|
|
self.buildfunctions = target.buildfunctions |
|
|
|
self.buildfunctions = target.buildfunctions |
|
|
|
self.mkdirs = target._mkdirs |
|
|
|
self.mkdirs = target._mkdirs |
|
|
@ -2015,7 +2054,7 @@ do |
|
|
|
self.built = false |
|
|
|
self.built = false |
|
|
|
local resolve |
|
|
|
local resolve |
|
|
|
resolve = function(name) |
|
|
|
resolve = function(name) |
|
|
|
return self.dag:resolvedeps(patsubst(self.name, target.pattern, name)) |
|
|
|
return self.dag:resolvedeps((patsubst(self.name, target.pattern, name)), level + 1, errors) |
|
|
|
end |
|
|
|
end |
|
|
|
local after = flatten(foreach(target.needtargets, resolve)) |
|
|
|
local after = flatten(foreach(target.needtargets, resolve)) |
|
|
|
local deps = flatten(foreach(target.infiles, resolve)) |
|
|
|
local deps = flatten(foreach(target.infiles, resolve)) |
|
|
@ -2750,8 +2789,6 @@ end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local loadfile |
|
|
|
local loadfile |
|
|
|
loadfile = require('moonscript.base').loadfile |
|
|
|
loadfile = require('moonscript.base').loadfile |
|
|
|
local Context = require('moonbuild.context') |
|
|
|
local Context = require('moonbuild.context') |
|
|
|