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

Rework odoc rules #5045

Merged
merged 3 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
361 changes: 234 additions & 127 deletions src/dune_rules/odoc.ml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ This test checks that there is no clash when two private libraries have the same
ocamlc b/.test.objs/byte/test.{cmi,cmo,cmt}
odoc a/.test.objs/byte/test.odoc
odoc b/.test.objs/byte/test.odoc
odoc _doc/_odocls/test@6aabb9861046/test.odocl
odoc _doc/_odocls/test@ea8c79305c05/test.odocl
odoc _doc/_html/test@6aabb9861046/Test/.dummy,_doc/_html/test@6aabb9861046/Test/index.html
odoc _doc/_html/test@ea8c79305c05/Test/.dummy,_doc/_html/test@ea8c79305c05/Test/index.html
10 changes: 10 additions & 0 deletions test/blackbox-tests/test-cases/odoc/odoc-simple.t/run.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
This test generates documentation using odoc for a library:

$ dune build @doc

This test if `.odocl` files are generated
$ find _build/default/_doc/_odocls -name '*.odocl' | sort -n
_build/default/_doc/_odocls/bar/bar.odocl
_build/default/_doc/_odocls/bar/page-index.odocl
_build/default/_doc/_odocls/foo/foo.odocl
_build/default/_doc/_odocls/foo/foo2.odocl
_build/default/_doc/_odocls/foo/foo_byte.odocl
_build/default/_doc/_odocls/foo/page-index.odocl

$ dune runtest
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
Expand Down
7 changes: 7 additions & 0 deletions test/blackbox-tests/test-cases/odoc/odoc-unique-mlds.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Duplicate mld's in the same scope
ocamlc lib2/.root_lib2.objs/byte/root_lib2.{cmi,cmo,cmt}
odoc lib1/.root_lib1.objs/byte/root_lib1.odoc
odoc lib2/.root_lib2.objs/byte/root_lib2.odoc
odoc _doc/_odocls/root/root_lib1.odocl
odoc _doc/_odocls/root/root_lib2.odocl
odoc _doc/_odocls/root/page-index.odocl
odoc _doc/_html/root/Root_lib1/.dummy,_doc/_html/root/Root_lib1/index.html
odoc _doc/_html/root/Root_lib2/.dummy,_doc/_html/root/Root_lib2/index.html
odoc _doc/_html/root/index.html
Expand All @@ -22,6 +25,10 @@ Duplicate mld's in different scope
ocamlc scope2/.scope2.objs/byte/scope2.{cmi,cmo,cmt}
odoc scope1/.scope1.objs/byte/scope1.odoc
odoc scope2/.scope2.objs/byte/scope2.odoc
odoc _doc/_odocls/scope1/scope1.odocl
odoc _doc/_odocls/scope1/page-index.odocl
odoc _doc/_odocls/scope2/scope2.odocl
odoc _doc/_odocls/scope2/page-index.odocl
odoc _doc/_html/scope1/Scope1/.dummy,_doc/_html/scope1/Scope1/index.html
odoc _doc/_html/scope1/index.html
odoc _doc/_html/scope2/Scope2/.dummy,_doc/_html/scope2/Scope2/index.html
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions test/blackbox-tests/test-cases/odoc/odoc-wrapped-lib.t/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(library
(public_name foo))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 1.10)
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions test/blackbox-tests/test-cases/odoc/odoc-wrapped-lib.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This test generates documentation for non-hidden modules only for a library:

$ dune build @doc

Hidden modules should be compiled
$ find _build/default -name '*.odoc' | sort -n
_build/default/.foo.objs/byte/foo.odoc
_build/default/.foo.objs/byte/foo__.odoc
_build/default/.foo.objs/byte/foo__Bar.odoc
_build/default/_doc/_odoc/pkg/foo/page-index.odoc

Hidden modules should not be linked
$ find _build/default -name '*.odocl' | sort -n
_build/default/_doc/_odocls/foo/foo.odocl
_build/default/_doc/_odocls/foo/page-index.odocl

We don't expect html for hidden modules
$ find _build/default -name '*.html' | sort -n
_build/default/_doc/_html/foo/Foo/index.html
_build/default/_doc/_html/foo/index.html
_build/default/_doc/_html/index.html