Apply removes first instead of last, to give projects a way to clear the slate of solution level settings

This commit is contained in:
Jason Perkins 2012-05-22 16:24:53 -04:00
parent e9a81b6f86
commit 4d1ad673fd
3 changed files with 10 additions and 24 deletions

View File

@ -285,6 +285,10 @@
--
function oven.merge(cfg, block, filterField)
if block.removes then
oven.remove(cfg, block.removes, filterField)
end
if filterField then
if block[filterField] then
oven.mergefield(cfg, filterField, block[filterField])
@ -297,10 +301,6 @@
end
end
if block.removes then
oven.remove(cfg, block.removes, filterField)
end
-- remember the container object (solution, project, etc.)
cfg[type(block)] = block

View File

@ -59,7 +59,7 @@ endif
-- over as the default config as well.
--
function suite.defaultsToFirstPairing_onPlatforms()
function suite.usesFirstValidPairing_onExcludedConfig()
platforms { "Win32", "Win64" }
removeconfigurations { "Debug" }
prepare()
@ -69,22 +69,3 @@ ifndef config
endif
]]
end
--
-- If the project excludes a solution platform, it should be skipped
-- over as the default config as well.
--
function suite.defaultsToFirstPairing_onPlatforms()
platforms { "Win32", "Win64" }
removeplatforms { "Win32" }
prepare()
test.capture [[
ifndef config
config=debug_win64
endif
]]
end

View File

@ -31,6 +31,7 @@
function suite.remove_onExactValueMatch()
flags { "Symbols", "Optimize", "NoRTTI" }
configuration {}
removeflags "Optimize"
prepare()
test.isequal({ "Symbols", "NoRTTI" }, cfg.flags)
@ -38,6 +39,7 @@
function suite.remove_onMultipleValues()
flags { "Symbols", "NoExceptions", "Optimize", "NoRTTI" }
configuration {}
removeflags { "NoExceptions", "NoRTTI" }
prepare()
test.isequal({ "Symbols", "Optimize" }, cfg.flags)
@ -50,6 +52,7 @@
function suite.remove_onWildcard()
defines { "WIN32", "WIN64", "LINUX", "MACOSX" }
configuration {}
removedefines { "WIN*" }
prepare()
test.isequal({ "LINUX", "MACOSX" }, cfg.defines)
@ -61,6 +64,7 @@
function suite.remove_onExactValueMatch()
flags { "Symbols", "Optimize", "NoRTTI" }
configuration {}
removeflags "Optimize"
prepare()
test.isnil(cfg.flags.Optimize)
@ -72,6 +76,7 @@
function suite.remove_onFileField()
files { "hello.c", "goodbye.c" }
configuration {}
removefiles { "goodbye.c" }
prepare()
test.isequal(path.join(os.getcwd(), "hello.c"), table.concat(cfg.files))