diff options
| author | ruki <[email protected]> | 2022-09-27 22:40:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-27 22:40:43 +0800 |
| commit | 239a254ca980adb927e086cf2cf1e4392e9c61c6 (patch) | |
| tree | dbac3a91f799256d0f0c23e7cda59dedd3bc5cdc /xmake/core/project/rule.lua | |
| parent | 466896dac3710e145baa671c95af27a97dbb5ebe (diff) | |
build rule deps
Diffstat (limited to 'xmake/core/project/rule.lua')
| -rw-r--r-- | xmake/core/project/rule.lua | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua index 39a7c49e3..f9449ad58 100644 --- a/xmake/core/project/rule.lua +++ b/xmake/core/project/rule.lua @@ -34,6 +34,18 @@ local sandbox = require("sandbox/sandbox") local sandbox_os = require("sandbox/modules/os") local sandbox_module = require("sandbox/modules/import/core/sandbox/module") +-- invalidate the previous cache +function _instance:_invalidate(name) + if name == "deps" then + self._DEPS = nil + self._ORDERDEPS = nil + end +end + +-- build deps +function _instance:_build_deps() +end + -- get the base rule function _instance:base() return self._BASE @@ -42,8 +54,7 @@ end -- clone rule function _instance:clone() local instance = rule.new(self:name(), self._INFO:clone()) - -- TODO - instance._RULES = self._RULES + instance._DEPS = self._DEPS instance._ORDERDEPS = self._ORDERDEPS return instance end @@ -62,11 +73,13 @@ end -- set the value to the package info function _instance:set(name, ...) self._INFO:apival_set(name, ...) + self:_invalidate(name) end -- add the value to the package info function _instance:add(name, ...) self._INFO:apival_add(name, ...) + self:_invalidate(name) end -- get the extra configuration @@ -105,11 +118,17 @@ end -- get rule deps function _instance:deps() + if self._DEPS == nil then + self:_build_deps() + end return self._DEPS end -- get rule order deps function _instance:orderdeps() + if self._DEPS == nil then + self:_build_deps() + end return self._ORDERDEPS end |
