diff options
| author | ruki <[email protected]> | 2024-01-13 00:01:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-01-13 00:01:21 +0800 |
| commit | eaa8973f7386727f9fee1d5c42b2290b61e96300 (patch) | |
| tree | cf99115671462fb47a51f1cef17b9644214637ff | |
| parent | 3c0b7f5a58dc48949793e78eee107c6c83f3b819 (diff) | |
add add_versionfiles
| -rw-r--r-- | xmake/core/package/package.lua | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index e4114c089..d5e82b13f 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -1253,26 +1253,28 @@ end -- get versions list function _instance:_versions_list() if self._VERSIONS_LIST == nil then - local versions = self:get("versions") - if type(versions) == "string" then - local versionfile = versions - if not os.isfile(versionfile) then - versionfile = path.join(self:scriptdir(), versions) - end - versions = {} - if os.isfile(versionfile) then - local list = io.readfile(versionfile) - for _, line in ipairs(list:split("\n")) do - local splitinfo = line:split("%s+") - if #splitinfo == 2 then - local version = splitinfo[1] - local shasum = splitinfo[2] - versions[version] = shasum + local versions = table.wrap(self:get("versions")) + local versionfiles = self:get("versionfiles") + if versionfiles then + utils.dump(versionfiles) + for _, versionfile in ipairs(table.wrap(versionfiles)) do + if not os.isfile(versionfile) then + versionfile = path.join(self:scriptdir(), versionfile) + end + if os.isfile(versionfile) then + local list = io.readfile(versionfile) + for _, line in ipairs(list:split("\n")) do + local splitinfo = line:split("%s+") + if #splitinfo == 2 then + local version = splitinfo[1] + local shasum = splitinfo[2] + versions[version] = shasum + end end end end end - self._VERSIONS_LIST = table.wrap(versions) + self._VERSIONS_LIST = versions end return self._VERSIONS_LIST end @@ -2590,6 +2592,11 @@ function package.apis() , "package.add_patches" , "package.add_resources" } + , paths = + { + -- package.add_xxx + "package.add_versionfiles" + } , dictionary = { -- package.add_xxx |
