Skip to content

Commit

Permalink
Driver: add status.json generation for normal mode
Browse files Browse the repository at this point in the history
  • Loading branch information
panglesd authored and jonludlam committed Feb 12, 2025
1 parent 224e782 commit d88e04c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/driver/bin/odoc_driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ let run_inner ~odoc_dir ~odocl_dir ~index_dir ~mld_dir ~compile_grep ~link_grep
Compile.html_generate ~occurrence_file ~remaps ~generate_json
~simplified_search_output:false html_dir linked
in
List.iter (fun pkg -> Status.file ~html_dir ~pkg ()) all;
let _ = Odoc.support_files html_dir in
Stats.stats.finished <- true;
())
Expand Down
9 changes: 1 addition & 8 deletions src/driver/bin/odoc_driver_voodoo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ let generate_status ~html_dir pkg =
pkg.Packages.libraries;
redirections
in
let status = Status.json ~html_dir ~pkg ~redirections () in
let status = Yojson.Safe.pretty_to_string status in
let status_path = Fpath.(html_dir // Odoc_unit.pkg_dir pkg / "status.json") in
match Bos.OS.File.write status_path status with
| Ok () -> ()
| Error (`Msg msg) ->
Logs.err (fun m ->
m "Error when generating status.json for %s: %s" pkg.name msg)
Status.file ~html_dir ~pkg ~redirections ()

let run package_name blessed actions odoc_dir odocl_dir
{ Common_args.verbose; html_dir; nb_workers; odoc_bin; odoc_md_bin; _ } =
Expand Down
10 changes: 10 additions & 0 deletions src/driver/status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,13 @@ let json ~html_dir ~pkg ?(redirections = Hashtbl.create 0) () =
("failed", failed);
("redirections", redirections);
]

let file ~html_dir ~pkg ?(redirections = Hashtbl.create 0) () =
let json = json ~html_dir ~pkg ~redirections () in
let json = Yojson.Safe.pretty_to_string json in
let status_path = Fpath.(html_dir // Odoc_unit.pkg_dir pkg / "status.json") in
match Bos.OS.File.write status_path json with
| Ok () -> ()
| Error (`Msg msg) ->
Logs.err (fun m ->
m "Error when generating status.json for %s: %s" pkg.name msg)

0 comments on commit d88e04c

Please sign in to comment.