Skip to content

Commit 4c83d4e

Browse files
committed
Link with the markdown path
1 parent c4b6839 commit 4c83d4e

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/dune_rules/odoc.ml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,11 @@ let odoc_include_flags ctx pkg requires =
417417
let link_odoc_rules sctx (odoc_file : odoc_artefact) ~pkg ~requires =
418418
let ctx = Super_context.context sctx in
419419
let deps = Dep.deps ctx pkg requires in
420+
let dir = Path.build (Path.Build.parent_exn odoc_file.odocl_file) in
420421
let run_odoc =
421422
run_odoc
422423
sctx
423-
~dir:(Path.build (Paths.html_root ctx))
424+
~dir
424425
"link"
425426
~quiet:false
426427
~flags_for:(Some odoc_file.odoc_file)
@@ -896,7 +897,7 @@ let add_format_alias_deps ctx format target odocs =
896897
(Action_builder.paths paths)
897898
;;
898899

899-
let setup_lib_markdown_rules_def =
900+
let setup_lib_html_rules_def =
900901
let module Input = struct
901902
module Super_context = Super_context.As_memo_key
902903

@@ -911,16 +912,17 @@ let setup_lib_markdown_rules_def =
911912
let ctx = Super_context.context sctx in
912913
let target = Lib lib in
913914
let* odocs = odoc_artefacts sctx target in
914-
add_format_alias_deps ctx Markdown target odocs;
915+
let* () = add_format_alias_deps ctx Html target odocs in
916+
add_format_alias_deps ctx Json target odocs
915917
in
916918
Memo.With_implicit_output.create
917-
"setup-library-markdown-rules"
919+
"setup-library-html-rules"
918920
~implicit_output:Rules.implicit_output
919921
~input:(module Input)
920922
f
921923
;;
922924

923-
let setup_lib_html_rules_def =
925+
let setup_lib_markdown_rules_def =
924926
let module Input = struct
925927
module Super_context = Super_context.As_memo_key
926928

@@ -935,11 +937,10 @@ let setup_lib_html_rules_def =
935937
let ctx = Super_context.context sctx in
936938
let target = Lib lib in
937939
let* odocs = odoc_artefacts sctx target in
938-
let* () = add_format_alias_deps ctx Html target odocs in
939-
add_format_alias_deps ctx Json target odocs
940+
add_format_alias_deps ctx Markdown target odocs
940941
in
941942
Memo.With_implicit_output.create
942-
"setup-library-html-rules"
943+
"setup-library-markdown-rules"
943944
~implicit_output:Rules.implicit_output
944945
~input:(module Input)
945946
f
@@ -993,11 +994,9 @@ let setup_pkg_html_rules sctx ~pkg : unit Memo.t =
993994
;;
994995

995996
let setup_lib_markdown_rules sctx lib =
996-
let ctx = Super_context.context sctx in
997997
let target = Lib lib in
998998
let* odocs = odoc_artefacts sctx target in
999999
let* () = Memo.parallel_iter odocs ~f:(fun odoc -> setup_generate_markdown sctx odoc) in
1000-
let* () = add_format_alias_deps ctx Markdown target odocs in
10011000
Memo.With_implicit_output.exec setup_lib_markdown_rules_def (sctx, lib)
10021001
;;
10031002

@@ -1174,11 +1173,10 @@ let gen_rules sctx ~dir rest =
11741173
>>> setup_toplevel_index_rule sctx Json)
11751174
| [ "_markdown" ] -> has_rules (setup_toplevel_index_rule sctx Markdown)
11761175
| [ "_markdown"; lib_unique_name_or_pkg ] ->
1177-
let ctx = Super_context.context sctx in
1178-
let directory_targets = Path.Build.Map.singleton dir Loc.none in
11791176
has_rules
1180-
~directory_targets
1181-
(let* lib, lib_db = Scope_key.of_string (Context.name ctx) lib_unique_name_or_pkg in
1177+
(
1178+
let ctx = Super_context.context sctx in
1179+
let* lib, lib_db = Scope_key.of_string (Context.name ctx) lib_unique_name_or_pkg in
11821180
let* lib =
11831181
let+ lib = Lib.DB.find lib_db lib in
11841182
Option.bind ~f:Lib.Local.of_lib lib

0 commit comments

Comments
 (0)