diff options
| author | ruki <[email protected]> | 2019-09-06 22:38:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-09-06 09:49:43 +0800 |
| commit | e5152e174154dde4f9fdd3f49047f36c0966d7ea (patch) | |
| tree | abd39a906a05aa856dbb18b4813d9181ae8a1fdd /xmake/core/project/option.lua | |
| parent | cfb90668f507c9b93fa3e53f78f8f46cdb136413 (diff) | |
impl clang modules
Diffstat (limited to 'xmake/core/project/option.lua')
| -rw-r--r-- | xmake/core/project/option.lua | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua index c5a8c7322..292adacba 100644 --- a/xmake/core/project/option.lua +++ b/xmake/core/project/option.lua @@ -43,9 +43,10 @@ local sandbox_module = require("sandbox/modules/import/core/sandbox/module") -- new an instance function _instance.new(name, info) - local instance = table.inherit(_instance) - instance._NAME = name - instance._INFO = info + local instance = table.inherit(_instance) + instance._NAME = name + instance._INFO = info + instance._CACHEID = 1 return instance end @@ -181,6 +182,11 @@ function _instance:_check() io.flush() end +-- invalidate the previous cache key +function _instance:_invalidate() + self._CACHEID = self._CACHEID + 1 +end + -- attempt to check option function _instance:check() @@ -296,16 +302,19 @@ end -- set the value to the option info function _instance:set(name, ...) self._INFO:apival_set(name, ...) + self:_invalidate() end -- add the value to the option info function _instance:add(name, ...) self._INFO:apival_add(name, ...) + self:_invalidate() end -- remove the value to the option info function _instance:del(name, ...) self._INFO:apival_del(name, ...) + self:_invalidate() end -- get the extra configuration @@ -336,6 +345,11 @@ function _instance:name() return self._NAME end +-- get the cache key +function _instance:cachekey() + return string.format("%s_%d", tostring(self), self._CACHEID) +end + -- get xxx_script function _instance:script(name) |
