summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-06 00:53:14 +0800
committerruki <[email protected]>2020-10-06 00:53:14 +0800
commit3b57dab66edacc4f0f17cebf20c5c726def7a993 (patch)
treea44d72632d26536cf0c78ed75e0ab03429c17fe2
parent461f42144aae7ab04d1c342d63ade05eda7a4338 (diff)
improve xmake clean
-rw-r--r--xmake/actions/clean/main.lua30
1 files changed, 8 insertions, 22 deletions
diff --git a/xmake/actions/clean/main.lua b/xmake/actions/clean/main.lua
index d5cd46bdc..b1767d021 100644
--- a/xmake/actions/clean/main.lua
+++ b/xmake/actions/clean/main.lua
@@ -101,24 +101,11 @@ function _clean_target(target)
end
end
--- clean the given target and all dependent targets
-function _clean_target_and_deps(target)
-
- -- this target have been finished?
- if _g.finished[target:name()] then
- return
+-- clean the given targets
+function _clean_targets(targets)
+ for _, target in ipairs(targets) do
+ _clean_target(target)
end
-
- -- remove the target
- _clean_target(target)
-
- -- exists the dependent targets?
- for _, dep in ipairs(target:get("deps")) do
- _clean_target_and_deps(project.target(dep))
- end
-
- -- finished
- _g.finished[target:name()] = true
end
-- clean target
@@ -126,12 +113,11 @@ function _clean(targetname)
-- clean the given target
if targetname then
- _clean_target_and_deps(project.target(targetname))
+ local target = project.target(targetname)
+ _clean_targets(target:orderdeps())
+ _clean_target(target)
else
- -- clean all targets
- for _, target in pairs(project.targets()) do
- _clean_target_and_deps(target)
- end
+ _clean_targets(project.ordertargets())
end
-- remove the configure directory if remove all