summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-16 23:41:38 +0800
committerruki <[email protected]>2025-12-16 23:41:38 +0800
commit4efa9f8afc8982fb7ae2f388c9417ae97199ec0a (patch)
treedcb044ee5da928b2348274f89b6c77a3aab15f13
parent427f50fa45d7015bd443fa2c0d059593c826d43f (diff)
fix run script
-rw-r--r--xmake/actions/run/main.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index 94c7d7d6b..6cfe09d3a 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -145,6 +145,18 @@ function _run(target)
os.setenvs(oldenvs)
end
+-- check if the target is runnable
+function _is_runnable(target)
+ if target:is_binary() or target:script("run") then
+ return true
+ end
+ for _, r in ipairs(target:orderules()) do
+ if r:script("run") then
+ return true
+ end
+ end
+end
+
-- check targets
function _check_targets(targetname, group_pattern)
@@ -155,7 +167,7 @@ function _check_targets(targetname, group_pattern)
table.insert(targets, target)
else
for _, target in ipairs(project.ordertargets()) do
- if target:is_binary() or target:script("run") then
+ if _is_runnable(target) then
local group = target:get("group")
if (target:is_default() and not group_pattern) or option.get("all") or (group_pattern and group and group:match(group_pattern)) then
table.insert(targets, target)
@@ -216,7 +228,7 @@ function main()
else
local targets = {}
for _, target in ipairs(project.ordertargets()) do
- if target:is_binary() or target:script("run") then
+ if _is_runnable(target) then
local group = target:get("group")
if (target:is_default() and not group_pattern) or option.get("all") or (group_pattern and group and group:match(group_pattern)) then
table.insert(targets, target)