summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShifftC <[email protected]>2025-02-08 15:22:20 +0100
committerShifftC <[email protected]>2025-02-08 16:19:47 +0100
commitbffd31b6fd622eb806af28308047deca009d6c1c (patch)
tree1c9c9018acdd26f132f9e5e197171dc4a4423a20
parent15a8af67a9b2ddb969f523825ee4939f6d2a8724 (diff)
Replace target check in action run
-rw-r--r--xmake/actions/run/main.lua27
1 files changed, 2 insertions, 25 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index c11eb2d35..90eeeaed6 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -29,6 +29,7 @@ import("devel.debugger")
import("async.runjobs")
import("private.action.run.runenvs")
import("private.service.remote_build.action", {alias = "remote_build_action"})
+import("lib.detect.check_targetname")
import("lib.detect.find_tool")
-- run target
@@ -95,20 +96,6 @@ function _add_target_pkgenvs(target, targets_added)
end
end
--- find target names matching a specific name
-function _find_matching_target_names(targetname)
- targetname = targetname:lower()
- local matching_targetnames = {}
- for _, target in ipairs(project.ordertargets()) do
- if target:name():lower():find(targetname, 1, true) then
- table.insert(matching_targetnames, target:name())
- end
- end
-
- table.sort(matching_targetnames)
- return matching_targetnames
-end
-
-- run the given target
function _run(target)
@@ -163,17 +150,7 @@ function _check_targets(targetname, group_pattern)
-- get targets
local targets = {}
if targetname then
- local target = project.target(targetname)
- if not target then
- -- check if the name is part of other target to help
- local possible_targetnames = _find_matching_target_names(targetname)
- local errors = targetname .. " is not a valid target name for this project"
- if #possible_targetnames > 0 then
- errors = errors .. "\nlist of valid target names close to your input:\n - " .. table.concat(possible_targetnames, '\n - ')
- end
- raise(errors)
- end
-
+ local target = assert(check_targetname(targetname))
table.insert(targets, target)
else
for _, target in ipairs(project.ordertargets()) do