diff options
| -rw-r--r-- | xmake/actions/build/main.lua | 15 | ||||
| -rw-r--r-- | xmake/actions/config/main.lua | 5 |
2 files changed, 19 insertions, 1 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua index 1578b9e8d..3a9f4ca86 100644 --- a/xmake/actions/build/main.lua +++ b/xmake/actions/build/main.lua @@ -27,6 +27,7 @@ import("core.base.option") import("core.base.task") import("core.project.config") import("core.project.project") +import("core.project.cache", {nocache = true}) import("core.platform.platform") import("builder") @@ -39,6 +40,18 @@ function main() -- config it first task.run("config", {target = targetname}) + -- enter cache scope + cache.enter("local.config") + + -- rebuild? + local rebuild = option.get("rebuild") or cache.get("rebuild") + + -- clear 'rebuild' mark in cache + if cache.get("rebuild") then + cache.set("rebuild", nil) + cache.flush() + end + -- enter project directory local oldir = os.cd(project.directory()) @@ -46,7 +59,7 @@ function main() try { function () - builder.build(targetname, option.get("rebuild")) + builder.build(targetname, rebuild) end, catch diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index db530e730..9b84b58bc 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -62,6 +62,11 @@ function _need_check(changed) changed = option.get("clean") end + -- rebuild? + if changed then + cache.set("rebuild", true) + end + -- get the current mtimes local mtimes = project.mtimes() |
