summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-19 23:14:47 +0800
committerruki <[email protected]>2017-07-19 23:14:47 +0800
commit9d13bbd984bf71f95b0798d928ebee69e9719a29 (patch)
treeb5a2020bf0f7f512308f5509390c17d3f9349114
parent0614ca6a2eebcf8b4d4be3c6171a783731720888 (diff)
fix config bug
-rw-r--r--xmake/actions/config/main.lua28
1 files changed, 18 insertions, 10 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 90af3209d..8fd496e7f 100644
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -184,10 +184,6 @@ function main()
--
-- priority: option > option_cache > global > option_default > config_check > project_check > config_cache
--
- local configcache = false
- if not option.get("clean") and not _host_changed(targetname) then
- configcache = config.load(targetname)
- end
-- get the options
local options = nil
@@ -199,19 +195,31 @@ function main()
end
-- override configure from the options or cache
- local changed = false
+ local options_changed = false
+ local options_history = {}
if not option.get("clean") then
- options = options or cache.get("options_" .. targetname)
+ options_history = cache.get("options_" .. targetname)
+ options = options or options_history
end
for name, value in pairs(options) do
- -- the config value is changed by argument options?
- changed = changed or config.get(name) ~= value
+ -- options is changed by argument options?
+ options_changed = options_changed or options_history[name] ~= value
- -- @note override it and mark as readonly
+ -- @note override it and mark as readonly (highest priority)
config.set(name, value, true)
end
+ -- merge the cached configure
+ --
+ -- @note we cannot load cache config when switching platform, arch ..
+ -- so we need known whether options have been changed
+ --
+ local configcache = false
+ if not options_changed and not option.get("clean") and not _host_changed(targetname) then
+ configcache = config.load(targetname)
+ end
+
-- merge the global configure
for name, value in pairs(global.options()) do
if config.get(name) == nil then
@@ -227,7 +235,7 @@ function main()
end
-- merge the checked configure
- local recheck = _need_check(changed or not configcache)
+ local recheck = _need_check(options_changed or not configcache)
if recheck then
-- check configure