From 34a8bf91605a003c7de539f77802a7503c192134 Mon Sep 17 00:00:00 2001 From: rand00 Date: Thu, 17 Mar 2022 16:31:07 +0100 Subject: [PATCH] Builder-viz: Passing transitive deps stats for coloring of nodes in opam-graph --- bin/visualizations/builder_viz.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/visualizations/builder_viz.ml b/bin/visualizations/builder_viz.ml index fcb11e3..ea30406 100644 --- a/bin/visualizations/builder_viz.ml +++ b/bin/visualizations/builder_viz.ml @@ -72,19 +72,23 @@ let print_treemap_html elf_path elf_size = * |> Fmt.to_to_string (Tyxml.Svg.pp ()) *) let print_dependencies_html file = - let open Opam_graph in + let module G = Opam_graph in let switch = read_file file in let data = OpamFile.SwitchExport.read_from_string switch in let transitive = false in - let graph = Ui.dependencies ~transitive data in + let graph = G.Ui.dependencies ~transitive data in + let sharing_stats = + data + |> G.dependencies ~transitive:true + |> G.calc_sharing_stats in let override_css = {| .deps-svg-wrap { background: rgb(60, 60, 87); } |} in - let html = Render.Html.of_assoc ~override_css graph in - Format.printf "%a" Render.Html.pp html + let html = G.Render.Html.of_assoc ~override_css ~sharing_stats graph in + Format.printf "%a" G.Render.Html.pp html module Cmd_aux = struct