mjambon / dune-deps

Show the internal dependencies in your OCaml/Reason/Dune project
BSD 3-Clause "New" or "Revised" License
59 stars 6 forks source link

need to track name and public_name for libraries #26

Open rr0gi opened 1 year ago

rr0gi commented 1 year ago

It seems dune-deps only tracks dependencies via public_name, so when the library has both name and public_name stanzas and is referenced via "internal" name - this dependency is not shown by dune-deps.

rr0gi commented 1 year ago
diff --git a/src/lib/Dune.ml b/src/lib/Dune.ml
index e635dd2..3247bc5 100644
--- a/src/lib/Dune.ml
+++ b/src/lib/Dune.ml
@@ -36,15 +36,15 @@ let extract_strings sexp_list =
 let extract_names entry =
   let public_names =
     match find_list ["public_names"; "public_name"] entry with
-    | None -> None
-    | Some l -> Some (extract_strings l)
+    | None -> []
+    | Some l -> extract_strings l
   in
-  match public_names with
-  | Some names -> names
-  | None ->
-      match find_list ["names"; "name"] entry with
-      | None -> []
-      | Some l -> extract_strings l
+  let names =
+    match find_list ["names"; "name"] entry with
+    | None -> []
+    | Some l -> extract_strings l
+  in
+  List.sort_uniq String.compare (public_names @ names)
raphael-proust commented 23 hours ago

AFAICT, this is solved by #29