Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(project): Allow extension with wildcard character #5895

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions xmake/core/project/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,17 @@ function project._load_targets()
local rulenames = {}
local extensions = {}
table.join2(rulenames, t:get("rules"))
for _, sourcefile in ipairs(table.wrap(t:get("files"))) do
local extension = path.extension((sourcefile:gsub("|.*$", "")))
if not extensions[extension] then
local lang = language.load_ex(extension)
if lang and lang:rules() then
table.join2(rulenames, lang:rules())
-- allow extension with wildcard character
for _, sourcefile_name in ipairs(table.wrap(t:get("files"))) do
for _, sourcefile in pairs(os.files(sourcefile_name)) do
local extension = path.extension(sourcefile)
if not extensions[extension] then
local lang = language.load_ex(extension)
if lang and lang:rules() then
table.join2(rulenames, lang:rules())
end
extensions[extension] = true
end
extensions[extension] = true
end
end
rulenames = table.unique(rulenames)
Expand Down
Loading