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

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

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

Loading…
Cancel
Save