diff --git a/src/driver/bin/odoc_driver.ml b/src/driver/bin/odoc_driver.ml index e747a123b9..53735a0c46 100644 --- a/src/driver/bin/odoc_driver.ml +++ b/src/driver/bin/odoc_driver.ml @@ -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; ()) diff --git a/src/driver/bin/odoc_driver_voodoo.ml b/src/driver/bin/odoc_driver_voodoo.ml index ec22d7bd51..4bc9f8e481 100644 --- a/src/driver/bin/odoc_driver_voodoo.ml +++ b/src/driver/bin/odoc_driver_voodoo.ml @@ -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; _ } = diff --git a/src/driver/status.ml b/src/driver/status.ml index 00680e39c9..f870d4d227 100644 --- a/src/driver/status.ml +++ b/src/driver/status.ml @@ -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)