use ';' as default separator for vs

This commit is contained in:
WorldofBay 2018-09-05 16:27:18 +02:00 committed by Wolz
parent 1abac192cb
commit 8c5e4e18ad
3 changed files with 60 additions and 5 deletions

View File

@ -36,9 +36,20 @@
value = false,
switch = "-p2"
}
propertydefinition {
name = "TestListProperty",
kind = "list"
}
propertydefinition {
name = "TestListPropertySeparator",
kind = "list",
separator = ","
}
buildmessage 'Rule-ing %{file.name}'
buildcommands 'dorule %{TestProperty} %{TestProperty2} "%{file.path}"'
buildcommands 'dorule %{TestProperty} %{TestProperty2} %{TestListProperty} %{TestListPropertySeparator} "%{file.path}"'
buildoutputs { "%{file.basename}.obj" }
wks = test.createWorkspace()
@ -278,9 +289,40 @@ endif
test.obj: test.rule
@echo Rule-ing test.rule
$(SILENT) dorule -p "test.rule"
$(SILENT) dorule -p "test.rule"
test2.obj: test2.rule
@echo Rule-ing test2.rule
$(SILENT) dorule -p -p2 "test2.rule"
$(SILENT) dorule -p -p2 "test2.rule"
]]
end
function suite.propertydefinitionSeparator()
rules { "TestRule" }
files { "test.rule", "test2.rule" }
filter "files:test.rule"
testRuleVars {
TestListProperty = { "testValue1", "testValue2" }
}
filter "files:test2.rule"
testRuleVars {
TestListPropertySeparator = { "testValue1", "testValue2" }
}
prepare()
test.capture [[
# File Rules
# #############################################
test.obj: test.rule
@echo Rule-ing test.rule
$(SILENT) dorule testValue1\ testValue2 "test.rule"
test2.obj: test2.rule
@echo Rule-ing test2.rule
$(SILENT) dorule testValue1,testValue2 "test2.rule"
]]
end

View File

@ -92,7 +92,19 @@
prepare()
test.capture [[
<MyRule>
<MyVar>a b c</MyVar>
<MyVar>a;b;c</MyVar>
</MyRule>
]]
end
function suite.onCustomListSeparator()
createVar { name="MyVar", kind="list", separator="," }
myRuleVars { MyVar = { "a", "b", "c" } }
prepare()
test.capture [[
<MyRule>
<MyVar>a,b,c</MyVar>
</MyRule>
]]
end

View File

@ -121,7 +121,7 @@
-- list?
if type(value) == "table" then
if #value > 0 then
local sep = prop.separator or " "
local sep = prop.separator or ";"
return table.concat(value, sep)
else
return nil
@ -162,6 +162,7 @@
function rule.expandString(self, prop, value)
if not prop.switch then
prop.separator = prop.separator or " "
return rule.getPropertyString(self, prop, value)
end