2017-05-28 01:46:07 +00:00
|
|
|
(* -*- tuareg -*- *)
|
|
|
|
|
|
|
|
#warnings "-40";;
|
|
|
|
|
2018-05-02 11:56:12 +00:00
|
|
|
open Dune;;
|
2017-05-28 01:46:07 +00:00
|
|
|
open Import;;
|
|
|
|
open Action.Infer.Outcome;;
|
2018-06-02 11:14:44 +00:00
|
|
|
Stdune.Path.set_build_dir (Path.Kind.of_string "_build");;
|
2017-05-28 01:46:07 +00:00
|
|
|
|
|
|
|
let p = Path.of_string;;
|
2017-05-31 09:25:19 +00:00
|
|
|
let infer (a : Action.t) =
|
2017-05-28 01:46:07 +00:00
|
|
|
let x = Action.Infer.infer a in
|
2018-02-25 16:35:25 +00:00
|
|
|
(List.map (Path.Set.to_list x.deps) ~f:Path.to_string,
|
|
|
|
List.map (Path.Set.to_list x.targets) ~f:Path.to_string)
|
2017-05-28 01:46:07 +00:00
|
|
|
[%%expect{|
|
2018-06-02 11:14:44 +00:00
|
|
|
- : unit = ()
|
2018-06-20 18:42:53 +00:00
|
|
|
val p : ?error_loc:Usexp.Loc.t -> string -> Path.t = <fun>
|
|
|
|
val infer : Action.t -> string list * string list = <fun>
|
2017-05-28 01:46:07 +00:00
|
|
|
|}]
|
|
|
|
|
|
|
|
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"])
|
|
|
|
|}]
|
|
|
|
|
2017-05-31 09:20:33 +00:00
|
|
|
(* 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. *)
|
2017-05-28 01:46:07 +00:00
|
|
|
infer (Progn
|
|
|
|
[ Copy (p "a", p "b")
|
|
|
|
; Rename (p "b", p "c")
|
|
|
|
]);;
|
|
|
|
[%%expect{|
|
2017-05-31 09:20:33 +00:00
|
|
|
- : string list * string list = (["a"], ["b"; "c"])
|
2017-05-28 01:46:07 +00:00
|
|
|
|}]
|