diff --git a/.travis-ci.sh b/.travis-ci.sh index e23d568a07b..aaee9010ddb 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -5,6 +5,8 @@ OPAMYES="true"; export OPAMYES OPAM_VERSION="2.0.3" +ODOC="odoc.1.4.0" + TARGET="$1"; shift case "$TARGET" in @@ -50,7 +52,7 @@ case "$TARGET" in opam init --disable-sandboxing eval $(opam config env) _boot/install/default/bin/dune runtest && \ - opam install ocamlfind utop ppxlib odoc menhir ocaml-migrate-parsetree js_of_ocaml-ppx js_of_ocaml-compiler + opam install ocamlfind utop ppxlib $ODOC menhir ocaml-migrate-parsetree js_of_ocaml-ppx js_of_ocaml-compiler opam remove dune jbuilder \ `opam list --depends-on jbuilder --installed --short` \ `opam list --depends-on dune --installed --short` @@ -89,7 +91,7 @@ case "$TARGET" in ./_boot/install/default/bin/dune build @runtest-no-deps &> $RUNTEST_NO_DEPS opam list opam pin add dune . --no-action - opam install ocamlfind utop ppxlib odoc ocaml-migrate-parsetree js_of_ocaml-ppx js_of_ocaml-compiler + opam install ocamlfind utop ppxlib $ODOC ocaml-migrate-parsetree js_of_ocaml-ppx js_of_ocaml-compiler echo -en "travis_fold:end:opam.deps\r" fi echo -en "travis_fold:end:dune.boot\r" diff --git a/CHANGES.md b/CHANGES.md index ff924c8d51c..d3aea5f56cd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +1.8.2 (10/03/2019) +------------------ + +- Fix auto-generated `index.mld`. Use correct headings for the listing. (#1925, + @rgrinberg, @aantron) + 1.8.1 (08/03/2019) ------------------ diff --git a/src/odoc.ml b/src/odoc.ml index cecb37efcc2..668a82a350b 100644 --- a/src/odoc.ml +++ b/src/odoc.ml @@ -415,13 +415,15 @@ module Gen (S : sig val sctx : SC.t end) = struct )) |> Lib.Map.of_list_exn - let default_index entry_modules = + let default_index ~(pkg : Package.t) entry_modules = let b = Buffer.create 512 in + Printf.bprintf b "{0 %s index}\n" + (Package.Name.to_string pkg.name); Lib.Map.to_list entry_modules |> List.sort ~compare:(fun (x, _) (y, _) -> Lib_name.compare (Lib.name x) (Lib.name y)) |> List.iter ~f:(fun (lib, modules) -> - Printf.bprintf b "{2 Library %s}\n" (Lib_name.to_string (Lib.name lib)); + Printf.bprintf b "{1 Library %s}\n" (Lib_name.to_string (Lib.name lib)); Buffer.add_string b ( match modules with | [ x ] -> @@ -462,7 +464,7 @@ module Gen (S : sig val sctx : SC.t end) = struct else let entry_modules = entry_modules ~pkg in let gen_mld = Paths.gen_mld_dir pkg ++ "index.mld" in - add_rule (Build.write_file gen_mld (default_index entry_modules)); + add_rule (Build.write_file gen_mld (default_index ~pkg entry_modules)); String.Map.add mlds "index" gen_mld in let odocs = List.map (String.Map.values mlds) ~f:(fun mld -> compile_mld diff --git a/test/blackbox-tests/test-cases/github717-odoc-index/index.mld b/test/blackbox-tests/test-cases/github717-odoc-index/index.mld index cf74479e4ca..958c6fc90fa 100644 --- a/test/blackbox-tests/test-cases/github717-odoc-index/index.mld +++ b/test/blackbox-tests/test-cases/github717-odoc-index/index.mld @@ -1 +1 @@ -Test index. \ No newline at end of file +{0 Test index} \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/odoc/run.t b/test/blackbox-tests/test-cases/odoc/run.t index 42537a3200d..ef9a5a50a4d 100644 --- a/test/blackbox-tests/test-cases/odoc/run.t +++ b/test/blackbox-tests/test-cases/odoc/run.t @@ -43,14 +43,16 @@ $ dune build @foo-mld --display short - {2 Library foo} + {0 foo index} + {1 Library foo} This library exposes the following toplevel modules: {!modules:Foo Foo2} - {2 Library foo.byte} + {1 Library foo.byte} The entry point of this library is the module: {!module-Foo_byte}. $ dune build @bar-mld --display short - {2 Library bar} + {0 bar index} + {1 Library bar} The entry point of this library is the module: {!module-Bar}.