diff options
| author | ruki <[email protected]> | 2019-06-13 00:26:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-06-12 20:39:14 +0800 |
| commit | 34b1fe79cfa33e2e185a520e05b3d7c8d70dd01c (patch) | |
| tree | bc4a00d2adce8da3137adaf4b3e54741b86531d0 /xmake/rules | |
| parent | bf7331c60d83218fbf58431a7d757420549b60fa (diff) | |
improve clean action
Diffstat (limited to 'xmake/rules')
| -rw-r--r-- | xmake/rules/cuda/devlink/xmake.lua | 12 | ||||
| -rw-r--r-- | xmake/rules/qt/env/xmake.lua | 8 | ||||
| -rw-r--r-- | xmake/rules/qt/moc/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/qt/qrc/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/qt/ui/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/wdk/env/xmake.lua | 7 | ||||
| -rw-r--r-- | xmake/rules/wdk/inf/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/wdk/man/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/wdk/mc/xmake.lua | 1 | ||||
| -rw-r--r-- | xmake/rules/wdk/mof/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/wdk/package/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/wdk/sign/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/wdk/tracewpp/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/wdk/xmake.lua | 3 |
14 files changed, 12 insertions, 49 deletions
diff --git a/xmake/rules/cuda/devlink/xmake.lua b/xmake/rules/cuda/devlink/xmake.lua index 9df1a32ee..db3ea59c1 100644 --- a/xmake/rules/cuda/devlink/xmake.lua +++ b/xmake/rules/cuda/devlink/xmake.lua @@ -24,12 +24,6 @@ rule("cuda.devlink") -- add rule: cuda environment add_deps("cuda.env") - -- clean files - after_clean(function (target) - os.tryrm(target:objectfile(path.join(".cuda", "devlink", target:basename() .. "_gpucode.cu"))) - os.tryrm(target:dependfile(targetfile)) - end) - -- @see https://devblogs.nvidia.com/separate-compilation-linking-cuda-device-code/ before_link(function (target, opt) @@ -119,3 +113,9 @@ rule("cuda.devlink") depend.save(dependinfo, dependfile) end) + -- clean files + after_clean(function (target) + import("private.action.clean.remove_files") + remove_files(target:objectfile(path.join(".cuda", "devlink", target:basename() .. "_gpucode.cu"))) + remove_files(target:dependfile(targetfile)) + end) diff --git a/xmake/rules/qt/env/xmake.lua b/xmake/rules/qt/env/xmake.lua index 590c77b07..ec5fe06f2 100644 --- a/xmake/rules/qt/env/xmake.lua +++ b/xmake/rules/qt/env/xmake.lua @@ -39,9 +39,7 @@ rule("qt.env") -- clean files after_clean(function (target) - for _, file in ipairs(target:data("qt.cleanfiles")) do - os.rm(file) - end - target:data_set("qt.cleanfiles", nil) + import("core.project.config") + import("private.action.clean.remove_files") + remove_files(path.join(config.buildir(), ".qt")) end) - diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua index 9542ed7e8..e4bd6b93e 100644 --- a/xmake/rules/qt/moc/xmake.lua +++ b/xmake/rules/qt/moc/xmake.lua @@ -64,9 +64,6 @@ rule("qt.moc") -- add objectfile table.insert(target:objectfiles(), objectfile) - -- add clean files - target:data_add("qt.cleanfiles", {sourcefile_moc, objectfile}) - -- load dependent info local dependfile = target:dependfile(objectfile) local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) @@ -102,4 +99,3 @@ rule("qt.moc") table.insert(dependinfo.files, headerfile_moc) depend.save(dependinfo, dependfile) end) - diff --git a/xmake/rules/qt/qrc/xmake.lua b/xmake/rules/qt/qrc/xmake.lua index 6ae48fa41..b296e9154 100644 --- a/xmake/rules/qt/qrc/xmake.lua +++ b/xmake/rules/qt/qrc/xmake.lua @@ -67,9 +67,6 @@ rule("qt.qrc") -- add objectfile table.insert(target:objectfiles(), objectfile) - -- add clean files - target:data_add("qt.cleanfiles", {sourcefile_cpp, objectfile}) - -- load dependent info local dependfile = target:dependfile(objectfile) local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) diff --git a/xmake/rules/qt/ui/xmake.lua b/xmake/rules/qt/ui/xmake.lua index a94894681..59a14c5af 100644 --- a/xmake/rules/qt/ui/xmake.lua +++ b/xmake/rules/qt/ui/xmake.lua @@ -57,9 +57,6 @@ rule("qt.ui") -- add includedirs target:add("includedirs", path.absolute(headerfile_dir, os.projectdir())) - -- add clean files - target:data_add("qt.cleanfiles", headerfile_ui) - -- need build this object? local dependfile = target:dependfile(headerfile_ui) local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) @@ -87,4 +84,3 @@ rule("qt.ui") dependinfo.files = {sourcefile_ui} depend.save(dependinfo, dependfile) end) - diff --git a/xmake/rules/wdk/env/xmake.lua b/xmake/rules/wdk/env/xmake.lua index 2f6c30965..07d9c5f5f 100644 --- a/xmake/rules/wdk/env/xmake.lua +++ b/xmake/rules/wdk/env/xmake.lua @@ -83,10 +83,9 @@ rule("wdk.env") -- clean files after_clean(function (target) - for _, file in ipairs(target:data("wdk.cleanfiles")) do - os.rm(file) - end - target:data_set("wdk.cleanfiles", nil) + import("core.project.config") + import("private.action.clean.remove_files") + remove_files(path.join(config.buildir(), ".wdk")) end) -- define rule: umdf diff --git a/xmake/rules/wdk/inf/xmake.lua b/xmake/rules/wdk/inf/xmake.lua index 3a591cfa3..60e81488d 100644 --- a/xmake/rules/wdk/inf/xmake.lua +++ b/xmake/rules/wdk/inf/xmake.lua @@ -58,9 +58,6 @@ rule("wdk.inf") -- the target file local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".inf") - -- add clean files - target:data_add("wdk.cleanfiles", targetfile) - -- save this target file for signing (wdk.sign.*, wdk.package.* rules) target:data_set("wdk.sign.inf", targetfile) diff --git a/xmake/rules/wdk/man/xmake.lua b/xmake/rules/wdk/man/xmake.lua index 93ecdc17e..aa6af830e 100644 --- a/xmake/rules/wdk/man/xmake.lua +++ b/xmake/rules/wdk/man/xmake.lua @@ -83,7 +83,6 @@ rule("wdk.man") if headerfile then table.insert(args, "-o") table.insert(args, headerfile) - target:data_add("wdk.cleanfiles", headerfile) else raise("please call `set_values(\"wdk.man.header\", \"header.h\")` to set the provider header file name!") end @@ -101,7 +100,6 @@ rule("wdk.man") if counter_headerfile then table.insert(args, "-ch") table.insert(args, counter_headerfile) - target:data_add("wdk.cleanfiles", counter_headerfile) end -- add resource file @@ -110,7 +108,6 @@ rule("wdk.man") if resourcefile then table.insert(args, "-rc") table.insert(args, resourcefile) - target:data_add("wdk.cleanfiles", resourcefile) end -- need build this object? diff --git a/xmake/rules/wdk/mc/xmake.lua b/xmake/rules/wdk/mc/xmake.lua index 87921ea85..c981bda5b 100644 --- a/xmake/rules/wdk/mc/xmake.lua +++ b/xmake/rules/wdk/mc/xmake.lua @@ -88,7 +88,6 @@ rule("wdk.mc") if headerfile then table.insert(args, "-z") table.insert(args, path.basename(headerfile)) - target:data_add("wdk.cleanfiles", headerfile) else headerfile = path.join(outputdir, path.basename(sourcefile) .. ".h") end diff --git a/xmake/rules/wdk/mof/xmake.lua b/xmake/rules/wdk/mof/xmake.lua index b198c83f4..a1f643a6c 100644 --- a/xmake/rules/wdk/mof/xmake.lua +++ b/xmake/rules/wdk/mof/xmake.lua @@ -99,10 +99,6 @@ rule("wdk.mof") local outputdir_htm = path.join(outputdir, "htm") local targetfile_vbs = path.join(outputdir, path.basename(sourcefile) .. ".vbs") - -- add clean files - target:data_add("wdk.cleanfiles", {headerfile, sourcefile_mof, targetfile_mfl, targetfile_mof}) - target:data_add("wdk.cleanfiles", {targetfile_mfl_mof, targetfile_bmf, outputdir_htm, targetfile_vbs}) - -- need build this object? local dependfile = target:dependfile(headerfile) local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) diff --git a/xmake/rules/wdk/package/xmake.lua b/xmake/rules/wdk/package/xmake.lua index 829022dc3..180268af5 100644 --- a/xmake/rules/wdk/package/xmake.lua +++ b/xmake/rules/wdk/package/xmake.lua @@ -46,9 +46,6 @@ rule("wdk.package.cab") -- the .ddf file local ddfile = os.tmpfile(target:targetfile()) .. ".ddf" - -- add clean files - target:data_add("wdk.cleanfiles", ddfile) - -- trace progress info if option.get("verbose") then cprint("${dim magenta}packaging %s", packagefile) diff --git a/xmake/rules/wdk/sign/xmake.lua b/xmake/rules/wdk/sign/xmake.lua index 4e2d8ab0e..4344ea301 100644 --- a/xmake/rules/wdk/sign/xmake.lua +++ b/xmake/rules/wdk/sign/xmake.lua @@ -108,9 +108,6 @@ rule("wdk.sign") return end - -- add clean files - target:data_add("wdk.cleanfiles", {tempfile, dependfile}) - -- trace progress info cprintf("${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} ", opt.progress) if option.get("verbose") then diff --git a/xmake/rules/wdk/tracewpp/xmake.lua b/xmake/rules/wdk/tracewpp/xmake.lua index 086f7ccff..d940337f3 100644 --- a/xmake/rules/wdk/tracewpp/xmake.lua +++ b/xmake/rules/wdk/tracewpp/xmake.lua @@ -87,9 +87,6 @@ rule("wdk.tracewpp") -- add includedirs target:add("includedirs", outputdir) - -- add clean files - target:data_add("wdk.cleanfiles", outputdir) - -- need build this object? local targetfile = path.join(outputdir, path.basename(sourcefile) .. ".tmh") local dependfile = target:dependfile(targetfile) diff --git a/xmake/rules/wdk/xmake.lua b/xmake/rules/wdk/xmake.lua index a27fac115..4eab4a571 100644 --- a/xmake/rules/wdk/xmake.lua +++ b/xmake/rules/wdk/xmake.lua @@ -53,9 +53,6 @@ rule("wdk.driver") -- copy wdf redist dll libraries (WdfCoInstaller01011.dll, ..) to the target directory os.cp(path.join(wdk.sdkdir, "Redist", "wdf", config.arch(), "*.dll"), target:targetdir()) - - -- add clean files - target:data_add("wdk.cleanfiles", os.files(path.join(target:targetdir(), "*.dll"))) end end) |
