summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-05 00:53:10 +0800
committerruki <[email protected]>2022-07-05 00:53:10 +0800
commit35aba296180707618e5cce6666c32a9707735bd9 (patch)
treeb47040cc5dee32b22da913416f828d2adfe6786b
parent7d245d6fdbd5d6b13ab774507b5f610c564794d0 (diff)
add set_runargs
-rw-r--r--xmake/actions/run/main.lua10
-rw-r--r--xmake/core/project/target.lua1
2 files changed, 8 insertions, 3 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index 68a2e3863..6daae3076 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -53,11 +53,14 @@ function _do_run_target(target)
os.setenv(name, table.unpack(table.wrap(value)))
end
+ -- get run arguments
+ local args = option.get("arguments") or target:get("runargs")
+
-- debugging?
if option.get("debug") then
- debugger.run(targetfile, option.get("arguments"), {curdir = rundir})
+ debugger.run(targetfile, args, {curdir = rundir})
else
- os.execv(targetfile, option.get("arguments"), {curdir = rundir, detach = option.get("detach")})
+ os.execv(targetfile, args, {curdir = rundir, detach = option.get("detach")})
end
end
@@ -145,7 +148,8 @@ function _check_targets(targetname, group_pattern)
-- get targets
local targets = {}
if targetname then
- table.insert(targets, project.target(targetname))
+ local target = assert(project.target(targetname), "%s not found!", targetname)
+ table.insert(targets, target)
else
for _, target in ipairs(project.ordertargets()) do
if target:is_binary() then
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 21a27c91a..43df61161 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -2091,6 +2091,7 @@ function target.apis()
, "target.set_runtimes"
, "target.set_languages"
, "target.set_toolchains"
+ , "target.set_runargs"
-- target.add_xxx
, "target.add_deps"
, "target.add_rules"