summaryrefslogtreecommitdiff
path: root/xmake/actions/config/menuconf.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-06-15 22:47:49 +0800
committerruki <[email protected]>2021-06-15 22:47:49 +0800
commitdebc652cd0448967a9a2c5425a1d1ae7c6235af0 (patch)
tree2f8d8283242ff5af3129cc6b256f19d6aa655325 /xmake/actions/config/menuconf.lua
parentb820270442536da435f5fb5582bf56b8bde53011 (diff)
add import/export configs
Diffstat (limited to 'xmake/actions/config/menuconf.lua')
-rw-r--r--xmake/actions/config/menuconf.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/xmake/actions/config/menuconf.lua b/xmake/actions/config/menuconf.lua
index 5d4c53027..5657b30db 100644
--- a/xmake/actions/config/menuconf.lua
+++ b/xmake/actions/config/menuconf.lua
@@ -93,6 +93,8 @@ function app:_filter_option(name)
, help = true
, clean = true
, menu = true
+ , import = true
+ , export = true
}
return not options[name] and not project.option(name)
end
@@ -358,9 +360,13 @@ end
-- load configs from options
function app:load(cache)
- -- load config from cache
- if cache then
- cache = config.load()
+ -- merge configuration from the given import file or cache
+ local loaded = false
+ local importfile = option.get("import")
+ if importfile and os.isfile(importfile) then
+ loaded = config.load(importfile)
+ elseif cache then
+ loaded = config.load()
end
-- clear configs first
@@ -374,7 +380,7 @@ function app:load(cache)
self:mconfdialog():load(configs)
-- the previous config is only for loading menuconf, so clear config now
- if cache then
+ if loaded then
config.clear()
end
end