Jason Perkins avatar Jason Perkins committed 540ed97

Fixed handling of deprecations when warning messages have been disabled

Comments (0)

Files changed (1)

 --
 
 	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)
 			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
 
 					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)
 		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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.