44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
(* -*- tuareg -*- *)
|
|
|
|
#warnings "-40";;
|
|
|
|
open Dune;;
|
|
open Import;;
|
|
open Action.Infer.Outcome;;
|
|
Stdune.Path.set_build_dir (Path.Kind.of_string "_build");;
|
|
|
|
let p = Path.of_string;;
|
|
let infer (a : Action.t) =
|
|
let x = Action.Infer.infer a in
|
|
(List.map (Path.Set.to_list x.deps) ~f:Path.to_string,
|
|
List.map (Path.Set.to_list x.targets) ~f:Path.to_string)
|
|
[%%expect{|
|
|
- : unit = ()
|
|
val p : ?error_loc:Usexp.Loc.t -> string -> Path.t = <fun>
|
|
val infer : Action.t -> string list * string list = <fun>
|
|
|}]
|
|
|
|
infer (Copy (p "a", p "b"));;
|
|
[%%expect{|
|
|
- : string list * string list = (["a"], ["b"])
|
|
|}]
|
|
|
|
infer (Progn
|
|
[ Copy (p "a", p "b")
|
|
; Copy (p "b", p "c")
|
|
]);;
|
|
[%%expect{|
|
|
- : string list * string list = (["a"], ["b"; "c"])
|
|
|}]
|
|
|
|
(* CR-someday jdimino: ideally "b" should be treated as a non-buildable targets. As long
|
|
as [rename] is not available in the DSL given to user, we don't need to care about this
|
|
too much. *)
|
|
infer (Progn
|
|
[ Copy (p "a", p "b")
|
|
; Rename (p "b", p "c")
|
|
]);;
|
|
[%%expect{|
|
|
- : string list * string list = (["a"], ["b"; "c"])
|
|
|}]
|