Fixed handling of deprecations when warning messages have been disabled

This commit is contained in:
Jason Perkins 2013-10-09 16:24:49 -04:00
parent b3f907b111
commit 5855e6f596

View File

@ -201,10 +201,12 @@
--
function api.callback(field, value)
if field.deprecated and type(field.deprecated.handler) == "function" and api._deprecations ~= "off" then
if field.deprecated and type(field.deprecated.handler) == "function" then
field.deprecated.handler(value)
premake.warnOnce(field.name, "the field %s has been deprecated.\n %s", field.name, field.deprecated.message or "")
if api._deprecations == "error" then error("deprecation errors enabled", 3) end
if api._deprecations ~= "off" then
premake.warnOnce(field.name, "the field %s has been deprecated.\n %s", field.name, field.deprecated.message or "")
if api._deprecations == "error" then error("deprecation errors enabled", 3) end
end
end
local target = api.gettarget(field.scope)
@ -258,9 +260,11 @@
if field.deprecated[value] then
local handler = field.deprecated[value]
if handler.remove then handler.remove(value) end
local key = field.name .. "_" .. value
premake.warnOnce(key, "the %s value %s has been deprecated.\n %s", field.name, value, handler.message or "")
if api._deprecations == "error" then error("deprecation errors enabled", 8) end
if api._deprecations ~= "off" then
local key = field.name .. "_" .. value
premake.warnOnce(key, "the %s value %s has been deprecated.\n %s", field.name, value, handler.message or "")
if api._deprecations == "error" then error("deprecation errors enabled", 8) end
end
end
end
@ -270,7 +274,7 @@
recurse(v)
end)
else
if field.deprecated and api._deprecations ~= "off" then
if field.deprecated then
if value:contains("*") then
local current = target.configset[field.name]
local mask = path.wildcards(value)
@ -613,12 +617,14 @@
local value, err = api.checkvalue(value, field)
if err then error({ msg=err }) end
if field.deprecated and field.deprecated[value] and api._deprecations ~= "off" then
if field.deprecated and field.deprecated[value] then
local handler = field.deprecated[value]
handler.add(value)
local key = field.name .. "_" .. value
premake.warnOnce(key, "the %s value %s has been deprecated.\n %s", field.name, value, handler.message or "")
if api._deprecations == "error" then error({ msg="deprecation errors enabled" }) end
if api._deprecations ~= "off" then
local key = field.name .. "_" .. value
premake.warnOnce(key, "the %s value %s has been deprecated.\n %s", field.name, value, handler.message or "")
if api._deprecations == "error" then error({ msg="deprecation errors enabled" }) end
end
end
-- if the target is the project, configset will be set and I can push