Skip to content

Commit

Permalink
improve get_from_deps
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Oct 26, 2023
1 parent c33fd31 commit f9dde79
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions xmake/core/project/target.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,23 @@ end

-- get values from target deps with {interface|public = ...}
function _instance:_get_from_deps(name, result_values, result_sources, opt)
local orderdeps = self:orderdeps()
local total = #orderdeps
for idx, _ in ipairs(orderdeps) do
local dep = orderdeps[total + 1 - idx]
local depinherit = self:extraconf("deps", dep:name(), "inherit")
if depinherit == nil or depinherit then
local values = dep:get(name, opt)
if values ~= nil then
table.insert(result_values, values)
table.insert(result_sources, "dep::" .. dep:name())
end
--[[TODO
table.join2(values, dep:get_from_opts(name, opt))
table.join2(values, dep:get_from_pkgs(name, opt))
]]
end
end
end

-- get values from target options with {interface|public = ...}
Expand Down Expand Up @@ -516,19 +533,14 @@ end

-- deprecated: get values from target dependencies
function _instance:get_from_deps(name, opt)
local values = {}
local orderdeps = self:orderdeps()
local total = #orderdeps
for idx, _ in ipairs(orderdeps) do
local dep = orderdeps[total + 1 - idx]
local depinherit = self:extraconf("deps", dep:name(), "inherit")
if depinherit == nil or depinherit then
table.join2(values, dep:get(name, opt))
table.join2(values, dep:get_from_opts(name, opt))
table.join2(values, dep:get_from_pkgs(name, opt))
local result = {}
local values = self:get_from(name, "dep::*", opt)
if values then
for _, v in ipairs(values) do
table.join2(result, v)
end
end
return values
return result
end

-- deprecated: get values from target options with {interface|public = ...}
Expand Down

0 comments on commit f9dde79

Please sign in to comment.