Add documentation stanza

This commit is contained in:
Rudi Grinberg 2018-03-01 13:03:06 +07:00
parent 8f967dbca5
commit 0a57a02819
3 changed files with 30 additions and 1 deletions

View File

@ -246,7 +246,7 @@ module Gen(P : Install_rules.Params) = struct
match (dep : Jbuild.Lib_dep.t) with
| Direct _ -> None
| Select s -> Some s.result_fn)
| Alias _ | Provides _ | Install _ -> [])
| Documentation _ | Alias _ | Provides _ | Install _ -> [])
|> String_set.of_list
in
String_set.union generated_files

View File

@ -1160,6 +1160,24 @@ module Copy_files = struct
let v1 = String_with_vars.t
end
module Documentation = struct
type t =
{ package: Package.t
; mld_files: Ordered_set_lang.t
}
let v1 pkgs =
record
(Scope_info.package_field pkgs >>= fun package ->
field "mld_files" Ordered_set_lang.t ~default:Ordered_set_lang.standard
>>= fun mld_files ->
return
{ package
; mld_files
}
)
end
module Stanza = struct
type t =
| Library of Library.t
@ -1170,6 +1188,7 @@ module Stanza = struct
| Alias of Alias_conf.t
| Copy_files of Copy_files.t
| Menhir of Menhir.t
| Documentation of Documentation.t
end
module Stanzas = struct
@ -1219,6 +1238,8 @@ module Stanzas = struct
raise (Include_loop (file, include_stack));
let sexps = Sexp.load ~fname:(Path.to_string file) ~mode:Many in
parse pkgs sexps ~default_version:Jbuild_version.V1 ~file ~include_stack)
; cstr "documentation" (Documentation.v1 pkgs @> nil)
(fun d -> [Documentation d])
]
and select

View File

@ -358,6 +358,13 @@ module Copy_files : sig
}
end
module Documentation : sig
type t =
{ package : Package.t
; mld_files : Ordered_set_lang.t
}
end
module Stanza : sig
type t =
| Library of Library.t
@ -368,6 +375,7 @@ module Stanza : sig
| Alias of Alias_conf.t
| Copy_files of Copy_files.t
| Menhir of Menhir.t
| Documentation of Documentation.t
end
module Stanzas : sig