diff options
| author | ruki <[email protected]> | 2017-07-20 13:38:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-07-20 13:38:04 +0800 |
| commit | e5d685f1fdba2977986950b13dc851682d3f7bcc (patch) | |
| tree | 5725eb45128a427c625d0a54073bfdfd4ae9b770 | |
| parent | 37e1e4b70b3f0f29e695603f1ba5ce1fd96f7417 (diff) | |
fix config readonly mode for vs201x plugin
| -rw-r--r-- | xmake/actions/config/main.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/global/main.lua | 2 | ||||
| -rw-r--r-- | xmake/core/base/global.lua | 14 | ||||
| -rw-r--r-- | xmake/core/project/config.lua | 14 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/base/global.lua | 9 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/config.lua | 9 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 4 |
7 files changed, 40 insertions, 14 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 1a04e0942..bc7fa5fc2 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -207,7 +207,7 @@ function main() options_changed = options_changed or options_history[name] ~= value -- @note override it and mark as readonly (highest priority) - config.set(name, value, true) + config.set(name, value, {readonly = true}) end -- merge the cached configure diff --git a/xmake/actions/global/main.lua b/xmake/actions/global/main.lua index de3d9ea51..5bd848c74 100644 --- a/xmake/actions/global/main.lua +++ b/xmake/actions/global/main.lua @@ -46,7 +46,7 @@ function main() changed = changed or global.get(name) ~= value -- @note override it and mark as readonly - global.set(name, value, true) + global.set(name, value, {readonly = true}) end end diff --git a/xmake/core/base/global.lua b/xmake/core/base/global.lua index 823603722..0bced098f 100644 --- a/xmake/core/base/global.lua +++ b/xmake/core/base/global.lua @@ -59,20 +59,28 @@ function global.readonly(name) end -- set the given configure to the current -function global.set(name, value, readonly) +-- +-- @param name the name +-- @param value the value +-- @param opt the argument options, .e.g {readonly = false, force = false} +-- +function global.set(name, value, opt) -- check assert(name) + -- init options + opt = opt or {} + -- check readonly - assert(not global.readonly(name), "cannot set readonly global: " .. name) + assert(opt.force or not global.readonly(name), "cannot set readonly global: " .. name) -- set it global._CONFIGS = global._CONFIGS or {} global._CONFIGS[name] = value -- mark as readonly - if readonly then + if opt.readonly then global._MODES = global._MODES or {} global._MODES["__readonly_" .. name] = true end diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index 1fa1ac856..2da8e8705 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -86,20 +86,28 @@ function config.readonly(name) end -- set the given configure to the current -function config.set(name, value, readonly) +-- +-- @param name the name +-- @param value the value +-- @param opt the argument options, .e.g {readonly = false, force = false} +-- +function config.set(name, value, opt) -- check assert(name) + -- init options + opt = opt or {} + -- check readonly - assert(not config.readonly(name), "cannot set readonly config: " .. name) + assert(opt.force or not config.readonly(name), "cannot set readonly config: " .. name) -- set it config._CONFIGS = config._CONFIGS or {} config._CONFIGS[name] = value -- mark as readonly - if readonly then + if opt.readonly then config._MODES = config._MODES or {} config._MODES["__readonly_" .. name] = true end diff --git a/xmake/core/sandbox/modules/import/core/base/global.lua b/xmake/core/sandbox/modules/import/core/base/global.lua index 65d72b26d..c05edb52c 100644 --- a/xmake/core/sandbox/modules/import/core/base/global.lua +++ b/xmake/core/sandbox/modules/import/core/base/global.lua @@ -37,8 +37,13 @@ function sandbox_core_base_global.get(name) end -- set the configure -function sandbox_core_base_global.set(name, value, readonly) - global.set(name, value, readonly) +-- +-- @param name the name +-- @param value the value +-- @param opt the argument options, .e.g {readonly = false, force = false} +-- +function sandbox_core_base_global.set(name, value, opt) + global.set(name, value, opt) end -- this config name is readonly? diff --git a/xmake/core/sandbox/modules/import/core/project/config.lua b/xmake/core/sandbox/modules/import/core/project/config.lua index 2a4e8261e..4ecdeca92 100644 --- a/xmake/core/sandbox/modules/import/core/project/config.lua +++ b/xmake/core/sandbox/modules/import/core/project/config.lua @@ -72,8 +72,13 @@ function sandbox_core_project_config.get(name) end -- set the given configure to the current -function sandbox_core_project_config.set(name, value, readonly) - return config.set(name, value, readonly) +-- +-- @param name the name +-- @param value the value +-- @param opt the argument options, .e.g {readonly = false, force = false} +-- +function sandbox_core_project_config.set(name, value, opt) + return config.set(name, value, opt) end -- this config name is readonly? diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index 12d7ae4fb..ad60e33cc 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -163,8 +163,8 @@ function make(outputdir, vsinfo) if mode ~= config.mode() or arch ~= config.arch() then -- modify config - config.set("mode", mode) - config.set("arch", arch) + config.set("mode", mode, {readonly = true, force = true}) + config.set("arch", arch, {readonly = true, force = true}) -- clear project to reload and recheck it project.clear() |
