diff options
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 57f7c1b78..e82691534 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -384,20 +384,39 @@ function _instance:librarydeps() end -- get parents -function _instance:parents() - return self._PARENTS +function _instance:parents(packagename) + local parents = self._PARENTS + if parents then + if packagename then + return parents[packagename] + else + local results = self._PARENTS_PLAIN + if not results then + results = {} + for _, parentpkgs in pairs(parents) do + table.join2(results, parentpkgs) + end + results = table.unique(results) + self._PARENTS_PLAIN = results + end + return results + end + end end -- add parents function _instance:parents_add(...) self._PARENTS = self._PARENTS or {} for _, parent in ipairs({...}) do + -- maybe multiple parents will depend on it + -- @see https://github.com/xmake-io/xmake/issues/3065 local parentpkgs = self._PARENTS[parent:name()] if not parentpkgs then parentpkgs = {} self._PARENTS[parent:name()] = parentpkgs end table.insert(parentpkgs, parent) + self._PARENTS_PLAIN = nil end end |
