From ec5fc1cf7d0a78ee9a3d116945f7f3a4db2d03ae Mon Sep 17 00:00:00 2001 From: Codinget Date: Tue, 1 Dec 2020 21:43:04 +0100 Subject: [PATCH] added @in (but not working due to moonscript bug) and @out --- Build.moon | 12 ++++++------ moonbuild/core/DAG.moon | 8 ++++---- out/moonbuild.lua | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Build.moon b/Build.moon index 00b289a..8364903 100644 --- a/Build.moon +++ b/Build.moon @@ -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 diff --git a/moonbuild/core/DAG.moon b/moonbuild/core/DAG.moon index d536801..1629c86 100644 --- a/moonbuild/core/DAG.moon +++ b/moonbuild/core/DAG.moon @@ -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}" diff --git a/out/moonbuild.lua b/out/moonbuild.lua index e3e9b74..fa0ee4c 100644 --- a/out/moonbuild.lua +++ b/out/moonbuild.lua @@ -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