Skip to content

Commit d88e04c

Browse files
panglesdjonludlam
authored andcommitted
Driver: add status.json generation for normal mode
1 parent 224e782 commit d88e04c

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/driver/bin/odoc_driver.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ let run_inner ~odoc_dir ~odocl_dir ~index_dir ~mld_dir ~compile_grep ~link_grep
6969
Compile.html_generate ~occurrence_file ~remaps ~generate_json
7070
~simplified_search_output:false html_dir linked
7171
in
72+
List.iter (fun pkg -> Status.file ~html_dir ~pkg ()) all;
7273
let _ = Odoc.support_files html_dir in
7374
Stats.stats.finished <- true;
7475
())

src/driver/bin/odoc_driver_voodoo.ml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,7 @@ let generate_status ~html_dir pkg =
3838
pkg.Packages.libraries;
3939
redirections
4040
in
41-
let status = Status.json ~html_dir ~pkg ~redirections () in
42-
let status = Yojson.Safe.pretty_to_string status in
43-
let status_path = Fpath.(html_dir // Odoc_unit.pkg_dir pkg / "status.json") in
44-
match Bos.OS.File.write status_path status with
45-
| Ok () -> ()
46-
| Error (`Msg msg) ->
47-
Logs.err (fun m ->
48-
m "Error when generating status.json for %s: %s" pkg.name msg)
41+
Status.file ~html_dir ~pkg ~redirections ()
4942

5043
let run package_name blessed actions odoc_dir odocl_dir
5144
{ Common_args.verbose; html_dir; nb_workers; odoc_bin; odoc_md_bin; _ } =

src/driver/status.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,13 @@ let json ~html_dir ~pkg ?(redirections = Hashtbl.create 0) () =
4242
("failed", failed);
4343
("redirections", redirections);
4444
]
45+
46+
let file ~html_dir ~pkg ?(redirections = Hashtbl.create 0) () =
47+
let json = json ~html_dir ~pkg ~redirections () in
48+
let json = Yojson.Safe.pretty_to_string json in
49+
let status_path = Fpath.(html_dir // Odoc_unit.pkg_dir pkg / "status.json") in
50+
match Bos.OS.File.write status_path json with
51+
| Ok () -> ()
52+
| Error (`Msg msg) ->
53+
Logs.err (fun m ->
54+
m "Error when generating status.json for %s: %s" pkg.name msg)

0 commit comments

Comments
 (0)