From f4449e3f97096ac92fe2407d981d76bc6abdf1c8 Mon Sep 17 00:00:00 2001 From: David Given Date: Tue, 7 Jun 2016 04:20:08 +0200 Subject: [PATCH] Multioutput rules work! --- first/ackbuilder.lua | 25 ++++++++++++++----------- first/build.lua | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/first/ackbuilder.lua b/first/ackbuilder.lua index d708105f1..3a85c1e2c 100644 --- a/first/ackbuilder.lua +++ b/first/ackbuilder.lua @@ -204,18 +204,21 @@ local typeconverters = { local o = {} for _, s in ipairs(i) do - if (type(s) ~= "string") then - error(string.format("member of target list '%s' is not a string", propname)) - end - - if s:find("^//") then - s = s:gsub("^//", "") - elseif s:find("^:") then - s = cwd..s - elseif s:find("^[^/]") then - s = concatpath(cwd, s) + if (type(s) == "table") and s.is then + o[#o+1] = s + elseif (type(s) == "string") then + if s:find("^//") then + s = s:gsub("^//", "") + elseif s:find("^:") then + s = cwd..s + elseif s:find("^[^/]") then + s = concatpath(cwd, s) + end + o[#o+1] = loadtarget(s) + else + error(string.format("member of target list '%s' is not a string or a target", + propname)) end - o[#o+1] = loadtarget(s) end return o end, diff --git a/first/build.lua b/first/build.lua index 2b3afb974..2ab1b3cc4 100644 --- a/first/build.lua +++ b/first/build.lua @@ -32,6 +32,25 @@ normalrule { } } +normalrule { + name = "onetwo", + ins = {}, + outleaves = {"one.txt", "two.txt"}, + commands = { + "echo 1 >> %{outs[1]}", + "echo 2 >> %{outs[2]}", + } +} + +normalrule { + name = "concat", + ins = {":onetwo"}, + outleaves = {"result.txt"}, + commands = { + "cat %{ins} > %{outs}" + } +} + simplerule { name = "sorted", ins = { ":random" }, -- 2.34.1