summaryrefslogtreecommitdiff
path: root/xmake/actions/config/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-05-05 20:35:45 +0800
committerruki <[email protected]>2024-05-05 20:35:45 +0800
commitfe2b2cd36b20ec41fd0569ff387c58e822fa1b56 (patch)
tree3e664178191e783ce820e624d45eaf320d27b472 /xmake/actions/config/main.lua
parent4463ddbfdf57b712a577c63a4e4276117e0cdc31 (diff)
improve to check targets
Diffstat (limited to 'xmake/actions/config/main.lua')
-rw-r--r--xmake/actions/config/main.lua18
1 files changed, 11 insertions, 7 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index b35bd08e6..327094039 100644
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -101,20 +101,24 @@ function _need_check(changed)
end
-- check target
-function _check_target(target)
- for _, depname in ipairs(target:get("deps")) do
- assert(depname ~= target:name(), "the target(%s) cannot depend self!", depname)
- local deptarget = project.target(depname)
- assert(deptarget, "unknown target(%s) for %s.deps!", depname, target:name())
- _check_target(deptarget)
+function _check_target(target, checked_targets)
+ if not checked_targets[target:name()] then
+ checked_targets[target:name()] = target
+ for _, depname in ipairs(target:get("deps")) do
+ assert(depname ~= target:name(), "the target(%s) cannot depend self!", depname)
+ local deptarget = project.target(depname)
+ assert(deptarget, "unknown target(%s) for %s.deps!", depname, target:name())
+ _check_target(deptarget, checked_targets)
+ end
end
end
-- check targets
function _check_targets()
assert(not project.is_loaded(), "project and targets may have been loaded early!")
+ local checked_targets = {}
for _, target in pairs(project.targets()) do
- _check_target(target)
+ _check_target(target, checked_targets)
end
end