Merge pull request #521 from rgrinberg/build-only-public-docs
Change @doc to only build public docs
This commit is contained in:
commit
a6e6136f3a
|
@ -1,4 +1,4 @@
|
||||||
1.0+beta18 (14/02/2018)
|
1.0+beta18 (next)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
- Let the parser distinguish quoted strings from atoms. This makes
|
- Let the parser distinguish quoted strings from atoms. This makes
|
||||||
|
@ -38,6 +38,10 @@
|
||||||
- Fix a regression in `external-lib-deps` introduced in 1.0+beta17
|
- Fix a regression in `external-lib-deps` introduced in 1.0+beta17
|
||||||
(#512, fixes #485)
|
(#512, fixes #485)
|
||||||
|
|
||||||
|
- `@doc` alias will now build only documentation for public libraries. A new
|
||||||
|
`@doc-private` alias has been added to build documentation for private
|
||||||
|
libraries.
|
||||||
|
|
||||||
1.0+beta17 (01/02/2018)
|
1.0+beta17 (01/02/2018)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ module Alias0 = struct
|
||||||
let dep t = Build.path (stamp_file t)
|
let dep t = Build.path (stamp_file t)
|
||||||
|
|
||||||
let is_standard = function
|
let is_standard = function
|
||||||
| "runtest" | "install" | "doc" | "lint" -> true
|
| "runtest" | "install" | "doc" | "doc-private" | "lint" -> true
|
||||||
| _ -> false
|
| _ -> false
|
||||||
|
|
||||||
open Build.O
|
open Build.O
|
||||||
|
@ -272,11 +272,12 @@ module Alias0 = struct
|
||||||
It is not defined in %s or any of its descendants."
|
It is not defined in %s or any of its descendants."
|
||||||
name (Path.to_string_maybe_quoted src_dir)
|
name (Path.to_string_maybe_quoted src_dir)
|
||||||
|
|
||||||
let default = make "DEFAULT"
|
let default = make "DEFAULT"
|
||||||
let runtest = make "runtest"
|
let runtest = make "runtest"
|
||||||
let install = make "install"
|
let install = make "install"
|
||||||
let doc = make "doc"
|
let doc = make "doc"
|
||||||
let lint = make "lint"
|
let private_doc = make "doc-private"
|
||||||
|
let lint = make "lint"
|
||||||
end
|
end
|
||||||
|
|
||||||
module Dir_status = struct
|
module Dir_status = struct
|
||||||
|
|
|
@ -100,11 +100,12 @@ module Alias : sig
|
||||||
|
|
||||||
val fully_qualified_name : t -> Path.t
|
val fully_qualified_name : t -> Path.t
|
||||||
|
|
||||||
val default : dir:Path.t -> t
|
val default : dir:Path.t -> t
|
||||||
val runtest : dir:Path.t -> t
|
val runtest : dir:Path.t -> t
|
||||||
val install : dir:Path.t -> t
|
val install : dir:Path.t -> t
|
||||||
val doc : dir:Path.t -> t
|
val doc : dir:Path.t -> t
|
||||||
val lint : dir:Path.t -> t
|
val private_doc : dir:Path.t -> t
|
||||||
|
val lint : dir:Path.t -> t
|
||||||
|
|
||||||
(** Return the underlying stamp file *)
|
(** Return the underlying stamp file *)
|
||||||
val stamp_file : t -> Path.t
|
val stamp_file : t -> Path.t
|
||||||
|
|
16
src/odoc.ml
16
src/odoc.ml
|
@ -200,7 +200,11 @@ let setup_library_rules sctx (lib : Library.t) ~dir ~modules ~mld_files
|
||||||
to_html sctx m odoc_file ~doc_dir ~odoc ~dir ~includes ~lib)
|
to_html sctx m odoc_file ~doc_dir ~odoc ~dir ~includes ~lib)
|
||||||
in
|
in
|
||||||
let doc_root = SC.Doc.root sctx in
|
let doc_root = SC.Doc.root sctx in
|
||||||
SC.add_alias_deps sctx (Build_system.Alias.doc ~dir)
|
let alias =
|
||||||
|
match lib.public with
|
||||||
|
| None -> Build_system.Alias.private_doc ~dir
|
||||||
|
| Some _ -> Build_system.Alias.doc ~dir in
|
||||||
|
SC.add_alias_deps sctx alias
|
||||||
(css_file ~doc_dir:doc_root
|
(css_file ~doc_dir:doc_root
|
||||||
:: toplevel_index ~doc_dir:doc_root
|
:: toplevel_index ~doc_dir:doc_root
|
||||||
:: html_files)
|
:: html_files)
|
||||||
|
@ -268,15 +272,17 @@ let gen_rules sctx ~dir:_ rest =
|
||||||
setup_toplevel_index_rule sctx
|
setup_toplevel_index_rule sctx
|
||||||
| lib :: _ ->
|
| lib :: _ ->
|
||||||
let libs = SC.libs sctx in
|
let libs = SC.libs sctx in
|
||||||
let (lib, scope) =
|
let (lib, scope, alias) =
|
||||||
match String.rsplit2 lib ~on:'@' with
|
match String.rsplit2 lib ~on:'@' with
|
||||||
| None -> (lib, Lib_db.external_scope libs)
|
| None ->
|
||||||
| Some (lib, name) -> (lib, Lib_db.find_scope_by_name_exn libs ~name)
|
(lib, Lib_db.external_scope libs, "doc")
|
||||||
|
| Some (lib, name) ->
|
||||||
|
(lib, Lib_db.find_scope_by_name_exn libs ~name, "doc-private")
|
||||||
in
|
in
|
||||||
let scope =
|
let scope =
|
||||||
{ With_required_by.
|
{ With_required_by.
|
||||||
data = scope
|
data = scope
|
||||||
; required_by = [Alias (Path.of_string "doc")]
|
; required_by = [Alias (Path.of_string alias)]
|
||||||
} in
|
} in
|
||||||
let open Option.Infix in
|
let open Option.Infix in
|
||||||
Option.iter (Lib_db.Scope.find scope lib >>= Lib.src_dir)
|
Option.iter (Lib_db.Scope.find scope lib >>= Lib.src_dir)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
This test checks that there is no clash when two private libraries have the same name
|
This test checks that there is no clash when two private libraries have the same name
|
||||||
|
|
||||||
$ $JBUILDER build -j1 --display short --root . @doc
|
$ $JBUILDER build -j1 --display short --root . @doc-private
|
||||||
odoc _doc/odoc.css
|
odoc _doc/odoc.css
|
||||||
odoc _doc/test@a/page-index.odoc
|
odoc _doc/test@a/page-index.odoc
|
||||||
ocamldep a/test.ml.d
|
ocamldep a/test.ml.d
|
||||||
|
|
Loading…
Reference in New Issue