summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua/xmake.lua
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-07-01 14:19:05 +0800
committerOpportunityLiu <[email protected]>2019-07-01 14:19:05 +0800
commitf40152174188626df4b70ca1b9044a721fd3c6e8 (patch)
tree388f5b8e3acdcf1bc9253556fe762dc8b09a5d2a /xmake/plugins/lua/xmake.lua
parent19cbd06f95dddacd1247d1dffab9fa29d719d02b (diff)
utf8 support
Diffstat (limited to 'xmake/plugins/lua/xmake.lua')
-rw-r--r--xmake/plugins/lua/xmake.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index 32c929001..b6d66a670 100644
--- a/xmake/plugins/lua/xmake.lua
+++ b/xmake/plugins/lua/xmake.lua
@@ -54,14 +54,16 @@ task("lua")
if script then
-- import and run script
- if os.isfile(script) then
+ if path.extension(script) == ".lua" and os.isfile(script) then
-- run the given lua script file (xmake lua /tmp/script.lua)
+ vprint("runing given lua script file: %s", path.relative(script))
import(path.basename(script), {rootdir = path.directory(script), anonymous = true})(unpack(option.get("arguments") or {}))
elseif os.isfile(path.join(os.scriptdir(), "scripts", script .. ".lua")) then
-- run builtin lua script (xmake lua echo "hello xmake")
+ vprint("runing builtin lua script: %s", script)
import("scripts." .. script, {anonymous = true})(unpack(option.get("arguments") or {}))
else
@@ -76,9 +78,11 @@ task("lua")
local result = nil
if object then
-- run builtin modules (xmake lua core.xxx.xxx)
+ vprint("runing builtin module: %s", script)
result = object(unpack(option.get("arguments") or {}))
else
-- run imported modules (xmake lua core.xxx.xxx)
+ vprint("runing imported module: %s", script)
result = import(script, {anonymous = true})(unpack(option.get("arguments") or {}))
end
if result ~= nil then utils.dump(result) end