Skip to content

Commit

Permalink
Add all option to format
Browse files Browse the repository at this point in the history
  • Loading branch information
A2va committed Feb 22, 2024
1 parent 8436c24 commit 3bf168a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
10 changes: 0 additions & 10 deletions xmake/plugins/format/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,9 @@ function _get_targets(targetname, group_pattern)
if targetname then
table.insert(targets_root, project.target(targetname))
else
local depset = hashset.new()
local targets = {}
for _, target in pairs(project.targets()) do
local group = target:get("group")
if (target:is_default() and not group_pattern) or option.get("all") or (group_pattern and group and group:match(group_pattern)) then
for _, depname in ipairs(target:get("deps")) do
depset:insert(depname)
end
table.insert(targets, target)
end
end
for _, target in pairs(targets) do
if not depset:has(target:name()) then
table.insert(targets_root, target)
end
end
Expand Down
1 change: 1 addition & 0 deletions xmake/plugins/format/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ task("format")
{'s', "style", "kv", nil, "Set the path of .clang-format file, a coding style",
values = {"LLVM", "Google", "Chromium", "Mozilla", "WebKit"}},
{nil, "create", "k", nil, "Create a .clang-format file from a coding style"},
{'a', "all", "k", nil , "Format all targets."},
{'g', "group", "kv", nil, "Format all targets of the given group. It support path pattern matching.",
"e.g.",
" xmake format -g test",
Expand Down

0 comments on commit 3bf168a

Please sign in to comment.