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 /xmake/core | |
| parent | 37e1e4b70b3f0f29e695603f1ba5ce1fd96f7417 (diff) | |
fix config readonly mode for vs201x plugin
Diffstat (limited to 'xmake/core')
| -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 |
4 files changed, 36 insertions, 10 deletions
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? |
