summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-01-22 22:12:07 +0800
committerruki <[email protected]>2022-01-22 22:12:07 +0800
commitfbb71638f89fb2450aaffdc424d3c8354eff3455 (patch)
tree48adf3efda343f81b23441cafa838ab62dbff9c9
parente2bbeb1b0731b7720df562f7630c38c5da205126 (diff)
fix requires with group
-rw-r--r--xmake/modules/private/action/require/impl/package.lua68
1 files changed, 32 insertions, 36 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 1d013b91e..07e2abc34 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -326,45 +326,41 @@ function _select_package_version(package, requireinfo, locked_requireinfo)
return version, source
end
- -- if not phony package (only as package group)
- if not requireinfo.group then
-
- -- has git url?
- local has_giturl = false
- for _, url in ipairs(package:urls()) do
- if git.checkurl(url) then
- has_giturl = true
- break
- end
+ -- has git url?
+ local has_giturl = false
+ for _, url in ipairs(package:urls()) do
+ if git.checkurl(url) then
+ has_giturl = true
+ break
end
+ end
- -- select package version
- local source = nil
- local version = nil
- local require_version = requireinfo.version
- local require_verify = requireinfo.verify
- if (not package:get("versions") or require_verify == false) and semver.is_valid(require_version) then
- -- no version list in package() or need not verify sha256sum? try selecting this version directly
- -- @see https://github.com/xmake-io/xmake/issues/930
- -- https://github.com/xmake-io/xmake/issues/1009
- version = require_version
- source = "version"
- elseif #package:versions() > 0 then -- select version?
- version, source = try { function () return semver.select(require_version, package:versions()) end }
- end
- if not version and has_giturl and not semver.is_valid(require_version) then -- select branch?
- version, source = require_version ~= "latest" and require_version or "master", "branch"
- end
- -- local source package? we use a phony version
- if not version and require_version == "latest" and #package:urls() == 0 then
- version = "latest"
- source = "version"
- end
- if not version and not package:is_thirdparty() then
- raise("package(%s): version(%s) not found!", package:name(), require_version)
- end
- return version, source
+ -- select package version
+ local source = nil
+ local version = nil
+ local require_version = requireinfo.version
+ local require_verify = requireinfo.verify
+ if (not package:get("versions") or require_verify == false) and semver.is_valid(require_version) then
+ -- no version list in package() or need not verify sha256sum? try selecting this version directly
+ -- @see https://github.com/xmake-io/xmake/issues/930
+ -- https://github.com/xmake-io/xmake/issues/1009
+ version = require_version
+ source = "version"
+ elseif #package:versions() > 0 then -- select version?
+ version, source = try { function () return semver.select(require_version, package:versions()) end }
+ end
+ if not version and has_giturl and not semver.is_valid(require_version) then -- select branch?
+ version, source = require_version ~= "latest" and require_version or "master", "branch"
+ end
+ -- local source package? we use a phony version
+ if not version and require_version == "latest" and #package:urls() == 0 then
+ version = "latest"
+ source = "version"
+ end
+ if not version and not package:is_thirdparty() then
+ raise("package(%s): version(%s) not found!", package:name(), require_version)
end
+ return version, source
end
-- check the configurations of packages