When configuration settings overlap, give precedence to the later settings
This commit is contained in:
parent
bf65487655
commit
e9a81b6f86
@ -424,11 +424,16 @@
|
||||
|
||||
function oven.mergetables(original, additions)
|
||||
for _, item in ipairs(additions) do
|
||||
-- prevent duplicates
|
||||
if not original[item] then
|
||||
original[item] = item
|
||||
table.insert(original, item)
|
||||
-- if the item is already in the list, remove it. This allows a
|
||||
-- later configuration block (i.e. a project) to override the
|
||||
-- ordering of values from an earlier block (i.e. a solution).
|
||||
-- Could be a performance hit; have to wait and see.
|
||||
if original[item] then
|
||||
local i = table.indexof(original, item)
|
||||
table.remove(original, i)
|
||||
end
|
||||
original[item] = item
|
||||
table.insert(original, item)
|
||||
end
|
||||
return original
|
||||
end
|
||||
|
@ -150,5 +150,5 @@
|
||||
prj = project("MyProject")
|
||||
defines { "PROJECT", "DUPLICATE" }
|
||||
cfg = oven.bake(prj, sln, {"Debug"})
|
||||
test.isequal("SOLUTION|DUPLICATE|PROJECT", table.concat(cfg.defines, "|"))
|
||||
test.isequal("SOLUTION|PROJECT|DUPLICATE", table.concat(cfg.defines, "|"))
|
||||
end
|
||||
|
@ -18,8 +18,11 @@
|
||||
sln = solution("MySolution")
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local function prepare(buildcfgs)
|
||||
project("MyProject")
|
||||
if buildcfgs then
|
||||
configurations ( buildcfgs )
|
||||
end
|
||||
prj = premake.solution.getproject_ng(sln, 1)
|
||||
for cfg in premake5.project.eachconfig(prj, field) do
|
||||
_p(2,'%s:%s', cfg.buildcfg or "", cfg.platform or "")
|
||||
@ -147,4 +150,22 @@
|
||||
Release:
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- If there is overlap in the solution and project configuration lists,
|
||||
-- the ordering at the project level should be maintained to avoid
|
||||
-- unnecessarily dirtying the project file.
|
||||
--
|
||||
|
||||
function suite.maintainsProjectOrdering_onSolutionOverlap()
|
||||
configurations { "Debug", "Release" }
|
||||
prepare { "Debug", "Development", "Profile", "Release" }
|
||||
test.capture [[
|
||||
Debug:
|
||||
Development:
|
||||
Profile:
|
||||
Release:
|
||||
]]
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user