Skip to content

Commit

Permalink
get extras from getter
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Oct 24, 2023
1 parent 8d0e471 commit 645d407
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions xmake/core/tool/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,10 @@ function builder:_add_flags_from_argument(flags, target, args)
end

-- add flags (named) from the language
local extras = args.extras
self:_add_flags_from_language(flags, nil, {
target = function (name)
return args[name]
return args[name], extras and extras[name]
end,
toolchain = function (name)
local plat, arch
Expand All @@ -296,9 +297,16 @@ end

-- add items from getter
function builder:_add_items_from_getter(items, name, opt)
local values = opt.getter(name)
local values, extras = opt.getter(name)
if values then
table.insert(items, {name = name, values = table.wrap(values), check = opt.check, multival = opt.multival, mapper = opt.mapper, target = opt.target})
table.insert(items, {
name = name,
values = table.wrap(values),
check = opt.check,
multival = opt.multival,
mapper = opt.mapper,
target = opt.target,
extras = extras})
end
end

Expand All @@ -309,7 +317,12 @@ function builder:_add_items_from_config(items, name, opt)
values = path.splitenv(values)
end
if values then
table.insert(items, {name = name, values = table.wrap(values), check = opt.check, multival = opt.multival, mapper = opt.mapper})
table.insert(items, {
name = name,
values = table.wrap(values),
check = opt.check,
multival = opt.multival,
mapper = opt.mapper})
end
end

Expand Down Expand Up @@ -422,6 +435,7 @@ function builder:_add_flags_from_language(flags, target, getters)
for _, item in ipairs(items) do
local check = item.check
local mapper = item.mapper
local extras = item.extras
if item.multival then
local results = mapper(self:_tool(), item.values, target, self:_targetkind())
for _, flag in ipairs(table.wrap(results)) do
Expand Down

0 comments on commit 645d407

Please sign in to comment.