Display deprecation warning for "ng" actions; properly reset state between unit tests

This commit is contained in:
Jason Perkins 2012-11-28 09:55:25 -05:00
parent cdb34181f0
commit 432e99b2c9
3 changed files with 23 additions and 12 deletions

View File

@ -36,6 +36,13 @@
_PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND)
-- The "next-gen" actions have now replaced their deprecated counterparts.
-- Provide a warning for a little while before I remove them entirely.
if _ACTION:endswith("ng") then
_ACTION = _ACTION:sub(1, -3)
print(string.format("** Warning: '%sng' has been deprecated; use '%s' instead", _ACTION, _ACTION))
end
-- Set up the environment for the chosen action early, so side-effects
-- can be picked up by the scripts.

View File

@ -246,6 +246,20 @@
end
--
-- Clears all active API objects; resets to root configuration block.
--
function api.reset()
api.scope = {
root = {
configset = configset.root,
blocks = {} -- TODO: remove this when switch-over to new APIs is done
}
}
end
--
-- Set a new array value. Arrays are lists of values stored by "value",
-- in that new values overwrite old ones, rather than merging like lists.
@ -887,17 +901,7 @@
-- Everything below this point is a candidate for deprecation
-----------------------------------------------------------------------------
--
-- Set up a dummy "root" container to hold global configuration data. This
-- can go away with the rest of this deprecated code when the new config
-- system is finished.
--
api.scope.root = {
configset = configset.root,
blocks = {}
}
api.reset()
premake.CurrentContainer = api.scope.root

View File

@ -241,7 +241,7 @@
_OS = _OS_host
premake.solution.list = { }
premake.api.scope = { }
premake.api.reset()
io.indent = nil
io.eol = "\n"