diff options
| author | ruki <[email protected]> | 2020-01-15 00:57:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-01-14 23:42:14 +0800 |
| commit | eb1effdccd96425375af083d45a94a790f0c6d56 (patch) | |
| tree | 8eb796b2fc2c80daa98ad5b03717177b62b7c1c9 | |
| parent | 2ac4c85c73d5fe061d96b1f4dbcb808787474ffd (diff) | |
add resources for package
| -rw-r--r-- | xmake/actions/require/impl/action/patch.lua | 2 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 24 |
2 files changed, 24 insertions, 2 deletions
diff --git a/xmake/actions/require/impl/action/patch.lua b/xmake/actions/require/impl/action/patch.lua index 2c04f9d6b..66340b8d8 100644 --- a/xmake/actions/require/impl/action/patch.lua +++ b/xmake/actions/require/impl/action/patch.lua @@ -80,6 +80,6 @@ function main(package) -- do all patches for _, patchinfo in ipairs(patches) do - _patch(package, patchinfo[1], patchinfo[2]) + _patch(package, patchinfo.url, patchinfo.sha256) end end diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 66530e038..df9ba6435 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -918,7 +918,7 @@ function _instance:patches() patches = {} patchinfos = table.wrap(patchinfos) for idx = 1, #patchinfos, 2 do - table.insert(patches , {patchinfos[idx], patchinfos[idx + 1]}) + table.insert(patches , {url = patchinfos[idx], sha256 = patchinfos[idx + 1]}) end end end @@ -927,6 +927,27 @@ function _instance:patches() return patches and patches or nil end +-- get the resources of the current version +function _instance:resources() + local resources = self._RESOURCES + if resources == nil then + local resourceinfos = self:get("resources") + if resourceinfos then + local version_str = self:version_str() + resourceinfos = resourceinfos[version_str] + if resourceinfos then + resources = {} + resourceinfos = table.wrap(resourceinfos) + for idx = 1, #resourceinfos, 3 do + table.insert(resources, {name = resourceinfos[idx], url = resourceinfos[idx + 1], sha256 = resourceinfos[idx + 2]}) + end + end + end + self._RESOURCES = resources or false + end + return resources and resources or nil +end + -- has the given c funcs? -- -- @param funcs the funcs @@ -1078,6 +1099,7 @@ function package.apis() { -- package.add_xxx "package.add_patches" + , "package.add_resources" } , dictionary = { |
