added @in (but not working due to moonscript bug) and @out

main
Codinget 4 years ago
parent 17578bb721
commit ec5fc1cf7d
  1. 12
      Build.moon
  2. 8
      moonbuild/core/DAG.moon
  3. 8
      out/moonbuild.lua

@ -24,13 +24,13 @@ with public target 'install'
with public target 'install-bin' with public target 'install-bin'
\depends BIN \depends BIN
\produces _.patsubst BIN, 'out/%', '/usr/local/bin/%' \produces _.patsubst BIN, 'out/%', '/usr/local/bin/%'
\fn => _.cmd 'sudo', 'cp', @infile, @outfile \fn => _.cmd 'sudo', 'cp', @infile, @out
\sync! \sync!
with public target 'install-lib' with public target 'install-lib'
\depends LIB \depends LIB
\produces "/usr/local/share/lua/#{LUA\gsub 'lua', ''}/moonbuild.lua" \produces "/usr/local/share/lua/#{LUA\gsub 'lua', ''}/moonbuild.lua"
\fn => _.cmd 'sudo', 'cp', @infile, @outfile \fn => _.cmd 'sudo', 'cp', @infile, @out
\sync! \sync!
with public target 'clean' with public target 'clean'
@ -52,16 +52,16 @@ with target BIN, pattern: 'out/%'
\produces 'out/%' \produces 'out/%'
\mkdirs! \mkdirs!
\fn => \fn =>
_.writefile @outfile, "#!/usr/bin/env #{LUA}\n#{_.readfile @infile}" _.writefile @out, "#!/usr/bin/env #{LUA}\n#{_.readfile @infile}"
_.cmd 'chmod', '+x', @outfile _.cmd 'chmod', '+x', @out
with target LIB with target LIB
\depends 'moonbuild/init.lua' \depends 'moonbuild/init.lua'
\depends LIB_LUA \depends LIB_LUA
\produces '%' \produces '%'
\fn => _.cmd AMALG, '-o', @outfile, '-s', @infile, _.exclude MODULES, 'moonbuild.init' \fn => _.cmd AMALG, '-o', @out, '-s', @infile, _.exclude MODULES, 'moonbuild.init'
with target {LIB_LUA, BIN_LUA}, pattern: '%.lua' with target {LIB_LUA, BIN_LUA}, pattern: '%.lua'
\depends '%.moon' \depends '%.moon'
\produces '%.lua' \produces '%.lua'
\fn => _.moonc @infile, @outfile \fn => _.moonc @infile, @out

@ -108,12 +108,12 @@ class DepNode
ctx = setmetatable {}, ctx = setmetatable {},
__index: (_, k) -> __index: (_, k) ->
switch k switch k
when 'infile' when 'infile', 'in'
f = first deps f = first deps
f and f.name f and f.name
when 'infiles' when 'infiles'
foreach deps, => @name foreach deps, => @name
when 'outfile' when 'outfile', 'out'
f = first @outs f = first @outs
f and f.name f and f.name
when 'outfiles' when 'outfiles'
@ -182,9 +182,9 @@ class DepNode
ctx = setmetatable {}, ctx = setmetatable {},
__index: (_, k) -> __index: (_, k) ->
switch k switch k
when 'infile' then @ins[1] when 'infile', 'in' then @ins[1]
when 'infiles' then @ins when 'infiles' then @ins
when 'outfile' then @outs[1] when 'outfile', 'out' then @outs[1]
when 'outfiles' then @outs when 'outfiles' then @outs
when 'name' then @name when 'name' then @name
else error "No such field in TargetContext: #{k}" else error "No such field in TargetContext: #{k}"

@ -1952,11 +1952,11 @@ do
local ctx = setmetatable({ }, { local ctx = setmetatable({ }, {
__index = function(_, k) __index = function(_, k)
local _exp_0 = k local _exp_0 = k
if 'infile' == _exp_0 then if 'infile' == _exp_0 or 'in' == _exp_0 then
return self.ins[1] return self.ins[1]
elseif 'infiles' == _exp_0 then elseif 'infiles' == _exp_0 then
return self.ins return self.ins
elseif 'outfile' == _exp_0 then elseif 'outfile' == _exp_0 or 'out' == _exp_0 then
return self.outs[1] return self.outs[1]
elseif 'outfiles' == _exp_0 then elseif 'outfiles' == _exp_0 then
return self.outs return self.outs
@ -2010,14 +2010,14 @@ do
local ctx = setmetatable({ }, { local ctx = setmetatable({ }, {
__index = function(_, k) __index = function(_, k)
local _exp_0 = k local _exp_0 = k
if 'infile' == _exp_0 then if 'infile' == _exp_0 or 'in' == _exp_0 then
local f = first(deps) local f = first(deps)
return f and f.name return f and f.name
elseif 'infiles' == _exp_0 then elseif 'infiles' == _exp_0 then
return foreach(deps, function(self) return foreach(deps, function(self)
return self.name return self.name
end) end)
elseif 'outfile' == _exp_0 then elseif 'outfile' == _exp_0 or 'out' == _exp_0 then
local f = first(self.outs) local f = first(self.outs)
return f and f.name return f and f.name
elseif 'outfiles' == _exp_0 then elseif 'outfiles' == _exp_0 then

Loading…
Cancel
Save