diff options
| author | ruki <[email protected]> | 2016-03-01 08:12:57 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-01 08:12:57 +0800 |
| commit | f5e9ceb716b33dcf8e0e4c30c7e03ac505a845d7 (patch) | |
| tree | 58ba2df9191e89f017c57022657b7f574a800fb5 | |
| parent | e5085252662ae566f0b74682f3ab40e594a7a4fa (diff) | |
merge default options for option.get
| -rw-r--r-- | xmake/core/base/action.lua | 9 | ||||
| -rw-r--r-- | xmake/core/base/config.lua | 16 | ||||
| -rw-r--r-- | xmake/core/base/global.lua | 6 | ||||
| -rw-r--r-- | xmake/core/base/option.lua | 2 |
4 files changed, 6 insertions, 27 deletions
diff --git a/xmake/core/base/action.lua b/xmake/core/base/action.lua index acd142b11..de417ffc2 100644 --- a/xmake/core/base/action.lua +++ b/xmake/core/base/action.lua @@ -81,10 +81,6 @@ end -- done the given action function action.done(name) - -- the options - local options = option.options() - assert(options) - -- load the given action local _action = action._load(name) if not _action then return false end @@ -109,11 +105,6 @@ function action.done(name) end end - -- merge the default options - for k, v in pairs(option.defaults()) do - if nil == options[k] then options[k] = v end - end - -- make the platform configure if _action.need("platform") and not platform.make() then utils.error("make platform configure: %s failed!", config.get("plat")) diff --git a/xmake/core/base/config.lua b/xmake/core/base/config.lua index f3469ce17..65187fd4b 100644 --- a/xmake/core/base/config.lua +++ b/xmake/core/base/config.lua @@ -34,10 +34,6 @@ local global = require("base/global") -- make configure for the current target function config._make(configs) - -- the options - local options = option.options() - assert(options) - -- init current target configure local current = {} @@ -95,16 +91,12 @@ end -- get the current target scope function config._target() - -- the options - local options = option.options() - assert(options) - -- check local configs = config._CONFIGS assert(configs) -- the target name - local name = options.target or option.default("target") + local name = option.get("target") assert(name and type(name) == "string") -- for all targets? @@ -206,13 +198,13 @@ function config.load() assert(option._MENU.config) -- the target name - local name = options.target or option.default("target") + local name = option.get("target") if not name then return "no given target name!" end -- does not clean the cached configure? - if not options.clean then + if not option.get("clean") then -- load and execute the xmake.xconf local filepath = config._file() @@ -284,7 +276,7 @@ function config.load() local configs = config._CONFIGS -- mark as "rebuild" if clean the cached configure - if options.clean then + if option.get("clean") then configs.__rebuild = true end diff --git a/xmake/core/base/global.lua b/xmake/core/base/global.lua index 42ba754e5..2e1afcb13 100644 --- a/xmake/core/base/global.lua +++ b/xmake/core/base/global.lua @@ -36,10 +36,6 @@ function global._make() local configs = global._CONFIGS assert(configs) - -- the options - local options = option.options() - assert(options) - -- init current global configure global._CURRENT = global._CURRENT or {} local current = global._CURRENT @@ -144,7 +140,7 @@ function global.load() end -- does not clean the cached configure? - if not options.clean then + if not option.get("clean") then -- load and execute the xmake.conf local filepath = global._file() diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua index 28af2c299..28f52dee3 100644 --- a/xmake/core/base/option.lua +++ b/xmake/core/base/option.lua @@ -370,7 +370,7 @@ function option.get(name) assert(options) -- get it - return options[name] + return options[name] or option.default(name) end -- get the given default option value for the current task |
