From 84307941918ccbf759ed2e0340ff13ac083a6195 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 2 Apr 2019 20:41:39 +0700 Subject: [PATCH 1/2] Add private modules to test of module listing Signed-off-by: Rudi Grinberg --- test/blackbox-tests/test-cases/odoc/dune | 3 ++- test/blackbox-tests/test-cases/odoc/dune-project | 2 +- test/blackbox-tests/test-cases/odoc/foo3.ml | 0 test/blackbox-tests/test-cases/odoc/run.t | 5 ++++- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 test/blackbox-tests/test-cases/odoc/foo3.ml diff --git a/test/blackbox-tests/test-cases/odoc/dune b/test/blackbox-tests/test-cases/odoc/dune index d066ba321d1..27ceaef7b10 100644 --- a/test/blackbox-tests/test-cases/odoc/dune +++ b/test/blackbox-tests/test-cases/odoc/dune @@ -1,7 +1,8 @@ (library (name foo) - (modules foo foo2) + (modules foo foo2 foo3) (wrapped false) + (private_modules foo3) (public_name foo)) (library diff --git a/test/blackbox-tests/test-cases/odoc/dune-project b/test/blackbox-tests/test-cases/odoc/dune-project index de4fc209200..f75713fb8c4 100644 --- a/test/blackbox-tests/test-cases/odoc/dune-project +++ b/test/blackbox-tests/test-cases/odoc/dune-project @@ -1 +1 @@ -(lang dune 1.0) +(lang dune 1.2) diff --git a/test/blackbox-tests/test-cases/odoc/foo3.ml b/test/blackbox-tests/test-cases/odoc/foo3.ml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/blackbox-tests/test-cases/odoc/run.t b/test/blackbox-tests/test-cases/odoc/run.t index b40ff790c82..7dc0a9b36d8 100644 --- a/test/blackbox-tests/test-cases/odoc/run.t +++ b/test/blackbox-tests/test-cases/odoc/run.t @@ -12,6 +12,9 @@ ocamldep .foo.objs/foo2.ml.d ocamlc .foo.objs/byte/foo2.{cmi,cmo,cmt} odoc _doc/_odoc/lib/foo/foo2.odoc + ocamldep .foo.objs/foo3.ml.d + ocamlc .foo.objs/byte/foo3.{cmi,cmo,cmt} + odoc _doc/_odoc/lib/foo/private/foo3.odoc ocamldep .foo_byte.objs/foo_byte.ml.d ocamlc .foo_byte.objs/byte/foo_byte.{cmi,cmo,cmt} odoc _doc/_odoc/lib/foo.byte/foo_byte.odoc @@ -46,7 +49,7 @@ {0 foo index} {1 Library foo} This library exposes the following toplevel modules: - {!modules:Foo Foo2} + {!modules:Foo Foo2 Foo3} {1 Library foo.byte} The entry point of this library is the module: {!module-Foo_byte}. From b3ec401ba33308f42f01316eb3bdfece9e1012ff Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 2 Apr 2019 20:34:40 +0700 Subject: [PATCH 2/2] List only public modules in generated index Fix #2008 Signed-off-by: Rudi Grinberg --- CHANGES.md | 5 ++++- src/odoc.ml | 1 + test/blackbox-tests/test-cases/odoc/run.t | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f58c6dde7d8..6d08ae43f4f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,10 +21,13 @@ unreleased - Install .cmi files of private modules in a `.private` directory (#1983, fix #1973 @rgrinberg) - + - Fix dune subst attempting to sunbstitute on directories. (#2000, fix #1997, @rgrinberg) +- Do not list private modules in the generated index. (#2009, fix #2008, + @rgrinberg) + 1.8.2 (10/03/2019) ------------------ diff --git a/src/odoc.ml b/src/odoc.ml index 20955643385..a92beebc801 100644 --- a/src/odoc.ml +++ b/src/odoc.ml @@ -473,6 +473,7 @@ let default_index ~pkg entry_modules = "This library exposes the following toplevel modules:\n\ {!modules:%s}\n" (modules + |> List.filter ~f:Module.is_public |> List.sort ~compare:(fun x y -> Module.Name.compare (Module.name x) (Module.name y)) |> List.map ~f:(fun m -> Module.Name.to_string (Module.name m)) diff --git a/test/blackbox-tests/test-cases/odoc/run.t b/test/blackbox-tests/test-cases/odoc/run.t index 7dc0a9b36d8..847ed37fa0a 100644 --- a/test/blackbox-tests/test-cases/odoc/run.t +++ b/test/blackbox-tests/test-cases/odoc/run.t @@ -49,7 +49,7 @@ {0 foo index} {1 Library foo} This library exposes the following toplevel modules: - {!modules:Foo Foo2 Foo3} + {!modules:Foo Foo2} {1 Library foo.byte} The entry point of this library is the module: {!module-Foo_byte}.