diff options
| author | ruki <[email protected]> | 2017-07-19 08:19:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-07-19 08:19:40 +0800 |
| commit | 7910713ed804fb60fa8f13b0a4ce915347fc879a (patch) | |
| tree | c14cea3b5e0b62ec5547b9e5a4e19563f6b66d0f | |
| parent | bd56fe4e700dd2dede67bc39f8fa46903bdb8262 (diff) | |
fix config cache status
| -rw-r--r-- | xmake/actions/config/main.lua | 18 | ||||
| -rw-r--r-- | xmake/core/project/config.lua | 35 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/config.lua | 28 |
3 files changed, 12 insertions, 69 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 34fe55f76..92c5e492b 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -55,13 +55,13 @@ function _host_changed(targetname) end -- need check -function _need_check() +function _need_check(override) -- clean? local changed = option.get("clean") -- the configure has been changed? reconfig it - if not changed and config.changed() then + if not changed and override then changed = true end @@ -180,11 +180,13 @@ function main() -- load global configure global.load() - -- init the project configure + -- load the project configure -- -- priority: option > option_cache > global > option_default > config_check > project_check > config_cache -- - config.init() + if not option.get("clean") then + config.load() + end -- enter cache scope cache.enter("local.config") @@ -199,11 +201,15 @@ function main() end -- override configure from the options or cache + local override = false if not option.get("clean") then options = options or cache.get("options_" .. targetname) end for name, value in pairs(options) do - config.set(name, value) + if config.get(name) ~= value then + config.set(name, value) + override = true + end end -- merge the global configure @@ -221,7 +227,7 @@ function main() end -- merge the checked configure - local recheck = _need_check() + local recheck = _need_check(override) if recheck then -- check configure diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index 6d5925c42..235118146 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -210,11 +210,6 @@ function config.read(name, targetname) return value end --- init the config -function config.init() - config._CONFIGS = {} -end - -- dump the configure function config.dump() @@ -224,35 +219,5 @@ function config.dump() end end --- the configure has been changed for the given target? -function config.changed(targetname) - - -- check - targetname = targetname or "all" - - -- load configure from the file - local fileinfo = {} - local filepath = config._file() - if os.isfile(filepath) then - - -- load it - local results = io.load(filepath) - if results and results._TARGETS then - for name, value in pairs(table.wrap(results._TARGETS[targetname])) do - fileinfo[name] = value - end - end - end - - -- compare the current configure - for name, value in pairs(config.options()) do - - -- changed? - if fileinfo[name] ~= value then - return true - end - end -end - -- return module return config diff --git a/xmake/core/sandbox/modules/import/core/project/config.lua b/xmake/core/sandbox/modules/import/core/project/config.lua index ba027f80b..1c1674938 100644 --- a/xmake/core/sandbox/modules/import/core/project/config.lua +++ b/xmake/core/sandbox/modules/import/core/project/config.lua @@ -32,36 +32,26 @@ local raise = require("sandbox/modules/raise") -- get the build directory function sandbox_core_project_config.buildir() - - -- get it return config.buildir() end -- get the current platform function sandbox_core_project_config.plat() - - -- get it return config.get("plat") end -- get the current architecture function sandbox_core_project_config.arch() - - -- get it return config.get("arch") end -- get the current mode function sandbox_core_project_config.mode() - - -- get it return config.get("mode") end -- get the current host function sandbox_core_project_config.host() - - -- get it return config.get("host") end @@ -112,25 +102,9 @@ end -- read the value from the configure file directly function sandbox_core_project_config.read(name, targetname) - - -- read it return config.read(name, targetname) end --- the configure has been changed for the given target? -function sandbox_core_project_config.changed(targetname) - - -- changed? - return config.changed(targetname) -end - --- init the configure -function sandbox_core_project_config.init() - - -- init it - config.init() -end - -- check the configure function sandbox_core_project_config.check() @@ -143,8 +117,6 @@ end -- dump the configure function sandbox_core_project_config.dump() - - -- dump it config.dump() end |
