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 28, 2024
1 parent 48b2f54 commit 2a180de
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 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
7 changes: 4 additions & 3 deletions src/driver/odoc_unit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +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 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 @@ -52,10 +52,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 @@ -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 @@ -216,7 +216,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 2a180de

Please sign in to comment.