Make targets_dir argument of SC.Action.run non-optional

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-07-12 12:09:34 +01:00 committed by Jérémie Dimino
parent c0a6438fcc
commit 3effc2fbdf
5 changed files with 10 additions and 20 deletions

View File

@ -197,6 +197,7 @@ module Gen(P : Install_rules.Params) = struct
~bindings:(Pform.Map.of_bindings rule.deps) ~bindings:(Pform.Map.of_bindings rule.deps)
~dep_kind:Required ~dep_kind:Required
~targets ~targets
~targets_dir:dir
~scope) ~scope)
let copy_files_rules (def: Copy_files.t) ~src_dir ~dir ~scope = let copy_files_rules (def: Copy_files.t) ~src_dir ~dir ~scope =
@ -955,6 +956,7 @@ module Gen(P : Install_rules.Params) = struct
~dep_kind:Required ~dep_kind:Required
~bindings:(Pform.Map.of_bindings alias_conf.deps) ~bindings:(Pform.Map.of_bindings alias_conf.deps)
~targets:Alias ~targets:Alias
~targets_dir:dir
~scope) ~scope)
let tests_rules (t : Tests.t) ~dir ~scope ~all_modules ~modules_partitioner let tests_rules (t : Tests.t) ~dir ~scope ~all_modules ~modules_partitioner

View File

@ -220,7 +220,11 @@ include Sub_system.Register_end_point(
Option.map backend.info.generate_runner ~f:(fun (loc, action) -> Option.map backend.info.generate_runner ~f:(fun (loc, action) ->
SC.Action.run sctx action ~loc SC.Action.run sctx action ~loc
~bindings ~bindings
~dir ~dep_kind:Required ~targets:Alias ~scope))) ~dir
~dep_kind:Required
~targets:Alias
~targets_dir:dir
~scope)))
>>^ (fun actions -> >>^ (fun actions ->
Action.with_stdout_to target Action.with_stdout_to target
(Action.progn actions)) (Action.progn actions))

View File

@ -470,6 +470,7 @@ let lint_module sctx ~dir ~dep_kind ~lint ~lib_name ~scope ~dir_kind =
~dep_kind ~dep_kind
~bindings ~bindings
~targets:(Static []) ~targets:(Static [])
~targets_dir:dir
~scope))) ~scope)))
| Pps { loc; pps; flags } -> | Pps { loc; pps; flags } ->
let args : _ Arg_spec.t = let args : _ Arg_spec.t =

View File

@ -773,7 +773,7 @@ module Action = struct
["var", String_with_vars.Var.sexp_of_t pform])) ["var", String_with_vars.Var.sexp_of_t pform]))
let run sctx ~loc ~bindings ~dir ~dep_kind let run sctx ~loc ~bindings ~dir ~dep_kind
~targets:targets_written_by_user ~scope ?(targets_dir=dir) t ~targets:targets_written_by_user ~targets_dir ~scope t
: (Path.t Bindings.t, Action.t) Build.t = : (Path.t Bindings.t, Action.t) Build.t =
let bindings = Pform.Map.superpose sctx.pforms bindings in let bindings = Pform.Map.superpose sctx.pforms bindings in
let map_exe = map_exe sctx in let map_exe = map_exe sctx in
@ -798,23 +798,6 @@ module Action = struct
let { Action.Infer.Outcome. deps; targets } = let { Action.Infer.Outcome. deps; targets } =
Action.Infer.partial t ~all_targets:false Action.Infer.partial t ~all_targets:false
in in
(* CR-someday jdimino: should this be an error or not?
It's likely that what we get here is what the user thinks
of as temporary files, even though they might conflict with
actual targets. We need to tell dune about such things,
so that it can report better errors.
{[
let missing = Path.Set.diff targets targets_written_by_user in
if not (Path.Set.is_empty missing) then
Loc.warn (Loc.in_file (Utils.jbuild_name_in ~dir))
"Missing targets in user action:\n%s"
(List.map (Path.Set.elements missing) ~f:(fun target ->
sprintf "- %s" (Utils.describe_target target))
|> String.concat ~sep:"\n");
]}
*)
{ deps; targets = Path.Set.union targets targets_written_by_user } { deps; targets = Path.Set.union targets targets_written_by_user }
| Alias -> | Alias ->
let { Action.Infer.Outcome. deps; targets = _ } = let { Action.Infer.Outcome. deps; targets = _ } =

View File

@ -243,8 +243,8 @@ module Action : sig
-> dir:Path.t -> dir:Path.t
-> dep_kind:Build.lib_dep_kind -> dep_kind:Build.lib_dep_kind
-> targets:targets -> targets:targets
-> targets_dir:Path.t
-> scope:Scope.t -> scope:Scope.t
-> ?targets_dir:Path.t (* default: dir *)
-> Action.Unexpanded.t -> Action.Unexpanded.t
-> (Path.t Bindings.t, Action.t) Build.t -> (Path.t Bindings.t, Action.t) Build.t
end end