summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-18 00:57:23 +0800
committerruki <[email protected]>2022-10-18 00:57:23 +0800
commite732b8f24940f524f4d7a48ea92cdc91520d8622 (patch)
tree06e928f191ef3509523c3ca77b7cf22de8b796ce
parent6d8ba20054dca9198f8ac71d5792bf76bcf86c4c (diff)
get package info from components
-rw-r--r--xmake/core/project/target.lua12
-rw-r--r--xmake/modules/package/manager/xmake/find_package.lua1
2 files changed, 10 insertions, 3 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index f20d0e3f7..c4e73b37d 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -417,8 +417,16 @@ function _instance:get_from_pkgs(name, opt)
-- uses them instead of the builtin configs if exists extra package config
-- e.g. `add_packages("xxx", {links = "xxx"})`
local configinfo = self:pkgconfig(pkg:name())
- if configinfo and configinfo[name] then
- table.join2(values, configinfo[name])
+ if configinfo and configinfo.components then
+ local components = table.wrap(pkg:get("components"))
+ for _, component_name in ipairs(table.wrap(configinfo.components)) do
+ local info = components[component_name]
+ if info then
+ table.join2(values, info[name] or pkg:get(name))
+ end
+ end
+ elseif configinfo and configinfo[name] then
+ table.join2(values, configinfo[name])
else
-- uses the builtin package configs
table.join2(values, pkg:get(name))
diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua
index 44668d503..a8072e91f 100644
--- a/xmake/modules/package/manager/xmake/find_package.lua
+++ b/xmake/modules/package/manager/xmake/find_package.lua
@@ -206,7 +206,6 @@ function _find_package_from_repo(name, opt)
-- get version and license
result.version = manifest.version or path.filename(path.directory(path.directory(manifest_file)))
result.license = manifest.license
- print(result)
return result
end