diff options
| author | ruki <[email protected]> | 2016-06-15 11:17:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-06-15 11:17:26 +0800 |
| commit | cfd9db015cbb79b047280d0acfad5950530d4158 (patch) | |
| tree | 768ee463a5bd63e26e1561c8ea24b27221e5a7ad /xmake/core/project/option.lua | |
| parent | d960300a20f47a9787d4881dd4e7dd5d2f6150d9 (diff) | |
add bindings for option
Diffstat (limited to 'xmake/core/project/option.lua')
| -rw-r--r-- | xmake/core/project/option.lua | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua index 9e7e0ede0..f225a01a1 100644 --- a/xmake/core/project/option.lua +++ b/xmake/core/project/option.lua @@ -437,46 +437,28 @@ function option:_check() local enable = self:get("enable") if enable ~= nil and enable then - -- enable option - self:enable() + -- enable this option + config.set(self:name(), true) + + -- save this option to configure + self:save() -- check option elseif enable == nil and self:_check_condition() then - -- enable option - self:enable() - else - - -- disable option - self:disable() - end -end - --- enable this option -function option:enable() - - -- enable this option - config.set(self:name(), true) - - -- save this option to configure - self:save() -end - --- disable this option -function option:disable() - - -- disable this option - config.set(self:name(), false) + -- enable this option + config.set(self:name(), true) - -- clear this option to configure - self:clear() -end + -- save this option to configure + self:save() + else --- is enabled? -function option:enabled() + -- disable this option + config.set(self:name(), false) - -- ok? - return config.get(self:name()) + -- clear this option to configure + self:clear() + end end -- attempt to check option @@ -542,16 +524,8 @@ end -- save the option info to the cache function option:save() - -- remove functions first before saving option - local info = {} - for k, v in pairs(self._INFO) do - if type(v) ~= "function" then - info[k] = v - end - end - -- save it - cache:set(self:name(), info) + cache:set(self:name(), self._INFO) cache:flush() end |
