Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver: New hierarchy #1236

Merged
merged 9 commits into from
Nov 8, 2024
26 changes: 2 additions & 24 deletions src/driver/landing_pages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module LibraryLanding = struct

let page ~pkg ~odoc_dir ~odocl_dir ~mld_dir ~pkg_dir lib =
let content = content lib in
let rel_path = Fpath.(pkg_dir / "lib" / lib.lib_name) in
let rel_path = Fpath.(pkg_dir / lib.lib_name) in
let pages_rel = [ (pkg.name, rel_path) ] in
let pkg_args =
{ Pkg_args.pages = pages_rel; libs = []; odocl_dir; odoc_dir }
Expand All @@ -90,25 +90,6 @@ module LibraryLanding = struct
~include_dirs ~pkg_args ()
end

module PackageLibLanding = struct
let content pkg ppf =
fpf ppf "{0 %s}@\n" pkg.name;
let print_lib (lib : Packages.libty) =
fpf ppf "- {{!/%s/%s/index}%s}@\n" pkg.name lib.lib_name lib.lib_name
in
List.iter print_lib pkg.libraries

let page ~pkg ~odoc_dir ~odocl_dir ~mld_dir =
let content = content pkg in
let rel_path = Fpath.(pkg.pkg_dir / "lib") in
let pages_rel = [ (pkg.name, rel_path) ] in
let pkg_args =
{ Pkg_args.pages = pages_rel; libs = []; odoc_dir; odocl_dir }
in
make_unit ~odoc_dir ~odocl_dir ~mld_dir rel_path ~content ~pkgname:pkg.name
~pkg_args ()
end

let of_package ~mld_dir ~odoc_dir ~odocl_dir pkg =
let library_pages =
List.map
Expand All @@ -119,10 +100,7 @@ let of_package ~mld_dir ~odoc_dir ~odocl_dir pkg =
let package_landing_page =
PackageLanding.page ~odoc_dir ~odocl_dir ~mld_dir ~pkg
in
let library_list_page =
PackageLibLanding.page ~odoc_dir ~odocl_dir ~mld_dir ~pkg
in
package_landing_page :: library_list_page :: library_pages
package_landing_page :: library_pages

let of_packages ~mld_dir ~odoc_dir ~odocl_dir all =
PackageList.page ~mld_dir ~odoc_dir ~odocl_dir all
Expand Down
2 changes: 2 additions & 0 deletions src/driver/odoc_driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ let run libs verbose packages_dir odoc_dir odocl_dir html_dir stats nb_workers
if voodoo then
match Util.StringMap.to_list all with
| [ (_, p) ] ->
(* TODO: check whether the [doc] layer should be removed (due to new
Copy link
Member

@jonludlam jonludlam Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fine to remove the 'doc' dir.

hierarchy) or if this is something voodoo rely on *)
let output_path = Fpath.(odoc_dir // p.pkg_dir / "doc") in
Some output_path
| _ -> failwith "Error, expecting singleton library in voodoo mode"
Expand Down
5 changes: 2 additions & 3 deletions src/driver/odoc_unit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ and pp : all_kinds unit Fmt.t =
(Fmt.option pp_index) x.index pp_kind
(x.kind :> all_kinds)

let doc_dir pkg = Fpath.(pkg.Packages.pkg_dir / "doc")
let lib_dir pkg lib =
Fpath.(pkg.Packages.pkg_dir / "lib" / lib.Packages.lib_name)
let doc_dir pkg = pkg.Packages.pkg_dir
let lib_dir pkg lib = Fpath.(pkg.Packages.pkg_dir / lib.Packages.lib_name)

let of_packages ~odoc_dir ~odocl_dir ~index_dir ~extra_libs_paths
(pkgs : Packages.t list) : t list =
Expand Down