Add the (package ..) dependency type

Add a (package <name>) dependency type which adds a dependency on all the
installable files of a package.
This commit is contained in:
Rudi Grinberg 2018-03-16 01:35:19 +08:00
parent 32eb2745aa
commit b187d6e4ba
6 changed files with 18 additions and 0 deletions

View File

@ -278,6 +278,10 @@ module Alias0 = struct
let doc = make "doc"
let private_doc = make "doc-private"
let lint = make "lint"
let package_install ~(context : Context.t) ~pkg =
make (sprintf "install-%s" (Package.Name.to_string pkg))
~dir:context.build_dir
end
module Dir_status = struct

View File

@ -107,6 +107,8 @@ module Alias : sig
val private_doc : dir:Path.t -> t
val lint : dir:Path.t -> t
val package_install : context:Context.t -> pkg:Package.Name.t -> t
(** Return the underlying stamp file *)
val stamp_file : t -> Path.t

View File

@ -206,6 +206,8 @@ module Gen(P : Install_params) = struct
Path.append install_dir (Install.Entry.relative_installed_path entry ~package)
in
SC.add_rule sctx (Build.symlink ~src:entry.src ~dst);
SC.add_alias_deps sctx
(Alias.package_install ~context:ctx ~pkg:package) [dst];
Install.Entry.set_src entry dst)
let promote_install_file =

View File

@ -230,6 +230,7 @@ module Dep_conf = struct
| Alias_rec of String_with_vars.t
| Glob_files of String_with_vars.t
| Files_recursively_in of String_with_vars.t
| Package of String_with_vars.t
| Universe
let t =
@ -243,6 +244,7 @@ module Dep_conf = struct
; cstr_sw "alias_rec" (fun x -> Alias_rec x)
; cstr_sw "glob_files" (fun x -> Glob_files x)
; cstr_sw "files_recursively_in" (fun x -> Files_recursively_in x)
; cstr_sw "package" (fun x -> Package x)
; cstr "universe" nil Universe
]
in
@ -266,6 +268,9 @@ module Dep_conf = struct
| Files_recursively_in t ->
List [Sexp.unsafe_atom_of_string "files_recursively_in" ;
String_with_vars.sexp_of_t t]
| Package t ->
List [Sexp.unsafe_atom_of_string "package" ;
String_with_vars.sexp_of_t t]
| Universe ->
Sexp.unsafe_atom_of_string "universe"
end

View File

@ -125,6 +125,7 @@ module Dep_conf : sig
| Alias_rec of String_with_vars.t
| Glob_files of String_with_vars.t
| Files_recursively_in of String_with_vars.t
| Package of String_with_vars.t
| Universe
val t : t Sexp.Of_sexp.t

View File

@ -351,6 +351,10 @@ module Deps = struct
let path = Path.relative dir (expand_vars t ~scope ~dir s) in
Build.files_recursively_in ~dir:path ~file_tree:t.file_tree
>>^ Pset.to_list
| Package p ->
let pkg = Package.Name.of_string (expand_vars t ~scope ~dir p) in
Alias.dep (Alias.package_install ~context:t.context ~pkg)
>>^ fun () -> []
| Universe ->
Build.path Build_system.universe_file
>>^ fun () -> []