summaryrefslogtreecommitdiff
path: root/xmake/actions/clean/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-06-13 00:26:32 +0800
committerruki <[email protected]>2019-06-12 20:39:14 +0800
commit34b1fe79cfa33e2e185a520e05b3d7c8d70dd01c (patch)
treebc4a00d2adce8da3137adaf4b3e54741b86531d0 /xmake/actions/clean/main.lua
parentbf7331c60d83218fbf58431a7d757420549b60fa (diff)
improve clean action
Diffstat (limited to 'xmake/actions/clean/main.lua')
-rw-r--r--xmake/actions/clean/main.lua41
1 files changed, 12 insertions, 29 deletions
diff --git a/xmake/actions/clean/main.lua b/xmake/actions/clean/main.lua
index 1b89690ea..36235321e 100644
--- a/xmake/actions/clean/main.lua
+++ b/xmake/actions/clean/main.lua
@@ -26,24 +26,7 @@ import("core.project.config")
import("core.base.global")
import("core.project.project")
import("core.platform.platform")
-
--- remove the given files or directories
-function _remove(filedirs)
-
- -- done
- for _, filedir in ipairs(filedirs) do
-
- -- remove it first
- os.tryrm(filedir)
-
- -- remove it if the parent directory is empty
- local parentdir = path.directory(filedir)
- while parentdir and os.isdir(parentdir) and os.emptydir(parentdir) do
- os.tryrm(parentdir)
- parentdir = path.directory(parentdir)
- end
- end
-end
+import("private.action.clean.remove_files")
-- do clean target
function _do_clean_target(target)
@@ -54,33 +37,33 @@ function _do_clean_target(target)
end
-- remove the target file
- _remove(target:targetfile())
+ remove_files(target:targetfile())
-- remove the target dependent file if exists
- _remove(target:dependfile())
+ remove_files(target:dependfile())
-- remove the symbol file
- _remove(target:symbolfile())
+ remove_files(target:symbolfile())
-- remove the c/c++ precompiled header file
- _remove(target:pcoutputfile("c"))
- _remove(target:pcoutputfile("cxx"))
+ remove_files(target:pcoutputfile("c"))
+ remove_files(target:pcoutputfile("cxx"))
-- remove the object files
- _remove(target:objectfiles())
+ remove_files(target:objectfiles())
-- remove the depend files
- _remove(target:dependfiles())
+ remove_files(target:dependfiles())
-- TODO remove the header files (deprecated)
local _, dstheaders = target:headers()
- _remove(dstheaders)
+ remove_files(dstheaders)
-- remove all?
if option.get("all") then
- -- remove the config.h file
- _remove(target:configheader())
+ -- TODO remove the config.h file (deprecated)
+ remove_files(target:configheader())
end
end
@@ -206,7 +189,7 @@ function _clean(targetname)
if option.get("all") then
-- remove the configure directory
- _remove(config.directory())
+ remove_files(config.directory())
end
end