summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-19 22:34:13 +0800
committerruki <[email protected]>2021-01-19 22:34:13 +0800
commitd9189f7cd7843a39346a288a58a884ea9dcdf792 (patch)
treec6f46912091d7abb54fa8349a7a675ed294c48da
parent576784050e14cd1eed1ab9284399e2731a885335 (diff)
improve config
-rw-r--r--xmake/actions/config/menuconf.lua2
-rw-r--r--xmake/core/project/config.lua19
2 files changed, 13 insertions, 8 deletions
diff --git a/xmake/actions/config/menuconf.lua b/xmake/actions/config/menuconf.lua
index 5d06e007f..5d4c53027 100644
--- a/xmake/actions/config/menuconf.lua
+++ b/xmake/actions/config/menuconf.lua
@@ -360,7 +360,7 @@ function app:load(cache)
-- load config from cache
if cache then
- cache = config.load(option.get("target") or "all")
+ cache = config.load()
end
-- clear configs first
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 78bdc2907..a5107e456 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -29,10 +29,8 @@ local table = require("base/table")
local utils = require("base/utils")
local option = require("base/option")
--- get the current given configure
+-- get the current given configuration
function config.get(name)
-
- -- get it
local value = nil
if config._CONFIGS then
value = config._CONFIGS[name]
@@ -40,8 +38,6 @@ function config.get(name)
value = nil
end
end
-
- -- get it
return value
end
@@ -150,8 +146,17 @@ function config.load()
return false
end
end
- config._CONFIGS = configs
- return true
+ -- merge into the current configuration
+ local ok = false
+ if configs then
+ for name, value in pairs(configs) do
+ if config.get(name) == nil then
+ config.set(name, value)
+ ok = true
+ end
+ end
+ end
+ return ok
end
-- save the project configuration