summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorAkaps316 <[email protected]>2026-04-12 19:40:20 +0530
committerruki <[email protected]>2026-04-20 09:35:36 +0800
commit7eada8439652626e484c0011a4ae536b916cc7fe (patch)
treeff7141a877441ceda06d55c2b30e72f5d9435803 /xmake/plugins
parent0c36a9b4acb9150c607b3d70291ad50148785038 (diff)
fix(depgraph): use direct deps and align print output with JSON
- Switch from target:orderdeps() to target:get('deps') to show only direct dependencies declared via add_deps(), not transitive ones - Print output now shows all fields: root targets, name, kind, group, default, and deps — matching the JSON structure - Add kind assertion to test
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/show/info/depgraph.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/xmake/plugins/show/info/depgraph.lua b/xmake/plugins/show/info/depgraph.lua
index 1f3142309..0807d865a 100644
--- a/xmake/plugins/show/info/depgraph.lua
+++ b/xmake/plugins/show/info/depgraph.lua
@@ -27,8 +27,11 @@ import("private.detect.check_targetname")
function _collect_target_entry(target)
local deps = {}
- for _, dep in ipairs(target:orderdeps() or {}) do
- table.insert(deps, dep:name())
+ local plain_deps = target:get("deps")
+ if plain_deps then
+ for _, dep in ipairs(plain_deps) do
+ table.insert(deps, dep)
+ end
end
return {
@@ -86,9 +89,18 @@ end
function _print_target_graph(graph)
print("The dependency graph of targets:")
+ cprint("")
+ cprint(" ${color.dump.string}root targets${clear}: %s", table.concat(graph.root_targets, ", "))
+ cprint("")
for _, target in ipairs(graph.targets) do
local deps = #target.deps > 0 and table.concat(target.deps, ", ") or "(none)"
- cprint(" ${color.dump.string}%s${clear}: %s", target.name, deps)
+ cprint(" ${color.dump.string}%s${clear}:", target.name)
+ cprint(" ${dim}kind${clear}: %s", target.kind)
+ if target.group then
+ cprint(" ${dim}group${clear}: %s", target.group)
+ end
+ cprint(" ${dim}default${clear}: %s", tostring(target.default))
+ cprint(" ${dim}deps${clear}: %s", deps)
end
end