summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-27 13:25:19 +0800
committerruki <[email protected]>2016-05-27 13:25:19 +0800
commitba420896702097733403ec8e3ce56b8ee4e54e88 (patch)
treea5af327e962cba4b8715f68ec45c912f651346c9
parent93a7da63ce2be9f8125c8886c3f319d866d4e439 (diff)
modify interpreter interfaces
-rwxr-xr-xtests/console_objc++/xmake.lua2
-rwxr-xr-xtests/console_objc/xmake.lua2
-rwxr-xr-xxmake/actions/build/xmake.lua6
-rwxr-xr-xxmake/actions/clean/xmake.lua6
-rwxr-xr-xxmake/actions/config/xmake.lua6
-rwxr-xr-xxmake/actions/create/xmake.lua6
-rwxr-xr-xxmake/actions/global/xmake.lua6
-rwxr-xr-xxmake/actions/install/xmake.lua4
-rwxr-xr-xxmake/actions/package/xmake.lua4
-rwxr-xr-xxmake/actions/run/xmake.lua6
-rwxr-xr-xxmake/actions/uninstall/xmake.lua4
-rw-r--r--xmake/core/base/deprecated/interpreter.lua8
-rw-r--r--xmake/core/base/interpreter.lua158
-rw-r--r--xmake/core/platform/platform.lua14
-rw-r--r--xmake/core/project/deprecated/project.lua18
-rw-r--r--xmake/core/project/project.lua266
-rw-r--r--xmake/core/project/task.lua14
-rw-r--r--xmake/core/project/template.lua9
-rwxr-xr-xxmake/platforms/android/xmake.lua38
-rwxr-xr-xxmake/platforms/iphoneos/xmake.lua66
-rwxr-xr-xxmake/platforms/iphonesimulator/xmake.lua66
-rwxr-xr-xxmake/platforms/linux/xmake.lua10
-rwxr-xr-xxmake/platforms/macosx/xmake.lua50
-rwxr-xr-xxmake/platforms/mingw/xmake.lua10
-rwxr-xr-xxmake/platforms/watchos/xmake.lua66
-rwxr-xr-xxmake/platforms/watchsimulator/xmake.lua66
-rwxr-xr-xxmake/platforms/windows/xmake.lua36
-rwxr-xr-xxmake/plugins/doxygen/xmake.lua4
-rwxr-xr-xxmake/plugins/hello/xmake.lua6
-rwxr-xr-xxmake/plugins/lua/xmake.lua6
-rwxr-xr-xxmake/plugins/macro/xmake.lua4
-rwxr-xr-xxmake/plugins/makefile/xmake.lua6
32 files changed, 521 insertions, 452 deletions
diff --git a/tests/console_objc++/xmake.lua b/tests/console_objc++/xmake.lua
index 3e7951e69..00884ee70 100755
--- a/tests/console_objc++/xmake.lua
+++ b/tests/console_objc++/xmake.lua
@@ -22,7 +22,7 @@ if is_mode("release") then
end
-- for macosx or ios
-if os("macosx", "ios") then
+if is_os("macosx", "ios") then
-- add framework
add_mxflags("-framework Foundation", "-framework CoreFoundation")
diff --git a/tests/console_objc/xmake.lua b/tests/console_objc/xmake.lua
index 0b4b78c4d..fb1c495bf 100755
--- a/tests/console_objc/xmake.lua
+++ b/tests/console_objc/xmake.lua
@@ -22,7 +22,7 @@ if is_mode("release") then
end
-- for macosx or ios
-if os("macosx", "ios") then
+if is_os("macosx", "ios") then
-- add framework
add_mxflags("-framework Foundation", "-framework CoreFoundation")
diff --git a/xmake/actions/build/xmake.lua b/xmake/actions/build/xmake.lua
index a6bc1c8e4..91e13b88d 100755
--- a/xmake/actions/build/xmake.lua
+++ b/xmake/actions/build/xmake.lua
@@ -24,13 +24,13 @@
task("build")
-- set category
- set_task_category("main")
+ set_category("main")
-- on run
- on_task_run("main")
+ on_run("main")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake [task] [options] [target]"
diff --git a/xmake/actions/clean/xmake.lua b/xmake/actions/clean/xmake.lua
index f0fdf3516..146190059 100755
--- a/xmake/actions/clean/xmake.lua
+++ b/xmake/actions/clean/xmake.lua
@@ -24,13 +24,13 @@
task("clean")
-- set category
- set_task_category("action")
+ set_category("action")
-- on run
- on_task_run("main")
+ on_run("main")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake clean|c [options] [target]"
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index d0f2370f4..a292d2312 100755
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -24,13 +24,13 @@
task("config")
-- set category
- set_task_category("action")
+ set_category("action")
-- on run
- on_task_run("main")
+ on_run("main")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake config|f [options] [target]"
diff --git a/xmake/actions/create/xmake.lua b/xmake/actions/create/xmake.lua
index 2ba3bf7b1..4e5165964 100755
--- a/xmake/actions/create/xmake.lua
+++ b/xmake/actions/create/xmake.lua
@@ -24,13 +24,13 @@
task("create")
-- set category
- set_task_category("action")
+ set_category("action")
-- on run
- on_task_run("main")
+ on_run("main")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake create [options] [target]"
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index 13b5849f7..757a19b27 100755
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -24,13 +24,13 @@
task("global")
-- set category
- set_task_category("action")
+ set_category("action")
-- on run
- on_task_run("main")
+ on_run("main")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake global|g [options] [target]"
diff --git a/xmake/actions/install/xmake.lua b/xmake/actions/install/xmake.lua
index f3c194760..f9de9dc9a 100755
--- a/xmake/actions/install/xmake.lua
+++ b/xmake/actions/install/xmake.lua
@@ -24,10 +24,10 @@
task("install")
-- set category
- set_task_category("action")
+ set_category("action")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake install|i [options] [target]"
diff --git a/xmake/actions/package/xmake.lua b/xmake/actions/package/xmake.lua
index 618c70c52..76c60c728 100755
--- a/xmake/actions/package/xmake.lua
+++ b/xmake/actions/package/xmake.lua
@@ -24,10 +24,10 @@
task("package")
-- set category
- set_task_category("action")
+ set_category("action")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake package|p [options] [target]"
diff --git a/xmake/actions/run/xmake.lua b/xmake/actions/run/xmake.lua
index bc5890f34..6f528e99d 100755
--- a/xmake/actions/run/xmake.lua
+++ b/xmake/actions/run/xmake.lua
@@ -24,13 +24,13 @@
task("run")
-- set category
- set_task_category("action")
+ set_category("action")
-- on run
- on_task_run("main")
+ on_run("main")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake run|r [options] [target] [arguments]"
diff --git a/xmake/actions/uninstall/xmake.lua b/xmake/actions/uninstall/xmake.lua
index c871f1b3b..5cac0ee20 100755
--- a/xmake/actions/uninstall/xmake.lua
+++ b/xmake/actions/uninstall/xmake.lua
@@ -24,10 +24,10 @@
task("uninstall")
-- set category
- set_task_category("action")
+ set_category("action")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake uninstall|u [options] [target]"
diff --git a/xmake/core/base/deprecated/interpreter.lua b/xmake/core/base/deprecated/interpreter.lua
index 1c4f8e18e..b905ff50d 100644
--- a/xmake/core/base/deprecated/interpreter.lua
+++ b/xmake/core/base/deprecated/interpreter.lua
@@ -68,7 +68,7 @@ function deprecated_interpreter:api_register_set_scope(...)
end
-- register implementation
- self:_api_register_xxx_scope("set", implementation, ...)
+ self:_api_register_xxx_scope(nil, "set", implementation, ...)
end
-- register api for add_scope()
@@ -107,11 +107,11 @@ function deprecated_interpreter:api_register_add_scope(...)
end
-- register implementation
- self:_api_register_xxx_scope("add", implementation, ...)
+ self:_api_register_xxx_scope(nil, "add", implementation, ...)
end
-- register api for set_script
-function deprecated_interpreter:api_register_set_script(scope_kind, prefix, ...)
+function deprecated_interpreter:api_register_set_script(scope_kind, ...)
-- check
assert(self)
@@ -135,7 +135,7 @@ function deprecated_interpreter:api_register_set_script(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "set", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "set", implementation, ...)
end
-- return module: deprecated_interpreter
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index b105b3423..a9bbadd9a 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -74,7 +74,7 @@ function interpreter._traceback(errors)
end
-- register api: xxx_apiname()
-function interpreter:_api_register_xxx_scope(action, apifunc, ...)
+function interpreter:_api_register_xxx_scope(scope_kind, action, apifunc, ...)
-- check
assert(self and self._PUBLIC and self._PRIVATE)
@@ -93,7 +93,7 @@ function interpreter:_api_register_xxx_scope(action, apifunc, ...)
end
-- register scope api
- self:api_register(fullname, function (self, ...)
+ self:api_register(scope_kind, fullname, function (self, ...)
-- check
assert(self and self._PRIVATE and apiname)
@@ -104,12 +104,13 @@ function interpreter:_api_register_xxx_scope(action, apifunc, ...)
-- call function
return apifunc(self, scopes, apiname, ...)
+
end)
end
end
-- register api: xxx_values()
-function interpreter:_api_register_xxx_values(scope_kind, action, prefix, apifunc, ...)
+function interpreter:_api_register_xxx_values(scope_kind, action, apifunc, ...)
-- check
assert(self and self._PUBLIC and self._PRIVATE)
@@ -149,8 +150,7 @@ function interpreter:_api_register_xxx_values(scope_kind, action, prefix, apifun
end
-- register implementation
- if prefix then action = action .. "_" .. prefix end
- self:_api_register_xxx_scope(action, implementation, ...)
+ self:_api_register_xxx_scope(scope_kind, action, implementation, ...)
end
-- translate api pathes
@@ -423,15 +423,32 @@ function interpreter.new()
-- init an interpreter instance
local instance = { _PUBLIC = {}
- , _PRIVATE = { _SCOPES = {}
- , _MTIMES = {}}}
+ , _PRIVATE = { _SCOPES = {}
+ , _MTIMES = {}}}
-- inherit the interfaces of interpreter
table.inherit2(instance, interpreter)
+ -- dispatch the api calling for scope
+ setmetatable(instance._PUBLIC, { __index = function (tbl, key)
+
+ -- get scope kind
+ local apifunc = nil
+ local priv = instance._PRIVATE
+ local scope_kind = priv._SCOPES._CURRENT_KIND or priv._ROOTSCOPE
+ if scope_kind and priv._APIS then
+
+ -- get api function
+ apifunc = priv._APIS[scope_kind][key]
+ end
+
+ -- ok?
+ return apifunc
+ end})
+
-- register the builtin interfaces
- instance:api_register("add_subdirs", interpreter.api_builtin_add_subdirs)
- instance:api_register("add_subfiles", interpreter.api_builtin_add_subfiles)
+ instance:api_register(nil, "add_subdirs", interpreter.api_builtin_add_subdirs)
+ instance:api_register(nil, "add_subfiles", interpreter.api_builtin_add_subfiles)
-- register the builtin interfaces for lua
instance:api_register_builtin("print", print)
@@ -537,15 +554,65 @@ function interpreter:rootdir_set(rootdir)
self._PRIVATE._ROOTDIR = rootdir
end
+-- set root scope kind
+--
+-- the root api will affect these scopes
+--
+function interpreter:rootscope_set(scope_kind)
+
+ -- check
+ assert(self and self._PRIVATE)
+
+ -- set it
+ self._PRIVATE._ROOTSCOPE = scope_kind
+end
+
-- register api
-function interpreter:api_register(name, func)
+--
+-- interp:api_register(nil, "apiroot", function () end)
+-- interp:api_register("scope_kind", "apiname", function () end)
+--
+-- result:
+--
+-- _PUBLIC
+-- {
+-- apiroot = function () end
+-- }
+--
+-- _PRIVATE
+-- {
+-- _APIS
+-- {
+-- scope_kind
+-- {
+-- apiname = function () end
+-- }
+-- }
+-- }
+--
+function interpreter:api_register(scope_kind, name, func)
-- check
- assert(self and self._PUBLIC)
+ assert(self and self._PUBLIC and self._PRIVATE)
assert(name and func)
- -- register it
- self._PUBLIC[name] = function (...) return func(self, ...) end
+ -- register api to the given scope kind
+ if scope_kind and scope_kind ~= "__rootkind" then
+
+ -- get apis
+ self._PRIVATE._APIS = self._PRIVATE._APIS or {}
+ local apis = self._PRIVATE._APIS
+
+ -- get scope
+ apis[scope_kind] = apis[scope_kind] or {}
+ local scope = apis[scope_kind]
+
+ -- register api
+ scope[name] = function (...) return func(self, ...) end
+ else
+ -- register api to the root scope
+ self._PUBLIC[name] = function (...) return func(self, ...) end
+ end
end
-- register api for builtin
@@ -610,19 +677,26 @@ function interpreter:api_register_scope(...)
local scope_for_kind = scopes[scope_kind] or {}
scopes[scope_kind] = scope_for_kind
- -- init scope for name
- scope_for_kind[scope_name] = scope_for_kind[scope_name] or {}
+ -- enter the given scope
+ if scope_name ~= nil then
+
+ -- init scope for name
+ scope_for_kind[scope_name] = scope_for_kind[scope_name] or {}
- -- save the current scope
- scopes._CURRENT = scope_for_kind[scope_name]
+ -- save the current scope
+ scopes._CURRENT = scope_for_kind[scope_name]
+ else
+
+ -- enter root scope
+ scopes._CURRENT = nil
+ end
-- update the current scope kind
scopes._CURRENT_KIND = scope_kind
-
end
-- register implementation
- self:_api_register_xxx_scope(nil, implementation, ...)
+ self:_api_register_xxx_scope(nil, nil, implementation, ...)
end
-- register api for set_values
@@ -660,7 +734,7 @@ end
-- }
-- }
--
-function interpreter:api_register_set_values(scope_kind, prefix, ...)
+function interpreter:api_register_set_values(scope_kind, ...)
-- check
assert(self)
@@ -675,11 +749,11 @@ function interpreter:api_register_set_values(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "set", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "set", implementation, ...)
end
-- register api for add_values
-function interpreter:api_register_add_values(scope_kind, prefix, ...)
+function interpreter:api_register_add_values(scope_kind, ...)
-- check
assert(self)
@@ -694,11 +768,11 @@ function interpreter:api_register_add_values(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "add", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "add", implementation, ...)
end
-- register api for set_array
-function interpreter:api_register_set_array(scope_kind, prefix, ...)
+function interpreter:api_register_set_array(scope_kind, ...)
-- check
assert(self)
@@ -713,11 +787,11 @@ function interpreter:api_register_set_array(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "set", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "set", implementation, ...)
end
-- register api for add_array
-function interpreter:api_register_add_array(scope_kind, prefix, ...)
+function interpreter:api_register_add_array(scope_kind, ...)
-- check
assert(self)
@@ -732,11 +806,11 @@ function interpreter:api_register_add_array(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "add", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "add", implementation, ...)
end
-- register api for on_script
-function interpreter:api_register_on_script(scope_kind, prefix, ...)
+function interpreter:api_register_on_script(scope_kind, ...)
-- check
assert(self)
@@ -755,11 +829,11 @@ function interpreter:api_register_on_script(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "on", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "on", implementation, ...)
end
-- register api for before_script
-function interpreter:api_register_before_script(scope_kind, prefix, ...)
+function interpreter:api_register_before_script(scope_kind, ...)
-- check
assert(self)
@@ -778,11 +852,11 @@ function interpreter:api_register_before_script(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "before", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "before", implementation, ...)
end
-- register api for after_script
-function interpreter:api_register_after_script(scope_kind, prefix, ...)
+function interpreter:api_register_after_script(scope_kind, ...)
-- check
assert(self)
@@ -801,11 +875,11 @@ function interpreter:api_register_after_script(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "after", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "after", implementation, ...)
end
-- register api for set_keyvalues
-function interpreter:api_register_set_keyvalues(scope_kind, prefix, ...)
+function interpreter:api_register_set_keyvalues(scope_kind, ...)
-- check
assert(self)
@@ -820,11 +894,11 @@ function interpreter:api_register_set_keyvalues(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "set", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "set", implementation, ...)
end
-- register api for add_keyvalues
-function interpreter:api_register_add_keyvalues(scope_kind, prefix, ...)
+function interpreter:api_register_add_keyvalues(scope_kind, ...)
-- check
assert(self)
@@ -863,11 +937,11 @@ function interpreter:api_register_add_keyvalues(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "add", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "add", implementation, ...)
end
-- register api for set_pathes
-function interpreter:api_register_set_pathes(scope_kind, prefix, ...)
+function interpreter:api_register_set_pathes(scope_kind, ...)
-- check
assert(self)
@@ -882,11 +956,11 @@ function interpreter:api_register_set_pathes(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "set", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "set", implementation, ...)
end
-- register api for add_pathes
-function interpreter:api_register_add_pathes(scope_kind, prefix, ...)
+function interpreter:api_register_add_pathes(scope_kind, ...)
-- check
assert(self)
@@ -901,7 +975,7 @@ function interpreter:api_register_add_pathes(scope_kind, prefix, ...)
end
-- register implementation
- self:_api_register_xxx_values(scope_kind, "add", prefix, implementation, ...)
+ self:_api_register_xxx_values(scope_kind, "add", implementation, ...)
end
-- the builtin api: add_subdirs()
@@ -933,7 +1007,7 @@ function interpreter:api_call(apiname, ...)
-- get api function
local apifunc = self._PUBLIC[apiname]
if not apifunc then
- os.raise("call %s() failed, the api %s not found!", apiname)
+ os.raise("call %s() failed, this api not found!", apiname)
end
-- call api function
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index 139375b50..7669f9ddb 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -229,25 +229,25 @@ function platform._interpreter()
interp:api_register_scope("platform")
-- register api: set_platform_os()
- interp:api_register_set_values("platform", "platform", "os")
+ interp:api_register_set_values("platform", "os")
-- register api: set_platform_hosts()
- interp:api_register_set_values("platform", "platform", "hosts")
+ interp:api_register_set_values("platform", "hosts")
-- register api: set_platform_archs()
- interp:api_register_set_values("platform", "platform", "archs")
+ interp:api_register_set_values("platform", "archs")
-- register api: set_platform_menu()
- interp:api_register_set_values("platform", "platform", "menu")
+ interp:api_register_set_values("platform", "menu")
-- register api: set_platform_checker()
- interp:api_register_set_values("platform", "platform", "checker")
+ interp:api_register_set_values("platform", "checker")
-- register api: set_platform_environment()
- interp:api_register_set_values("platform", "platform", "environment")
+ interp:api_register_set_values("platform", "environment")
-- register api: on_platform_load()
- interp:api_register_on_script("platform", "platform", "load")
+ interp:api_register_on_script("platform", "load")
-- save interpreter
platform._INTERPRETER = interp
diff --git a/xmake/core/project/deprecated/project.lua b/xmake/core/project/deprecated/project.lua
index 480aaba81..74073fd5f 100644
--- a/xmake/core/project/deprecated/project.lua
+++ b/xmake/core/project/deprecated/project.lua
@@ -259,17 +259,17 @@ function deprecated_project.api_register(interp)
deprecated_interpreter.api_register_add_scope(interp, "target", "option")
-- register api: set_runscript() and set_installscript() and set_packagescript()
- deprecated_interpreter.api_register_set_script(interp, "target", nil, "runscript"
- , "installscript"
- , "packagescript")
+ deprecated_interpreter.api_register_set_script(interp, "target", nil, "runscript"
+ , "installscript"
+ , "packagescript")
-- register api: os(), kinds(), modes(), plats(), archs(), options()
- interp:api_register("os", deprecated_project._api_os)
- interp:api_register("kinds", deprecated_project._api_kinds)
- interp:api_register("modes", deprecated_project._api_modes)
- interp:api_register("plats", deprecated_project._api_plats)
- interp:api_register("archs", deprecated_project._api_archs)
- interp:api_register("options", deprecated_project._api_options)
+ interp:api_register(nil, "os", deprecated_project._api_os)
+ interp:api_register(nil, "kinds", deprecated_project._api_kinds)
+ interp:api_register(nil, "modes", deprecated_project._api_modes)
+ interp:api_register(nil, "plats", deprecated_project._api_plats)
+ interp:api_register(nil, "archs", deprecated_project._api_archs)
+ interp:api_register(nil, "options", deprecated_project._api_options)
end
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 5c3288435..ece70a50e 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -151,11 +151,11 @@ function project._api_add_cfunc(interp, module, alias, links, includes, cfunc)
-- check option
interp:api_call("option", name)
- interp:api_call("set_option_category", "cfuncs")
- interp:api_call("add_option_cfuncs", cfunc)
- if links then interp:api_call("add_option_links", links) end
- if includes then interp:api_call("add_option_cincludes", includes) end
- interp:api_call("add_option_defines_h_if_ok", define)
+ interp:api_call("set_category", "cfuncs")
+ interp:api_call("add_cfuncs", cfunc)
+ if links then interp:api_call("add_links", links) end
+ if includes then interp:api_call("add_cincludes", includes) end
+ interp:api_call("add_defines_h_if_ok", define)
-- restore the current scope
interp:scope_restore(scope)
@@ -197,11 +197,11 @@ function project._api_add_cfuncs(interp, module, links, includes, ...)
-- check option
interp:api_call("option", name)
- interp:api_call("set_option_category", "cfuncs")
- interp:api_call("add_option_cfuncs", cfunc)
- if links then interp:api_call("add_option_links", links) end
- if includes then interp:api_call("add_option_cincludes", includes) end
- interp:api_call("add_option_defines_h_if_ok", define)
+ interp:api_call("set_category", "cfuncs")
+ interp:api_call("add_cfuncs", cfunc)
+ if links then interp:api_call("add_links", links) end
+ if includes then interp:api_call("add_cincludes", includes) end
+ interp:api_call("add_defines_h_if_ok", define)
-- restore the current scope
interp:scope_restore(scope)
@@ -238,11 +238,11 @@ function project._api_add_cxxfunc(interp, module, alias, links, includes, cxxfun
-- check option
interp:api_call("option", name)
- interp:api_call("set_option_category", "cxxfuncs")
- interp:api_call("add_option_cxxfuncs", cxxfunc)
- if links then interp:api_call("add_option_links", links) end
- if includes then interp:api_call("add_option_cxxincludes", includes) end
- interp:api_call("add_option_defines_h_if_ok", define)
+ interp:api_call("set_category", "cxxfuncs")
+ interp:api_call("add_cxxfuncs", cxxfunc)
+ if links then interp:api_call("add_links", links) end
+ if includes then interp:api_call("add_cxxincludes", includes) end
+ interp:api_call("add_defines_h_if_ok", define)
-- restore the current scope
interp:scope_restore(scope)
@@ -284,11 +284,11 @@ function project._api_add_cxxfuncs(interp, module, links, includes, ...)
-- check option
interp:api_call("option", name)
- interp:api_call("set_option_category", "cxxfuncs")
- interp:api_call("add_option_cxxfuncs", cxxfunc)
- if links then interp:api_call("add_option_links", links) end
- if includes then interp:api_call("add_option_cxxincludes", includes) end
- interp:api_call("add_option_defines_h_if_ok", define)
+ interp:api_call("set_category", "cxxfuncs")
+ interp:api_call("add_cxxfuncs", cxxfunc)
+ if links then interp:api_call("add_links", links) end
+ if includes then interp:api_call("add_cxxincludes", includes) end
+ interp:api_call("add_defines_h_if_ok", define)
-- restore the current scope
interp:scope_restore(scope)
@@ -327,142 +327,140 @@ function project._interpreter()
-- set root directory
interp:rootdir_set(xmake._PROJECT_DIR)
+ -- set root scope
+ interp:rootscope_set("target")
+
-- register api: deprecated
deprecated_project.api_register(interp)
-
+
-- register api: target() and option()
interp:api_register_scope("target", "option")
- -- register api: on_run() and on_install() and on_package()
- interp:api_register_on_script("target", nil, "run"
- , "install"
- , "package")
-
- -- register api: set_values() for target
- interp:api_register_set_values("target", nil, "kind"
- , "config_h_prefix"
- , "version"
- , "strip"
- , "options"
- , "symbols"
- , "warnings"
- , "optimize"
- , "languages")
+ -- register api: set_values() to target
+ interp:api_register_set_values("target", "kind"
+ , "config_h_prefix"
+ , "version"
+ , "strip"
+ , "options"
+ , "symbols"
+ , "warnings"
+ , "optimize"
+ , "languages")
- -- register api: add_values() for target
- interp:api_register_add_values("target", nil, "deps"
- , "links"
- , "cflags"
- , "cxflags"
- , "cxxflags"
- , "mflags"
- , "mxflags"
- , "mxxflags"
- , "ldflags"
- , "shflags"
- , "options"
- , "defines"
- , "undefines"
- , "defines_h"
- , "undefines_h"
- , "languages"
- , "vectorexts")
+ -- register api: add_values() to target
+ interp:api_register_add_values("target", "deps"
+ , "links"
+ , "cflags"
+ , "cxflags"
+ , "cxxflags"
+ , "mflags"
+ , "mxflags"
+ , "mxxflags"
+ , "ldflags"
+ , "shflags"
+ , "options"
+ , "defines"
+ , "undefines"
+ , "defines_h"
+ , "undefines_h"
+ , "languages"
+ , "vectorexts")
- -- register api: set_pathes() for target
- interp:api_register_set_pathes("target", nil, "headerdir"
- , "targetdir"
- , "objectdir"
- , "config_h")
+ -- register api: set_pathes() to target
+ interp:api_register_set_pathes("target", "headerdir"
+ , "targetdir"
+ , "objectdir"
+ , "config_h")
- -- register api: add_pathes() for target
- interp:api_register_add_pathes("target", nil, "files"
- , "headers"
- , "linkdirs"
- , "includedirs")
+ -- register api: add_pathes() to target
+ interp:api_register_add_pathes("target", "files"
+ , "headers"
+ , "linkdirs"
+ , "includedirs")
- -- register api: on_action() for target
- interp.api_register_on_script(interp, "target", nil, "run"
- , "build"
- , "clean"
- , "package"
- , "install"
- , "uninstall")
+ -- register api: on_action() to target
+ interp:api_register_on_script("target", "run"
+ , "build"
+ , "clean"
+ , "package"
+ , "install"
+ , "uninstall")
- -- register api: before_action() for target
- interp.api_register_before_script(interp, "target", nil, "run"
- , "build"
- , "clean"
- , "package"
- , "install"
- , "uninstall")
+ -- register api: before_action() to target
+ interp:api_register_before_script("target", "run"
+ , "build"
+ , "clean"
+ , "package"
+ , "install"
+ , "uninstall")
- -- register api: after_action() for target
- interp.api_register_after_script(interp, "target", nil, "run"
- , "build"
- , "clean"
- , "package"
- , "install"
- , "uninstall")
+ -- register api: after_action() to target
+ interp:api_register_after_script("target", "run"
+ , "build"
+ , "clean"
+ , "package"
+ , "install"
+ , "uninstall")
- -- register api: set_option_values() for option
- interp:api_register_set_values("option", "option", "enable"
- , "showmenu"
- , "category"
- , "warnings"
- , "optimize"
- , "languages"
- , "description")
+ -- register api: set_values() to option
+ interp:api_register_set_values("option", "enable"
+ , "showmenu"
+ , "category"
+ , "warnings"
+ , "optimize"
+ , "languages"
+ , "description")
- -- register api: add_option_values() for option
- interp:api_register_add_values("option", "option", "links"
- , "cincludes"
- , "cxxincludes"
- , "cfuncs"
- , "cxxfuncs"
- , "ctypes"
- , "cxxtypes"
- , "cflags"
- , "cxflags"
- , "cxxflags"
- , "ldflags"
- , "vectorexts"
- , "defines"
- , "defines_if_ok"
- , "defines_h_if_ok"
- , "undefines"
- , "undefines_if_ok"
- , "undefines_h_if_ok")
+ -- register api: add_values() to option
+ interp:api_register_add_values("option", "links"
+ , "cincludes"
+ , "cxxincludes"
+ , "cfuncs"
+ , "cxxfuncs"
+ , "ctypes"
+ , "cxxtypes"
+ , "cflags"
+ , "cxflags"
+ , "cxxflags"
+ , "ldflags"
+ , "vectorexts"
+ , "defines"
+ , "defines_if_ok"
+ , "defines_h_if_ok"
+ , "undefines"
+ , "undefines_if_ok"
+ , "undefines_h_if_ok")
- -- register api: add_option_pathes() for option
- interp:api_register_add_pathes("option", "option", "linkdirs"
- , "includedirs")
+ -- register api: add_pathes() to option
+ interp:api_register_add_pathes("option", "linkdirs"
+ , "includedirs")
- -- register api: is_os(), is_kind(), is_mode(), is_plat(), is_arch(), is_option()
- interp:api_register("is_os", project._api_is_os)
- interp:api_register("is_kind", project._api_is_kind)
- interp:api_register("is_mode", project._api_is_mode)
- interp:api_register("is_plat", project._api_is_plat)
- interp:api_register("is_arch", project._api_is_arch)
- interp:api_register("is_option", project._api_is_option)
+ -- register api: add_cfunc() to target
+ interp:api_register("target", "add_cfunc", project._api_add_cfunc)
- -- register api: add_cfunc()
- interp:api_register("add_cfunc", project._api_add_cfunc)
+ -- register api: add_cfuncs() to target
+ interp:api_register("target", "add_cfuncs", project._api_add_cfuncs)
- -- register api: add_cfuncs()
- interp:api_register("add_cfuncs", project._api_add_cfuncs)
+ -- register api: add_cxxfunc() to target
+ interp:api_register("target", "add_cxxfunc", project._api_add_cxxfunc)
- -- register api: add_cxxfunc()
- interp:api_register("add_cxxfunc", project._api_add_cxxfunc)
+ -- register api: add_cxxfuncs() to target
+ interp:api_register("target", "add_cxxfuncs", project._api_add_cxxfuncs)
- -- register api: add_cxxfuncs()
- interp:api_register("add_cxxfuncs", project._api_add_cxxfuncs)
+ -- register api: is_xxx() to root
+ interp:api_register(nil, "is_os", project._api_is_os)
+ interp:api_register(nil, "is_kind", project._api_is_kind)
+ interp:api_register(nil, "is_mode", project._api_is_mode)
+ interp:api_register(nil, "is_plat", project._api_is_plat)
+ interp:api_register(nil, "is_arch", project._api_is_arch)
+ interp:api_register(nil, "is_option", project._api_is_option)
- -- register api: add_pkgdirs()
- interp:api_register("add_pkgdirs", project._api_add_pkgdirs)
+ -- register api: add_pkgdirs() to root
+ interp:api_register(nil, "add_pkgdirs", project._api_add_pkgdirs)
- -- register api: add_pkgs()
- interp:api_register("add_pkgs", interpreter.api_builtin_add_subdirs)
+ -- register api: add_pkgs() to root
+ interp:api_register(nil, "add_pkgs", interpreter.api_builtin_add_subdirs)
-- set filter
interp:filter_set(filter.new(function (variable)
diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua
index 672df88b0..101a5ca64 100644
--- a/xmake/core/project/task.lua
+++ b/xmake/core/project/task.lua
@@ -162,18 +162,16 @@ function task._interpreter()
-- register api: task()
interp:api_register_scope("task")
- -- register api: set_task_category()
+ -- register api: set_category()
--
-- category: main, action, plugin
- interp:api_register_set_values("task", "task", "category")
+ interp:api_register_set_values("task", "category")
- -- register api: set_task_menu()
- interp:api_register_set_values("task", "task", "menu")
+ -- register api: set_menu()
+ interp:api_register_set_values("task", "menu")
- -- register api: on_task_run(), on_task_before(), on_task_after()
- interp:api_register_on_script("task", "task", "run"
- , "after"
- , "before")
+ -- register api: on_run()
+ interp:api_register_on_script("task", "run")
-- set filter
interp:filter_set(filter.new(function (variable)
diff --git a/xmake/core/project/template.lua b/xmake/core/project/template.lua
index 4ed035fd9..6e7b617bf 100644
--- a/xmake/core/project/template.lua
+++ b/xmake/core/project/template.lua
@@ -47,17 +47,16 @@ function template._interpreter()
assert(interp)
-- register api: set_description() and set_projectdir()
- interp:api_register_set_values(nil, nil, "description"
- , "projectdir")
+ interp:api_register_set_values(nil, "description", "projectdir")
-- register api: add_macrofiles()
- interp:api_register_add_values(nil, nil, "macrofiles")
+ interp:api_register_add_values(nil, "macrofiles")
-- register api: add_macros()
- interp:api_register_add_keyvalues(nil, nil, "macros")
+ interp:api_register_add_keyvalues(nil, "macros")
-- register api: on_create()
- interp:api_register_on_script(nil, nil, "create")
+ interp:api_register_on_script(nil, "create")
-- save interpreter
template._INTERPRETER = interp
diff --git a/xmake/platforms/android/xmake.lua b/xmake/platforms/android/xmake.lua
index c8889a6d1..50ba4db4b 100755
--- a/xmake/platforms/android/xmake.lua
+++ b/xmake/platforms/android/xmake.lua
@@ -24,19 +24,19 @@
platform("android")
-- set os
- set_platform_os("android")
+ set_os("android")
-- set hosts
- set_platform_hosts("macosx", "linux", "windows")
+ set_hosts("macosx", "linux", "windows")
-- set archs
- set_platform_archs("armv5te", "armv6", "armv7-a", "armv8-a", "arm64-v8a")
+ set_archs("armv5te", "armv6", "armv7-a", "armv8-a", "arm64-v8a")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
@@ -93,21 +93,21 @@ platform("android")
end)
-- set menu
- set_platform_menu({
- config =
- {
- {}
- , {nil, "ndk", "kv", nil, "The NDK Directory" }
- , {nil, "ndk_sdkver", "kv", "auto", "The SDK Version for NDK" }
- }
+ set_menu({
+ config =
+ {
+ {}
+ , {nil, "ndk", "kv", nil, "The NDK Directory" }
+ , {nil, "ndk_sdkver", "kv", "auto", "The SDK Version for NDK" }
+ }
- , global =
- {
- {}
- , {nil, "ndk", "kv", nil, "The NDK Directory" }
- , {nil, "ndk_sdkver", "kv", "auto", "The SDK Version for NDK" }
- }
- })
+ , global =
+ {
+ {}
+ , {nil, "ndk", "kv", nil, "The NDK Directory" }
+ , {nil, "ndk_sdkver", "kv", "auto", "The SDK Version for NDK" }
+ }
+ })
diff --git a/xmake/platforms/iphoneos/xmake.lua b/xmake/platforms/iphoneos/xmake.lua
index e7d08ae27..5a0420fce 100755
--- a/xmake/platforms/iphoneos/xmake.lua
+++ b/xmake/platforms/iphoneos/xmake.lua
@@ -24,19 +24,19 @@
platform("iphoneos")
-- set os
- set_platform_os("ios")
+ set_os("ios")
-- set hosts
- set_platform_hosts("macosx")
+ set_hosts("macosx")
-- set archs
- set_platform_archs("armv7", "armv7s", "arm64")
+ set_archs("armv7", "armv7s", "arm64")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
@@ -89,35 +89,35 @@ platform("iphoneos")
end)
-- set menu
- set_platform_menu({
- config =
- {
- {}
- , {nil, "mm", "kv", nil, "the objc compiler" }
- , {nil, "mxx", "kv", nil, "the objc++ compiler" }
- , {nil, "mflags", "kv", nil, "the objc compiler flags" }
- , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
- , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
- , {nil, "target_minver", "kv", "auto", "the target minimal version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
+ set_menu({
+ config =
+ {
+ {}
+ , {nil, "mm", "kv", nil, "the objc compiler" }
+ , {nil, "mxx", "kv", nil, "the objc++ compiler" }
+ , {nil, "mflags", "kv", nil, "the objc compiler flags" }
+ , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
+ , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
+ , {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
+ , {nil, "target_minver", "kv", "auto", "the target minimal version" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
- , global =
- {
- {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
- })
+ , global =
+ {
+ {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
+ })
diff --git a/xmake/platforms/iphonesimulator/xmake.lua b/xmake/platforms/iphonesimulator/xmake.lua
index ae9866479..387ff9b83 100755
--- a/xmake/platforms/iphonesimulator/xmake.lua
+++ b/xmake/platforms/iphonesimulator/xmake.lua
@@ -24,19 +24,19 @@
platform("iphonesimulator")
-- set os
- set_platform_os("ios")
+ set_os("ios")
-- set hosts
- set_platform_hosts("macosx")
+ set_hosts("macosx")
-- set archs
- set_platform_archs("i386", "x86_64")
+ set_archs("i386", "x86_64")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
@@ -91,35 +91,35 @@ platform("iphonesimulator")
end)
-- set menu
- set_platform_menu({
- config =
- {
- {}
- , {nil, "mm", "kv", nil, "the objc compiler" }
- , {nil, "mxx", "kv", nil, "the objc++ compiler" }
- , {nil, "mflags", "kv", nil, "the objc compiler flags" }
- , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
- , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
- , {nil, "target_minver", "kv", "auto", "the target minimal version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
+ set_menu({
+ config =
+ {
+ {}
+ , {nil, "mm", "kv", nil, "the objc compiler" }
+ , {nil, "mxx", "kv", nil, "the objc++ compiler" }
+ , {nil, "mflags", "kv", nil, "the objc compiler flags" }
+ , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
+ , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
+ , {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
+ , {nil, "target_minver", "kv", "auto", "the target minimal version" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
- , global =
- {
- {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
- })
+ , global =
+ {
+ {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
+ })
diff --git a/xmake/platforms/linux/xmake.lua b/xmake/platforms/linux/xmake.lua
index 6d4bbc1b9..c6d6cce0b 100755
--- a/xmake/platforms/linux/xmake.lua
+++ b/xmake/platforms/linux/xmake.lua
@@ -24,19 +24,19 @@
platform("linux")
-- set os
- set_platform_os("linux")
+ set_os("linux")
-- set hosts
- set_platform_hosts("macosx", "linux", "windows")
+ set_hosts("macosx", "linux", "windows")
-- set archs
- set_platform_archs("i386", "x86_64")
+ set_archs("i386", "x86_64")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua
index 5c12d40e8..38f60a11d 100755
--- a/xmake/platforms/macosx/xmake.lua
+++ b/xmake/platforms/macosx/xmake.lua
@@ -24,19 +24,19 @@
platform("macosx")
-- set os
- set_platform_os("macosx")
+ set_os("macosx")
-- set hosts
- set_platform_hosts("macosx")
+ set_hosts("macosx")
-- set archs
- set_platform_archs("i386", "x86_64")
+ set_archs("i386", "x86_64")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
@@ -98,27 +98,27 @@ platform("macosx")
end)
-- set menu
- set_platform_menu({
- config =
- {
- {}
- , {nil, "mm", "kv", nil, "the objc compiler" }
- , {nil, "mxx", "kv", nil, "the objc++ compiler" }
- , {nil, "mflags", "kv", nil, "the objc compiler flags" }
- , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
- , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
- , {nil, "target_minver", "kv", "auto", "the target minimal version" }
- }
+ set_menu({
+ config =
+ {
+ {}
+ , {nil, "mm", "kv", nil, "the objc compiler" }
+ , {nil, "mxx", "kv", nil, "the objc++ compiler" }
+ , {nil, "mflags", "kv", nil, "the objc compiler flags" }
+ , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
+ , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
+ , {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
+ , {nil, "target_minver", "kv", "auto", "the target minimal version" }
+ }
- , global =
- {
- {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- }
- })
+ , global =
+ {
+ {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ }
+ })
diff --git a/xmake/platforms/mingw/xmake.lua b/xmake/platforms/mingw/xmake.lua
index 89e786610..a96ea8706 100755
--- a/xmake/platforms/mingw/xmake.lua
+++ b/xmake/platforms/mingw/xmake.lua
@@ -24,19 +24,19 @@
platform("mingw")
-- set os
- set_platform_os("windows")
+ set_os("windows")
-- set hosts
- set_platform_hosts("macosx", "linux", "windows")
+ set_hosts("macosx", "linux", "windows")
-- set archs
- set_platform_archs("i386", "x86_64")
+ set_archs("i386", "x86_64")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
diff --git a/xmake/platforms/watchos/xmake.lua b/xmake/platforms/watchos/xmake.lua
index 403127739..f12b4a542 100755
--- a/xmake/platforms/watchos/xmake.lua
+++ b/xmake/platforms/watchos/xmake.lua
@@ -24,19 +24,19 @@
platform("watchos")
-- set os
- set_platform_os("ios")
+ set_os("ios")
-- set hosts
- set_platform_hosts("macosx")
+ set_hosts("macosx")
-- set archs
- set_platform_archs("armv7k")
+ set_archs("armv7k")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
@@ -89,35 +89,35 @@ platform("watchos")
end)
-- set menu
- set_platform_menu({
- config =
- {
- {}
- , {nil, "mm", "kv", nil, "the objc compiler" }
- , {nil, "mxx", "kv", nil, "the objc++ compiler" }
- , {nil, "mflags", "kv", nil, "the objc compiler flags" }
- , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
- , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
- , {nil, "target_minver", "kv", "auto", "the target minimal version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
+ set_menu({
+ config =
+ {
+ {}
+ , {nil, "mm", "kv", nil, "the objc compiler" }
+ , {nil, "mxx", "kv", nil, "the objc++ compiler" }
+ , {nil, "mflags", "kv", nil, "the objc compiler flags" }
+ , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
+ , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
+ , {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
+ , {nil, "target_minver", "kv", "auto", "the target minimal version" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
- , global =
- {
- {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
- })
+ , global =
+ {
+ {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
+ })
diff --git a/xmake/platforms/watchsimulator/xmake.lua b/xmake/platforms/watchsimulator/xmake.lua
index ff48dc5b7..9932010dd 100755
--- a/xmake/platforms/watchsimulator/xmake.lua
+++ b/xmake/platforms/watchsimulator/xmake.lua
@@ -24,19 +24,19 @@
platform("watchsimulator")
-- set os
- set_platform_os("ios")
+ set_os("ios")
-- set hosts
- set_platform_hosts("macosx")
+ set_hosts("macosx")
-- set archs
- set_platform_archs("i386")
+ set_archs("i386")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
@@ -91,35 +91,35 @@ platform("watchsimulator")
end)
-- set menu
- set_platform_menu({
- config =
- {
- {}
- , {nil, "mm", "kv", nil, "the objc compiler" }
- , {nil, "mxx", "kv", nil, "the objc++ compiler" }
- , {nil, "mflags", "kv", nil, "the objc compiler flags" }
- , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
- , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
- , {nil, "target_minver", "kv", "auto", "the target minimal version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
+ set_menu({
+ config =
+ {
+ {}
+ , {nil, "mm", "kv", nil, "the objc compiler" }
+ , {nil, "mxx", "kv", nil, "the objc++ compiler" }
+ , {nil, "mflags", "kv", nil, "the objc compiler flags" }
+ , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
+ , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
+ , {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
+ , {nil, "target_minver", "kv", "auto", "the target minimal version" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
- , global =
- {
- {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
- })
+ , global =
+ {
+ {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {}
+ , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
+ , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
+ , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
+ }
+ })
diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua
index 17d5464cc..a2529e2ad 100755
--- a/xmake/platforms/windows/xmake.lua
+++ b/xmake/platforms/windows/xmake.lua
@@ -24,22 +24,22 @@
platform("windows")
-- set os
- set_platform_os("windows")
+ set_os("windows")
-- set hosts
- set_platform_hosts("windows")
+ set_hosts("windows")
-- set archs
- set_platform_archs("x86", "x64", "amd64", "x86_amd64")
+ set_archs("x86", "x64", "amd64", "x86_amd64")
-- set checker
- set_platform_checker("checker")
+ set_checker("checker")
-- set environment
- set_platform_environment("environment")
+ set_environment("environment")
-- on load
- on_platform_load(function ()
+ on_load(function ()
-- imports
import("core.project.config")
@@ -64,18 +64,18 @@ platform("windows")
end)
-- set menu
- set_platform_menu({
- config =
- {
- {}
- , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" }
- }
+ set_menu({
+ config =
+ {
+ {}
+ , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" }
+ }
- , global =
- {
- {}
- , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" }
- }
- })
+ , global =
+ {
+ {}
+ , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" }
+ }
+ })
diff --git a/xmake/plugins/doxygen/xmake.lua b/xmake/plugins/doxygen/xmake.lua
index e66072732..081ed7034 100755
--- a/xmake/plugins/doxygen/xmake.lua
+++ b/xmake/plugins/doxygen/xmake.lua
@@ -24,10 +24,10 @@
task("doxygen")
-- set category
- set_task_category("plugin")
+ set_category("plugin")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake doxygen [options] [name] [arguments]"
diff --git a/xmake/plugins/hello/xmake.lua b/xmake/plugins/hello/xmake.lua
index 2d291eb24..23657f832 100755
--- a/xmake/plugins/hello/xmake.lua
+++ b/xmake/plugins/hello/xmake.lua
@@ -24,10 +24,10 @@
task("hello")
-- set category
- set_task_category("plugin")
+ set_category("plugin")
-- on run
- on_task_run(function ()
+ on_run(function ()
-- trace
print("hello xmake!")
@@ -35,7 +35,7 @@ task("hello")
end)
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake hello [options]"
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index b51a56948..5473a3b55 100755
--- a/xmake/plugins/lua/xmake.lua
+++ b/xmake/plugins/lua/xmake.lua
@@ -24,10 +24,10 @@
task("lua")
-- set category
- set_task_category("plugin")
+ set_category("plugin")
-- on run
- on_task_run(function ()
+ on_run(function ()
-- imports
import("core.base.option")
@@ -44,7 +44,7 @@ task("lua")
end)
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake lua|l [options] [script] [arguments]"
diff --git a/xmake/plugins/macro/xmake.lua b/xmake/plugins/macro/xmake.lua
index 53d2dd82e..d0148bddc 100755
--- a/xmake/plugins/macro/xmake.lua
+++ b/xmake/plugins/macro/xmake.lua
@@ -24,10 +24,10 @@
task("macro")
-- set category
- set_task_category("plugin")
+ set_category("plugin")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake macro|m [options] [name] [arguments]"
diff --git a/xmake/plugins/makefile/xmake.lua b/xmake/plugins/makefile/xmake.lua
index 9fd0c43bb..a447057e6 100755
--- a/xmake/plugins/makefile/xmake.lua
+++ b/xmake/plugins/makefile/xmake.lua
@@ -24,13 +24,13 @@
task("makefile")
-- set category
- set_task_category("plugin")
+ set_category("plugin")
-- on run
- on_task_run("main")
+ on_run("main")
-- set menu
- set_task_menu({
+ set_menu({
-- usage
usage = "xmake makefile [options] [target]"