Skip to content

Commit 77b5700

Browse files
committed
odoc_driver: occurrences fixes
1 parent 55af8c7 commit 77b5700

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

src/driver/bin/odoc_driver.ml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,28 @@ let run_inner ~odoc_dir ~odocl_dir ~index_dir ~mld_dir ~compile_grep ~link_grep
7474
let linked =
7575
Compile.link ~warnings_tags:packages ~custom_layout:false compiled
7676
in
77+
let odoc_dirs =
78+
List.fold_left
79+
(fun acc pkg ->
80+
let lib_dirs =
81+
List.map
82+
(fun l -> Fpath.(odocl_dir // Odoc_unit.lib_dir pkg l))
83+
pkg.libraries
84+
in
85+
Fpath.Set.union acc (Fpath.Set.of_list lib_dirs))
86+
Fpath.Set.empty all
87+
in
88+
89+
Logs.debug (fun m ->
90+
m "odoc_dirs: %a" (Fmt.Dump.list Fpath.pp)
91+
(Fpath.Set.to_list odoc_dirs));
7792
let occurrence_file =
7893
let output =
79-
Fpath.( / ) odoc_dir "occurrences-all.odoc-occurrences"
94+
Fpath.( / ) odocl_dir "occurrences-all.odoc-occurrences"
95+
in
96+
let () =
97+
Odoc.count_occurrences ~input:(Fpath.Set.to_list odoc_dirs) ~output
8098
in
81-
let () = Odoc.count_occurrences ~input:[ odoc_dir ] ~output in
8299
output
83100
in
84101
let () =

src/driver/bin/odoc_driver_voodoo.ml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,24 @@ let run package_name blessed actions odoc_dir odocl_dir
5454
Logs.set_reporter (Logs_fmt.reporter ());
5555
Stats.init_nprocs nb_workers;
5656
let () = Worker_pool.start_workers env sw nb_workers in
57+
let odocl_dir = Option.value odocl_dir ~default:odoc_dir in
5758

58-
let all, extra_paths, actions, generate_json, occurrence_file =
59+
let all, extra_paths, actions, generate_json, occurrence_file, odocl_dirs =
5960
let pkg =
6061
let pkg_opt = Voodoo.find_pkg package_name ~blessed in
6162
match pkg_opt with Some pkg -> pkg | None -> exit 1
6263
in
6364
let all = Voodoo.of_voodoo pkg in
65+
let odocl_dirs =
66+
List.map
67+
(fun l -> Fpath.(odocl_dir // Odoc_unit.lib_dir all l))
68+
all.libraries
69+
in
6470
let occurrence_file =
65-
Fpath.(odoc_dir // Voodoo.occurrence_file_of_pkg pkg)
71+
Fpath.(odocl_dir // Voodoo.occurrence_file_of_pkg pkg)
6672
in
6773
let extra_paths = Voodoo.extra_paths odoc_dir in
68-
(all, extra_paths, actions, true, occurrence_file)
74+
(all, extra_paths, actions, true, occurrence_file, odocl_dirs)
6975
in
7076

7177
let all = Packages.remap_virtual [ all ] in
@@ -78,10 +84,7 @@ let run package_name blessed actions odoc_dir odocl_dir
7884
| _ -> failwith "Error, expecting singleton library in voodoo mode"
7985
in
8086
let units =
81-
let dirs =
82-
let odocl_dir = Option.value odocl_dir ~default:odoc_dir in
83-
{ Odoc_unit.odoc_dir; odocl_dir; index_dir; mld_dir }
84-
in
87+
let dirs = { Odoc_unit.odoc_dir; odocl_dir; index_dir; mld_dir } in
8588
Odoc_units_of.packages ~dirs ~indices_style:Voodoo ~extra_paths ~remap:false
8689
all
8790
in
@@ -101,7 +104,7 @@ let run package_name blessed actions odoc_dir odocl_dir
101104
compiled
102105
in
103106
let () =
104-
Odoc.count_occurrences ~input:[ odoc_dir ] ~output:occurrence_file
107+
Odoc.count_occurrences ~input:odocl_dirs ~output:occurrence_file
105108
in
106109
let () =
107110
Compile.html_generate ~occurrence_file ~remaps:[] ~generate_json

0 commit comments

Comments
 (0)