diff options
| author | Stehsaer <[email protected]> | 2025-09-28 00:42:01 +0800 |
|---|---|---|
| committer | Stehsaer <[email protected]> | 2025-09-28 00:42:01 +0800 |
| commit | b0dedad75dd17c98361c2723be98bbd8d8b1d975 (patch) | |
| tree | 3bce2c25f599b6352e92d2ad8bda848724ccd5ef /xmake/plugins/format/main.lua | |
| parent | dd07af97f1b28ed18a9cd4a66dfd574f8fc795fb (diff) | |
fix: add default file filter for `format` task
Diffstat (limited to 'xmake/plugins/format/main.lua')
| -rw-r--r-- | xmake/plugins/format/main.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/plugins/format/main.lua b/xmake/plugins/format/main.lua index 19fca6b73..733b9b59f 100644 --- a/xmake/plugins/format/main.lua +++ b/xmake/plugins/format/main.lua @@ -190,9 +190,14 @@ function main() end end else + -- Default source file filter when not specifying "--files" option + -- **.c, **.cc, **.cxx, **.cpp + local source_filepatterns = _get_file_patterns("**.c" .. path.envsep() .. "**.cc" .. path.envsep() .. "**.cxx" .. path.envsep() .. "**.cpp") for _, target in ipairs(targets) do for _, source in ipairs(target:sourcefiles()) do - table.insert(argv, path.join(projectdir, source)) + if _match_sourcefiles(source, source_filepatterns) then + table.insert(argv, path.join(projectdir, source)) + end end for _, header in ipairs(target:headerfiles()) do table.insert(argv, path.join(projectdir, header)) |
