summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-04-01 21:04:10 +0800
committerruki <[email protected]>2016-04-01 21:04:10 +0800
commit70e2500e9a37a57622c7b4875171e6f07fd523ae (patch)
tree17bb5785a597d58b42d1054c7fc7b94f7a94cb87
parent9a71fdfde331506e9c5eb2da93f1f95641e66de5 (diff)
clean cache for config
-rwxr-xr-xxmake/actions/config/main.lua16
-rw-r--r--xmake/core/sandbox/modules/import/core/project/config.lua7
2 files changed, 22 insertions, 1 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 9027573b2..468afbca4 100755
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -34,6 +34,20 @@ function _option_filter(name)
return name and name ~= "target" and name ~= "file" and name ~= "project" and name ~= "verbose" and name ~= "clean"
end
+-- need clean the cached configure?
+function _need_clean_cache()
+
+ -- the host has been changed? clean it
+ if config.host() ~= vformat("$(host)") then
+ return true
+ end
+
+ -- the plat has been changed? clean it
+ if option.get("plat") and config.plat() and option.get("plat") ~= config.plat() then
+ return true
+ end
+end
+
-- main
function main()
@@ -52,7 +66,7 @@ function main()
config.load(targetname)
-- clean the cached configure?
- if option.get("clean") then
+ if option.get("clean") or _need_clean_cache() then
-- clean it
config.clean()
diff --git a/xmake/core/sandbox/modules/import/core/project/config.lua b/xmake/core/sandbox/modules/import/core/project/config.lua
index 2d2820f4a..2c43c2696 100644
--- a/xmake/core/sandbox/modules/import/core/project/config.lua
+++ b/xmake/core/sandbox/modules/import/core/project/config.lua
@@ -63,6 +63,13 @@ function sandbox_core_project_config.mode()
return config.get("mode")
end
+-- get the current host
+function sandbox_core_project_config.host()
+
+ -- get it
+ return config.get("host")
+end
+
-- get the configure directory
function sandbox_core_project_config.directory()