summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-14 12:23:33 +0800
committerruki <[email protected]>2016-05-14 12:23:33 +0800
commit3f36fc0bee466691f3d0400ae7b4d8259870a15a (patch)
tree64df7b728acc98d3bfa3cebac1b2f5dc66a06d0c
parent99965a2a7889e93c308f860c692555ae5c5f604e (diff)
cache options for config
-rwxr-xr-xxmake/actions/config/main.lua33
-rwxr-xr-xxmake/actions/config/xmake.lua5
-rwxr-xr-xxmake/actions/global/main.lua8
-rwxr-xr-xxmake/actions/global/xmake.lua3
4 files changed, 27 insertions, 22 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 1f8943c4c..cf4498f46 100755
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -31,7 +31,7 @@ import("config_h")
-- filter option
function _option_filter(name)
- return name and name ~= "target" and name ~= "file" and name ~= "project" and name ~= "verbose" and name ~= "clean"
+ return name and name ~= "target" and name ~= "file" and name ~= "project" and name ~= "verbose"
end
-- need check
@@ -90,17 +90,28 @@ function main()
-- init the project configure
--
- -- priority: option > global > option_default > config_check > project_check > config_cache
+ -- priority: option > option_cache > global > option_default > config_check > project_check > config_cache
--
config.init()
- -- override the option configure
+ -- enter cache scope
+ cache.enter("local.config")
+
+ -- get the options
+ local options = nil
for name, value in pairs(option.options()) do
if _option_filter(name) then
- config.set(name, value)
+ options = options or {}
+ options[name] = value
end
end
+ -- override configure from the options or cache
+ options = options or cache.get("options_" .. targetname)
+ for name, value in pairs(options) do
+ config.set(name, value)
+ end
+
-- merge the global configure
for name, value in pairs(global.options()) do
if config.get(name) == nil then
@@ -115,9 +126,6 @@ function main()
end
end
- -- enter cache scope
- cache.enter("local.config")
-
-- merge the checked configure
if _need_check() then
config.check()
@@ -125,15 +133,13 @@ function main()
end
-- merge the cached configure
- if not option.get("clean") then
- config.load(targetname)
- end
+ config.load(targetname)
-- load platform
platform.load(config.plat())
-- translate the build directory
- local buildir = option.get("buildir")
+ local buildir = config.get("buildir")
if buildir and path.is_absolute(buildir) then
config.set("buildir", path.relative(buildir, project.directory()))
end
@@ -153,6 +159,11 @@ function main()
-- need rebuild it
cache.set("rebuild", true)
+
+ -- save options
+ cache.set("options_" .. targetname, options)
+
+ -- flush cache
cache.flush()
-- save the project configure
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index 98b0f213e..fd3b5b584 100755
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -43,10 +43,7 @@ task("config")
-- options
, options =
{
- {'c', "clean", "k", nil, "Clean the cached configure and configure all again." }
-
- , {}
- , {'p', "plat", "kv", "$(host)", "Compile for the given platform."
+ {'p', "plat", "kv", "$(host)", "Compile for the given platform."
-- show the description of all platforms
, function ()
diff --git a/xmake/actions/global/main.lua b/xmake/actions/global/main.lua
index 7c03e08d0..3646f9595 100755
--- a/xmake/actions/global/main.lua
+++ b/xmake/actions/global/main.lua
@@ -35,14 +35,14 @@ function main()
-- override the option configure
for name, value in pairs(option.options()) do
- if name ~= "verbose" and name ~= "clean" then
+ if name ~= "verbose" then
global.set(name, value)
end
end
-- merge the default options
for name, value in pairs(option.defaults()) do
- if name ~= "verbose" and name ~= "clean" and global.get(name) == nil then
+ if name ~= "verbose" and global.get(name) == nil then
global.set(name, value)
end
end
@@ -51,9 +51,7 @@ function main()
global.check()
-- merge the cached configure
- if not option.get("clean") then
- global.load()
- end
+ global.load()
-- save it
global.save()
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index fd53c94cf..13b5849f7 100755
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -43,8 +43,7 @@ task("global")
-- options
, options =
{
- {'c', "clean", "k", nil, "Clean the cached configure and configure all again." }
- , {nil, "make", "kv", "auto", "Set the make path." }
+ {nil, "make", "kv", "auto", "Set the make path." }
, {nil, "ccache", "kv", "auto", "Enable or disable the c/c++ compiler cache."
, " --ccache=[y|n]" }