Allow API functions to be flagged as deprecated

This commit is contained in:
Jason Perkins 2013-04-09 10:11:27 -04:00
parent cf9fb335b7
commit d8308eb454
2 changed files with 12 additions and 1 deletions

View File

@ -96,6 +96,12 @@
--
function api.callback(field, value)
if field.deprecated and not field.warned then
local msg = "** Warning: %s has been deprecated.\n See %s for more information."
print(string.format(msg, field.name, _PREMAKE_URL))
field.warned = true
end
local target = api.gettarget(field.scope)
if not value then
@ -532,6 +538,7 @@
scope = "config",
kind = "object",
tokens = true,
deprecated = true, -- 09 Apr 2013
}
api.register {

View File

@ -14,7 +14,8 @@
#define VERSION "HEAD"
#define COPYRIGHT "Copyright (C) 2002-2012 Jason Perkins and the Premake Project"
#define COPYRIGHT "Copyright (C) 2002-2013 Jason Perkins and the Premake Project"
#define PROJECT_URL "https://bitbucket.org/premake/premake-stable/wiki"
#define ERROR_MESSAGE "%s\n"
@ -90,6 +91,9 @@ int premake_init(lua_State* L)
lua_pushstring(L, COPYRIGHT);
lua_setglobal(L, "_PREMAKE_COPYRIGHT");
lua_pushstring(L, PROJECT_URL);
lua_setglobal(L, "_PREMAKE_URL");
/* set the OS platform variable */
lua_pushstring(L, PLATFORM_STRING);
lua_setglobal(L, "_OS");