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)
|
function oven.mergetables(original, additions)
|
||||||
for _, item in ipairs(additions) do
|
for _, item in ipairs(additions) do
|
||||||
-- prevent duplicates
|
-- if the item is already in the list, remove it. This allows a
|
||||||
if not original[item] then
|
-- later configuration block (i.e. a project) to override the
|
||||||
original[item] = item
|
-- ordering of values from an earlier block (i.e. a solution).
|
||||||
table.insert(original, item)
|
-- 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
|
end
|
||||||
|
original[item] = item
|
||||||
|
table.insert(original, item)
|
||||||
end
|
end
|
||||||
return original
|
return original
|
||||||
end
|
end
|
||||||
|
@ -150,5 +150,5 @@
|
|||||||
prj = project("MyProject")
|
prj = project("MyProject")
|
||||||
defines { "PROJECT", "DUPLICATE" }
|
defines { "PROJECT", "DUPLICATE" }
|
||||||
cfg = oven.bake(prj, sln, {"Debug"})
|
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
|
end
|
||||||
|
@ -18,8 +18,11 @@
|
|||||||
sln = solution("MySolution")
|
sln = solution("MySolution")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function prepare()
|
local function prepare(buildcfgs)
|
||||||
project("MyProject")
|
project("MyProject")
|
||||||
|
if buildcfgs then
|
||||||
|
configurations ( buildcfgs )
|
||||||
|
end
|
||||||
prj = premake.solution.getproject_ng(sln, 1)
|
prj = premake.solution.getproject_ng(sln, 1)
|
||||||
for cfg in premake5.project.eachconfig(prj, field) do
|
for cfg in premake5.project.eachconfig(prj, field) do
|
||||||
_p(2,'%s:%s', cfg.buildcfg or "", cfg.platform or "")
|
_p(2,'%s:%s', cfg.buildcfg or "", cfg.platform or "")
|
||||||
@ -148,3 +151,21 @@
|
|||||||
]]
|
]]
|
||||||
end
|
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