Skip to content

Commit

Permalink
Fix locks in rules without targets (#3366)
Browse files Browse the repository at this point in the history
* Fix the bug where [locks] had no effect for rules with no targets

Signed-off-by: Arseniy Alekseyev <[email protected]>
  • Loading branch information
aalekseyev authored Apr 15, 2020
1 parent 61e3357 commit 9cb0cc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
- [coq] Fix install path for theory names with level greater than 1
(#3358 , @ejgallego)

- Fix a bug introduced in 2.0.0 where the [locks] field in rules with no targets had
no effect. (@aalekseyev, report by @craigfe)

2.5.0 (09/04/2020)
------------------

Expand Down
7 changes: 4 additions & 3 deletions src/dune/simple_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ module Alias_rules = struct
, Option.map ~f:Action_unexpanded.remove_locs action
, Option.map extra_bindings ~f:Pform.Map.to_stamp )

let add sctx ~alias ~stamp ~loc ?(locks = []) build =
let add sctx ~alias ~stamp ~loc ~locks build =
let dir = Alias.dir alias in
SC.add_alias_action sctx alias ~dir ~loc ~locks ~stamp build

let add_empty sctx ~loc ~alias ~stamp =
let action = Build.With_targets.return Action.empty in
add sctx ~loc ~alias ~stamp action
add sctx ~loc ~alias ~stamp action ~locks:[]
end

let interpret_locks ~expander = List.map ~f:(Expander.expand_path expander)
Expand Down Expand Up @@ -124,7 +124,8 @@ let user_rule sctx ?extra_bindings ~dir ~expander (rule : Rule.t) =
let action = Some (snd rule.action) in
Alias_rules.stamp ~deps:rule.deps ~extra_bindings ~action
in
Alias_rules.add sctx ~alias ~stamp ~loc:(Some rule.loc) action;
let locks = interpret_locks ~expander rule.locks in
Alias_rules.add sctx ~alias ~stamp ~loc:(Some rule.loc) action ~locks;
Path.Build.Set.empty )

let copy_files sctx ~dir ~expander ~src_dir (def : Copy_files.t) =
Expand Down

0 comments on commit 9cb0cc3

Please sign in to comment.