summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-04-21 00:30:34 +0800
committerruki <[email protected]>2021-04-21 00:30:34 +0800
commit23ba4a62f11733c4b07ae91f372126bf7f1c23c2 (patch)
tree072298270c92fc18652352d370df879643f67cbc
parent072137dccbce50de95b938f4bb836310cb3081cb (diff)
improve package label
-rw-r--r--xmake/core/package/package.lua24
-rw-r--r--xmake/modules/private/action/require/impl/package.lua3
2 files changed, 8 insertions, 19 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index dad9b5cc2..78c83b5d3 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -1774,14 +1774,8 @@ function package.load_from_project(packagename, project, opt)
return nil, errors
end
- -- strip trailng ~tag, e.g. zlib~debug
- local realname = packagename
- if realname:find('~', 1, true) then
- realname = realname:gsub("~.+$", "")
- end
-
- -- not found?
- local packageinfo = packages[realname]
+ -- get package info
+ local packageinfo = packages[packagename]
if not packageinfo then
return
end
@@ -1831,18 +1825,10 @@ function package.load_from_repository(packagename, repo, packagedir, opt)
return nil, errors
end
- -- get the package info
- local packageinfo = nil
- for _, info in pairs(results) do
- -- @note we cannot use the name of package() to index it, because we need support `xxx~tag` for add_requires("zlib~xxx")
- -- so we use `xxx~tag` as the real package
- packageinfo = info
- break
- end
-
- -- check this package
+ -- get package info
+ local packageinfo = results[packagename]
if not packageinfo then
- return nil, string.format("%s: the package %s not found!", scriptpath, packagename)
+ return nil, string.format("%s: package(%s) not found!", scriptpath, packagename)
end
-- new an instance
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 9e8a3e1a2..e0cff2e5a 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -68,6 +68,9 @@ end
-- - add_requires("zlib~debug", {debug = true})
-- - add_requires("zlib~shared", {configs = {shared = true}, alias = "zlib_shared"})
--
+-- - add_requires("zlib~label1")
+-- - add_requires("zlib", {label = "label2"})
+--
-- private package, only for installation, do not export any links/includes and environments to target
-- - add_requires("zlib", {private = true})
--