Multioutput rules work!
This commit is contained in:
		
							parent
							
								
									79f7c0ad23
								
							
						
					
					
						commit
						f4449e3f97
					
				
					 2 changed files with 33 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -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))
 | 
			
		||||
			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
 | 
			
		||||
 | 
			
		||||
			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)
 | 
			
		||||
		end
 | 
			
		||||
		return o
 | 
			
		||||
	end,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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" },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue