Skip to content

Commit

Permalink
Driver: Put voodoo output under a doc directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jonludlam committed Dec 14, 2024
1 parent cc04b12 commit 9d16976
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/driver/dune_style.ml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ let of_dune_build dir =
selected = false;
remaps = [];
pkg_dir;
doc_dir = pkg_dir;
other_docs = [];
config = Global_config.empty;
} )
Expand Down
7 changes: 4 additions & 3 deletions src/driver/odoc_unit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,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 src_dir pkg = Fpath.(pkg.Packages.pkg_dir / "src")
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 = Fpath.(doc_dir pkg / "src")
let src_lib_dir pkg lib = Fpath.(src_dir pkg / lib.Packages.lib_name)

type dirs = {
Expand Down
3 changes: 2 additions & 1 deletion src/driver/odoc_unit.mli
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ 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_lib_dir : Packages.t -> Packages.libty -> Fpath.t
val src_dir : Packages.t -> Fpath.t
val src_lib_dir : Packages.t -> Packages.libty -> Fpath.t

type dirs = {
odoc_dir : Fpath.t;
Expand Down
4 changes: 2 additions & 2 deletions src/driver/odoc_units_of.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ let packages ~dirs ~extra_paths ~remap ~gen_indices (pkgs : Packages.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 @@ -225,7 +225,7 @@ let packages ~dirs ~extra_paths ~remap ~gen_indices (pkgs : Packages.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
3 changes: 3 additions & 0 deletions src/driver/packages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type t = {
remaps : (string * string) list;
other_docs : Fpath.t list;
pkg_dir : Fpath.t;
doc_dir : Fpath.t;
config : Global_config.t;
}

Expand Down Expand Up @@ -407,6 +408,7 @@ let of_libs ~packages_dir libs =
remaps = [];
other_docs = [];
pkg_dir;
doc_dir = pkg_dir;
config;
})
acc)
Expand Down Expand Up @@ -490,6 +492,7 @@ let of_packages ~packages_dir packages =
remaps;
other_docs = [];
pkg_dir;
doc_dir = pkg_dir;
config;
}
acc)
Expand Down
1 change: 1 addition & 0 deletions src/driver/packages.mli
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type t = {
remaps : (string * string) list;
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 @@ -179,6 +179,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 =
selected = true;
remaps = [];
other_docs;
pkg_dir = top_dir pkg;
pkg_dir;
doc_dir;
config;
}
in
Expand Down

0 comments on commit 9d16976

Please sign in to comment.