From dca2e3b96454aa07a249bfa35c946f0605e67517 Mon Sep 17 00:00:00 2001 From: Arseniy Alekseyev Date: Tue, 14 Apr 2020 10:55:20 +0100 Subject: [PATCH 1/2] Fix the bug where [locks] had no effect for rules with no targets Signed-off-by: Arseniy Alekseyev --- CHANGES.md | 3 +++ src/dune/simple_rules.ml | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9287aec2f9d..c7e7d46d429 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) ------------------ diff --git a/src/dune/simple_rules.ml b/src/dune/simple_rules.ml index 8752e86ad9f..6c6b0b55e91 100644 --- a/src/dune/simple_rules.ml +++ b/src/dune/simple_rules.ml @@ -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) @@ -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) = From e5a0a165117ef1c4025984ef3dd27ab279fa556a Mon Sep 17 00:00:00 2001 From: Arseniy Alekseyev Date: Wed, 15 Apr 2020 10:13:09 +0100 Subject: [PATCH 2/2] ocamlformat Signed-off-by: Arseniy Alekseyev --- src/dune/simple_rules.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dune/simple_rules.ml b/src/dune/simple_rules.ml index 6c6b0b55e91..20600241728 100644 --- a/src/dune/simple_rules.ml +++ b/src/dune/simple_rules.ml @@ -124,7 +124,7 @@ 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 - let locks = (interpret_locks ~expander rule.locks) in + let locks = interpret_locks ~expander rule.locks in Alias_rules.add sctx ~alias ~stamp ~loc:(Some rule.loc) action ~locks; Path.Build.Set.empty )