diff options
| author | ruki <[email protected]> | 2015-06-05 11:41:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-05 11:41:23 +0800 |
| commit | 9c4c565ef5cba3c668b338ed0066cff0d58e8caa (patch) | |
| tree | 1976b7ca1c84e29d4a812a67f46834cd1fa98b57 /xmake/scripts/base | |
| parent | 4fd209354ecf8a6f90b5a19a18e2268e3c9d649f (diff) | |
clearup config and global
Diffstat (limited to 'xmake/scripts/base')
| -rw-r--r-- | xmake/scripts/base/config.lua | 29 | ||||
| -rw-r--r-- | xmake/scripts/base/global.lua | 24 | ||||
| -rw-r--r-- | xmake/scripts/base/main.lua | 6 |
3 files changed, 55 insertions, 4 deletions
diff --git a/xmake/scripts/base/config.lua b/xmake/scripts/base/config.lua index cb9f269c2..a4cc7f3f2 100644 --- a/xmake/scripts/base/config.lua +++ b/xmake/scripts/base/config.lua @@ -141,10 +141,6 @@ function config._make() config._CURRENT = config._CURRENT or {} local current = config._CURRENT - -- init the current target - current.target = options.target or options._DEFAULTS.target - assert(current.target) - -- get configs from the global configure first if global._CURRENT then for k, v in pairs(global._CURRENT) do @@ -445,6 +441,31 @@ function config.loadxconf() config._make() end +-- clear up and remove all auto values +function config.clearup() + + -- clear up the current configure + local current = config._CURRENT + if current then + for k, v in pairs(current) do + if v and type(v) and v == "auto" then + current[k] = nil + end + end + end + + -- clear up the current target configure + local target = config._target() + if target then + for k, v in pairs(target) do + if v and type(v) and v == "auto" then + target[k] = nil + end + end + end + +end + -- dump the current configure function config.dump() diff --git a/xmake/scripts/base/global.lua b/xmake/scripts/base/global.lua index 196cbad9c..40cb04518 100644 --- a/xmake/scripts/base/global.lua +++ b/xmake/scripts/base/global.lua @@ -296,6 +296,30 @@ function global.loadxconf() global._make() end +-- clear up and remove all auto values +function global.clearup() + + -- clear up the current configure + local current = global._CURRENT + if current then + for k, v in pairs(current) do + if v and type(v) and v == "auto" then + current[k] = nil + end + end + end + + -- clear up the configure + local configs = global._CONFIGS + if configs then + for k, v in pairs(configs) do + if v and type(v) and v == "auto" then + configs[k] = nil + end + end + end +end + -- dump the current configure function global.dump() diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua index df9e00105..962f1b873 100644 --- a/xmake/scripts/base/main.lua +++ b/xmake/scripts/base/main.lua @@ -429,6 +429,9 @@ function main._prepare_global() -- probe the global platform configure platform.probe(global_wrapped, true) + + -- clear up the global configure + global.clearup() end -- ok @@ -484,6 +487,9 @@ function main._prepare_project() -- probe the current platform configure platform.probe(config_wrapped, false) + -- clear up the configure + config.clearup() + end -- merge the default options |
