Added ability for duplicate build commands to be specified. Fixes #540

This commit is contained in:
Sam Surtees 2016-09-23 00:54:18 +10:00
parent bf4bf55d11
commit e8789acbe7
3 changed files with 19 additions and 6 deletions

View File

@ -845,6 +845,7 @@
kind = "list:string",
tokens = true,
pathVars = true,
allowDuplicates = true,
}
api.register {
@ -861,6 +862,7 @@
kind = "list:string",
tokens = true,
pathVars = true,
allowDuplicates = true,
}
api.register {

View File

@ -903,8 +903,8 @@
-- contain any other kind of data.
---
local function storeListItem(current, item)
if current[item] then
local function storeListItem(current, item, allowDuplicates)
if not allowDuplicates and current[item] then
table.remove(current, table.indexof(current, item))
end
table.insert(current, item)
@ -937,13 +937,13 @@
if type(value) == "table" then
if #value > 0 then
for i = 1, #value do
storeListItem(current, value[i])
storeListItem(current, value[i], field.allowDuplicates)
end
elseif not table.isempty(value) then
storeListItem(current, value)
storeListItem(current, value, field.allowDuplicates)
end
elseif value then
storeListItem(current, value)
storeListItem(current, value, field.allowDuplicates)
end
return current
@ -953,7 +953,7 @@
local function mergeList(field, current, value, processor)
value = value or {}
for i = 1, #value do
storeListItem(current, value[i])
storeListItem(current, value[i], field.allowDuplicates)
end
return current
end

View File

@ -85,6 +85,17 @@
end
--
-- Multiple of the same command should be emit.
--
function suite.onCommandTwice()
postbuildcommands { "command", "command" }
prepare()
test.capture ("<PostBuildEvent>\n\t<Command>command\r\ncommand</Command>\n</PostBuildEvent>\n")
end
--
-- Quotes should not be escaped, other special characters should.