From 3b960f01be85e2dae618b68478d8255bce3e6f01 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 10 Nov 2014 17:41:31 -0500 Subject: [PATCH] Turn off deprecation warnings for fields and values that can be easily translated. To ease the transition to 5.0, allow these values to continue to work while marking them deprecated in the documentation. Will put the messages back some time after release when folks have had a chance to switch. --- src/_premake_init.lua | 16 ++++++++-------- src/base/api.lua | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/_premake_init.lua b/src/_premake_init.lua index 4207f6cf..775b568e 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -777,7 +777,7 @@ -- 09 Apr 2013 - api.deprecateField("buildrule", DOC_URL .. "Custom_Build_Commands", + api.deprecateField("buildrule", nil, function(value) if value.description then buildmessage(value.description) @@ -788,14 +788,14 @@ -- 17 Jun 2013 - api.deprecateValue("flags", "Component", DOC_URL .. "buildaction", + api.deprecateValue("flags", "Component", nil, function(value) buildaction "Component" end) -- 26 Sep 2013 - api.deprecateValue("flags", { "EnableSSE", "EnableSSE2" }, DOC_URL .. "vectorextensions", + api.deprecateValue("flags", { "EnableSSE", "EnableSSE2" }, nil, function(value) vectorextensions(value:sub(7)) end, @@ -803,7 +803,7 @@ vectorextension "Default" end) - api.deprecateValue("flags", { "FloatFast", "FloatStrict" }, DOC_URL .. "floatingpoint", + api.deprecateValue("flags", { "FloatFast", "FloatStrict" }, nil, function(value) floatingpoint(value:sub(6)) end, @@ -811,7 +811,7 @@ floatingpoint "Default" end) - api.deprecateValue("flags", { "NativeWChar", "NoNativeWChar" }, DOC_URL .. "nativewchar", + api.deprecateValue("flags", { "NativeWChar", "NoNativeWChar" }, nil, function(value) local map = { NativeWChar = "On", NoNativeWChar = "Off" } nativewchar(map[value] or "Default") @@ -820,7 +820,7 @@ nativewchar "Default" end) - api.deprecateValue("flags", { "Optimize", "OptimizeSize", "OptimizeSpeed" }, DOC_URL .. "optimize", + api.deprecateValue("flags", { "Optimize", "OptimizeSize", "OptimizeSpeed" }, nil, function(value) local map = { Optimize = "On", OptimizeSize = "Size", OptimizeSpeed = "Speed" } optimize (map[value] or "Off") @@ -829,7 +829,7 @@ optimize "Off" end) - api.deprecateValue("flags", { "Optimise", "OptimiseSize", "OptimiseSpeed" }, DOC_URL .. "optimize", + api.deprecateValue("flags", { "Optimise", "OptimiseSize", "OptimiseSpeed" }, nil, function(value) local map = { Optimise = "On", OptimiseSize = "Size", OptimiseSpeed = "Speed" } optimize (map[value] or "Off") @@ -838,7 +838,7 @@ optimize "Off" end) - api.deprecateValue("flags", { "ExtraWarnings", "NoWarnings" }, DOC_URL .. "warnings", + api.deprecateValue("flags", { "ExtraWarnings", "NoWarnings" }, nil, function(value) local map = { ExtraWarnings = "Extra", NoWarnings = "Off" } warnings (map[value] or "Default") diff --git a/src/base/api.lua b/src/base/api.lua index 8d501dd0..d7eb0ba1 100755 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -491,8 +491,8 @@ if field.deprecated and type(field.deprecated.handler) == "function" then field.deprecated.handler(value) - if api._deprecations ~= "off" then - premake.warnOnce(field.name, "the field %s has been deprecated.\n %s", field.name, field.deprecated.message or "") + if field.deprecated.message and api._deprecations ~= "off" then + premake.warnOnce(field.name, "the field %s has been deprecated.\n %s", field.name, field.deprecated.message) if api._deprecations == "error" then error("deprecation errors enabled", 3) end end end @@ -542,9 +542,9 @@ if field.deprecated[value] then local handler = field.deprecated[value] if handler.remove then handler.remove(value) end - if api._deprecations ~= "off" then + if handler.message and 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 "") + premake.warnOnce(key, "the %s value %s has been deprecated.\n %s", field.name, value, handler.message) if api._deprecations == "error" then error { msg="deprecation errors enabled" } end @@ -643,9 +643,9 @@ if field.deprecated and field.deprecated[canonical] then local handler = field.deprecated[canonical] handler.add(canonical) - if api._deprecations ~= "off" then + if handler.message and api._deprecations ~= "off" then local key = field.name .. "_" .. value - premake.warnOnce(key, "the %s value %s has been deprecated.\n %s", field.name, canonical, handler.message or "") + premake.warnOnce(key, "the %s value %s has been deprecated.\n %s", field.name, canonical, handler.message) if api._deprecations == "error" then return nil, "deprecation errors enabled" end