Allow libraries in a package to reference each other in odocs
This allows for circular dependencies for libraries in the same package Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
c842c76036
commit
724acc8c7c
15
src/odoc.ml
15
src/odoc.ml
|
@ -353,21 +353,24 @@ module Gen (S : sig val sctx : SC.t end) = struct
|
||||||
| Ok lib -> SC.load_dir sctx ~dir:(Lib.src_dir lib)
|
| Ok lib -> SC.load_dir sctx ~dir:(Lib.src_dir lib)
|
||||||
end
|
end
|
||||||
| "_html" :: lib_unique_name_or_pkg :: _ ->
|
| "_html" :: lib_unique_name_or_pkg :: _ ->
|
||||||
let setup_html_rules pkg =
|
|
||||||
setup_pkg_html_rules ~pkg ~libs:(
|
|
||||||
Lib.Set.to_list (load_all_odoc_rules_pkg ~pkg)
|
|
||||||
) in
|
|
||||||
(* TODO we can be a better with the error handling in the case where
|
(* TODO we can be a better with the error handling in the case where
|
||||||
lib_unique_name_or_pkg is neither a valid pkg or lnu *)
|
lib_unique_name_or_pkg is neither a valid pkg or lnu *)
|
||||||
let lib, lib_db = SC.Scope_key.of_string sctx lib_unique_name_or_pkg in
|
let lib, lib_db = SC.Scope_key.of_string sctx lib_unique_name_or_pkg in
|
||||||
|
let setup_pkg_html_rules pkg =
|
||||||
|
setup_pkg_html_rules ~pkg ~libs:(
|
||||||
|
Lib.Set.to_list (load_all_odoc_rules_pkg ~pkg)) in
|
||||||
begin match Lib.DB.find lib_db lib with
|
begin match Lib.DB.find lib_db lib with
|
||||||
| Error _ -> ()
|
| Error _ -> ()
|
||||||
| Ok lib -> setup_lib_html_rules lib ~requires:(Lib.closure [lib])
|
| Ok lib ->
|
||||||
|
begin match Lib.package lib with
|
||||||
|
| None -> setup_lib_html_rules lib ~requires:(Lib.closure [lib])
|
||||||
|
| Some pkg -> setup_pkg_html_rules pkg
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
Option.iter
|
Option.iter
|
||||||
(Package.Name.Map.find (SC.packages sctx)
|
(Package.Name.Map.find (SC.packages sctx)
|
||||||
(Package.Name.of_string lib_unique_name_or_pkg))
|
(Package.Name.of_string lib_unique_name_or_pkg))
|
||||||
~f:(fun pkg -> setup_html_rules pkg.name)
|
~f:(fun pkg -> setup_pkg_html_rules pkg.name)
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
|
|
||||||
let setup_package_aliases (pkg : Package.t) =
|
let setup_package_aliases (pkg : Package.t) =
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
odoc _doc/_odoc/pkg/bar/page-index.odoc
|
odoc _doc/_odoc/pkg/bar/page-index.odoc
|
||||||
odoc _doc/_html/bar/index.html
|
odoc _doc/_html/bar/index.html
|
||||||
odoc _doc/_html/odoc.css
|
odoc _doc/_html/odoc.css
|
||||||
|
ocamldep foo_byte.ml.d
|
||||||
|
ocamlc .foo_byte.objs/foo_byte.{cmi,cmo,cmt}
|
||||||
|
odoc _doc/_odoc/lib/foo.byte/foo_byte.odoc
|
||||||
ocamldep foo.ml.d
|
ocamldep foo.ml.d
|
||||||
ocamlc .foo.objs/foo.{cmi,cmo,cmt}
|
ocamlc .foo.objs/foo.{cmi,cmo,cmt}
|
||||||
odoc _doc/_odoc/lib/foo/foo.odoc
|
odoc _doc/_odoc/lib/foo/foo.odoc
|
||||||
|
@ -13,12 +16,9 @@
|
||||||
ocamlc .foo.objs/foo2.{cmi,cmo,cmt}
|
ocamlc .foo.objs/foo2.{cmi,cmo,cmt}
|
||||||
odoc _doc/_odoc/lib/foo/foo2.odoc
|
odoc _doc/_odoc/lib/foo/foo2.odoc
|
||||||
odoc _doc/_html/foo/Foo/.jbuilder-keep,_doc/_html/foo/Foo/index.html
|
odoc _doc/_html/foo/Foo/.jbuilder-keep,_doc/_html/foo/Foo/index.html
|
||||||
ocamldep foo_byte.ml.d
|
|
||||||
ocamlc .foo_byte.objs/foo_byte.{cmi,cmo,cmt}
|
|
||||||
odoc _doc/_odoc/lib/foo.byte/foo_byte.odoc
|
|
||||||
odoc _doc/_html/foo/Foo_byte/.jbuilder-keep,_doc/_html/foo/Foo_byte/index.html
|
|
||||||
odoc _doc/_odoc/pkg/foo/page-index.odoc
|
odoc _doc/_odoc/pkg/foo/page-index.odoc
|
||||||
odoc _doc/_html/foo/index.html
|
odoc _doc/_html/foo/index.html
|
||||||
|
odoc _doc/_html/foo/Foo_byte/.jbuilder-keep,_doc/_html/foo/Foo_byte/index.html
|
||||||
odoc _doc/_html/foo/Foo2/.jbuilder-keep,_doc/_html/foo/Foo2/index.html
|
odoc _doc/_html/foo/Foo2/.jbuilder-keep,_doc/_html/foo/Foo2/index.html
|
||||||
$ dune runtest --display short
|
$ dune runtest --display short
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
Loading…
Reference in New Issue