Skip to content

Commit

Permalink
Put voodoo output under a doc directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jonludlam committed Nov 22, 2024
1 parent 544c2ab commit bff20e4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/driver/dune_style.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ let of_dune_build dir =
(* When dune has a notion of doc assets, do something *);
enable_warnings = false;
pkg_dir;
doc_dir=pkg_dir;
other_docs = [];
config = Global_config.empty;
} )
Expand Down
6 changes: 4 additions & 2 deletions src/driver/odoc_unit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ and pp : all_kinds unit Fmt.t =
(Fmt.option pp_index) x.index pp_kind
(x.kind :> all_kinds)

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

type dirs = {
odoc_dir : Fpath.t;
Expand Down
2 changes: 2 additions & 0 deletions src/driver/odoc_unit.mli
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ type t = [ impl | intf | mld | asset | md ] unit

val pp : t Fmt.t

val pkg_dir : Packages.t -> Fpath.t
val lib_dir : Packages.t -> Packages.libty -> Fpath.t
val doc_dir : Packages.t -> Fpath.t
val src_dir : Packages.t -> Packages.libty -> Fpath.t

type dirs = {
odoc_dir : Fpath.t;
Expand Down
6 changes: 3 additions & 3 deletions src/driver/odoc_units_of.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ let packages ~dirs ~extra_paths ~gen_indices (pkgs : Packages.t list) : t list =
roots;
output_file;
json = false;
search_dir = pkg.pkg_dir;
search_dir = doc_dir pkg;
sidebar = Some sidebar;
}
in
Expand Down Expand Up @@ -166,7 +166,7 @@ let packages ~dirs ~extra_paths ~gen_indices (pkgs : Packages.t list) : t list =
let kind =
let src_name = Fpath.filename src_path in
let src_id =
Fpath.(pkg.pkg_dir / "src" / lib.lib_name / src_name)
Fpath.(src_dir pkg lib / src_name)
|> Odoc.Id.of_fpath
in
`Impl { src_id; src_path }
Expand Down Expand Up @@ -217,7 +217,7 @@ let packages ~dirs ~extra_paths ~gen_indices (pkgs : Packages.t list) : t list =
let ext = Fpath.get_ext md in
match ext with
| ".md" ->
let rel_dir = doc_dir pkg in
let rel_dir = pkg_dir pkg in
let kind = `Md in
let name = md |> Fpath.rem_ext |> Fpath.basename |> ( ^ ) "page-" in
let lib_deps = Util.StringSet.empty in
Expand Down
7 changes: 3 additions & 4 deletions src/driver/packages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type t = {
enable_warnings : bool;
other_docs : Fpath.t list;
pkg_dir : Fpath.t;
doc_dir : Fpath.t;
config : Global_config.t;
}

Expand Down Expand Up @@ -403,6 +404,7 @@ let of_libs ~packages_dir libs =
enable_warnings = false;
other_docs;
pkg_dir;
doc_dir=pkg_dir;
config;
})
acc)
Expand Down Expand Up @@ -462,16 +464,13 @@ let of_packages ~packages_dir packages =
enable_warnings;
other_docs;
pkg_dir;
doc_dir = pkg_dir;
config;
}
acc)
Util.StringMap.empty all
in
let result = fix_missing_deps packages in
Logs.debug (fun m ->
m "ZZZZ Result: %a"
Fmt.(Dump.list (pair string pp))
(Util.StringMap.bindings result));
result

type set = t Util.StringMap.t
1 change: 1 addition & 0 deletions src/driver/packages.mli
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type t = {
enable_warnings : bool;
other_docs : Fpath.t list;
pkg_dir : Fpath.t;
doc_dir : Fpath.t;
config : Global_config.t;
}

Expand Down
5 changes: 4 additions & 1 deletion src/driver/voodoo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ let process_package pkg =
|> List.flatten
in
let libraries = meta_libraries @ non_meta_libraries in
let pkg_dir = top_dir pkg in
let doc_dir = Fpath.(pkg_dir / "doc") in
let result =
{
Packages.name = pkg.name;
Expand All @@ -189,7 +191,8 @@ let process_package pkg =
assets;
enable_warnings = false;
other_docs;
pkg_dir = top_dir pkg;
pkg_dir;
doc_dir;
config;
}
in
Expand Down

0 comments on commit bff20e4

Please sign in to comment.