summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2019-02-03 12:20:55 +0800
committerruki <[email protected]>2019-02-03 12:20:55 +0800
commit2c7a2ff446fd7ad85922a2990d6452627133c8c3 (patch)
treee1502c769f9e1aa590e37b571d453a6123e9cc53 /xmake/core/base
parente35595f73271cb14363c027694183dec3a32e910 (diff)
improve deprecated tips
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/deprecated.lua16
-rw-r--r--xmake/core/base/interpreter.lua22
2 files changed, 27 insertions, 11 deletions
diff --git a/xmake/core/base/deprecated.lua b/xmake/core/base/deprecated.lua
index 89702a89a..657d48f86 100644
--- a/xmake/core/base/deprecated.lua
+++ b/xmake/core/base/deprecated.lua
@@ -48,32 +48,26 @@ end
-- dump all deprecated entries
function deprecated.dump()
- -- the entries
- deprecated._ENTRIES = deprecated._ENTRIES or {}
-
- -- dump all
+ -- dump one or more ..
local index = 0
+ deprecated._ENTRIES = deprecated._ENTRIES or {}
for old, new in pairs(deprecated._ENTRIES) do
- -- trace newline
+ -- trace
if index == 0 then
print("")
end
-
- -- trace
if new then
utils.cprint("${bright color.warning}deprecated: ${clear}please uses %s instead of %s", new, old)
else
utils.cprint("${bright color.warning}deprecated: ${clear}please remove %s", old)
end
- -- too much?
- if index > 6 and not option.get("verbose") then
+ -- show more?
+ if not option.get("verbose") then
utils.cprint("${bright color.warning}deprecated: ${clear}add -v for getting more ..")
break
end
-
- -- update index
index = index + 1
end
end
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 544c2dd5e..4cf4dc307 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -396,6 +396,28 @@ function interpreter:_api_within_scope(scope_kind, apiname)
end
end
+-- set api function within scope
+function interpreter:_api_within_scope_set(scope_kind, apiname, apifunc)
+
+ -- the private
+ local priv = self._PRIVATE
+ assert(priv)
+
+ -- the scopes
+ local scopes = priv._SCOPES
+ assert(scopes)
+
+ -- get scope api
+ if scope_kind and priv._APIS then
+
+ -- get api function
+ local api_scope = priv._APIS[scope_kind]
+ if api_scope then
+ api_scope[apiname] = apifunc
+ end
+ end
+end
+
-- clear results
function interpreter:_clear()