diff options
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) |
