Store config maps in a list, so project script ordering will be maintained
This commit is contained in:
parent
6449bc70a6
commit
1f67707a9b
@ -137,7 +137,7 @@
|
||||
api.register {
|
||||
name = "configmap",
|
||||
scope = "config",
|
||||
kind = "keyed:array:string",
|
||||
kind = "list:keyed:array:string",
|
||||
}
|
||||
|
||||
api.register {
|
||||
|
@ -380,17 +380,7 @@
|
||||
local terms = table.deepcopy(ctx.terms)
|
||||
terms.configurations = configurations
|
||||
terms.platforms = platforms
|
||||
|
||||
-- assemble all matching configmaps, and then merge their keys
|
||||
-- into the project's configmap
|
||||
|
||||
local map = configset.fetch(cset, premake.field.get("configmap"), terms)
|
||||
if map then
|
||||
for key, value in pairs(map) do
|
||||
ctx.configmap[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
ctx.configmap = configset.fetch(cset, premake.field.get("configmap"), terms)
|
||||
end
|
||||
|
||||
|
||||
|
@ -510,19 +510,22 @@
|
||||
return true
|
||||
end
|
||||
|
||||
for pattern, replacements in pairs(prj.configmap or {}) do
|
||||
if type(pattern) ~= "table" then
|
||||
pattern = { pattern }
|
||||
end
|
||||
local maps = prj.configmap or {}
|
||||
for mi = 1, #maps do
|
||||
for pattern, replacements in pairs(maps[mi]) do
|
||||
if type(pattern) ~= "table" then
|
||||
pattern = { pattern }
|
||||
end
|
||||
|
||||
-- does this pattern match any part of the pair? If so,
|
||||
-- replace it with the corresponding values
|
||||
for i = 1, #pairing do
|
||||
if testpattern(pattern, pairing, i) then
|
||||
if #pattern == 1 and #replacements == 1 then
|
||||
pairing[i] = replacements[1]
|
||||
else
|
||||
pairing = { replacements[1], replacements[2] }
|
||||
-- does this pattern match any part of the pair? If so,
|
||||
-- replace it with the corresponding values
|
||||
for i = 1, #pairing do
|
||||
if testpattern(pattern, pairing, i) then
|
||||
if #pattern == 1 and #replacements == 1 then
|
||||
pairing[i] = replacements[1]
|
||||
else
|
||||
pairing = { replacements[1], replacements[2] }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -210,7 +210,7 @@
|
||||
configset.addblock(cset, { "windows" })
|
||||
configset.store(cset, f, { Profile="Profile" })
|
||||
local x = configset.fetch(cset, f, {"windows"})
|
||||
test.istrue(x.Debug and x.Release and x.Profile)
|
||||
test.istrue(x[1].Debug and x[1].Release and x[2].Profile)
|
||||
end
|
||||
|
||||
|
||||
@ -223,7 +223,7 @@
|
||||
configset.store(cset, f, { Debug="Debug", Release="Release" })
|
||||
configset.store(cset, f, { Profile="Profile" })
|
||||
local x = configset.fetch(cset, f, {"windows"})
|
||||
test.istrue(x.Debug and x.Release and x.Profile)
|
||||
test.istrue(x[1].Debug and x[1].Release and x[2].Profile)
|
||||
end
|
||||
|
||||
|
||||
@ -237,7 +237,7 @@
|
||||
configset.addblock(cset, { "windows" })
|
||||
configset.store(cset, f, { Debug="Development" })
|
||||
local x = configset.fetch(cset, f, {"windows"})
|
||||
test.isequal({"Development"}, x.Debug)
|
||||
test.isequal({"Development"}, x[2].Debug)
|
||||
end
|
||||
|
||||
function suite.keyed_overwritesValues_onNonMergeAdd()
|
||||
@ -245,5 +245,5 @@
|
||||
configset.store(cset, f, { Debug="Debug" })
|
||||
configset.store(cset, f, { Debug="Development" })
|
||||
local x = configset.fetch(cset, f, {"windows"})
|
||||
test.isequal({"Development"}, x.Debug)
|
||||
test.isequal({"Development"}, x[2].Debug)
|
||||
end
|
||||
|
Reference in New Issue
Block a user