Skip to content

Commit

Permalink
Revert "fix: make ignored rules fallback (ocaml#8706)"
Browse files Browse the repository at this point in the history
This reverts commit b326c30.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg committed Sep 21, 2023
1 parent b326c30 commit cb4e8b4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
5 changes: 2 additions & 3 deletions doc/changes/8518.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
- Turn internal promote rules into fallback rules when
`--ignore-promoted-rules` is set (#8518, #...., fix #8417, fix #8703,
@rgrinberg, @emillon)
- Ignore internal promote rules when `--ignore-promoted-rules` is set (#8518,
fix #8417, @rgrinberg)
36 changes: 19 additions & 17 deletions src/dune_rules/super_context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -259,29 +259,31 @@ let extend_action t ~dir action =
;;

let make_rule t ?mode ?loc ~dir { Action_builder.With_targets.build; targets } =
let (mode : Rule.Mode.t option) =
match mode with
| Some mode when Rule_mode_decoder.is_ignored mode ~until_clean:`Keep -> Some Fallback
| _ -> mode
in
let build = extend_action t build ~dir in
Rule.make
?mode
~info:(Rule.Info.of_loc_opt loc)
~context:(Some (Context.build_context (Env_tree.context t)))
~targets
build
match mode with
| Some mode when Rule_mode_decoder.is_ignored mode ~until_clean:`Keep -> None
| _ ->
let build = extend_action t build ~dir in
Some
(Rule.make
?mode
~info:(Rule.Info.of_loc_opt loc)
~context:(Some (Context.build_context (Env_tree.context t)))
~targets
build)
;;

let add_rule t ?mode ?loc ~dir build =
let rule = make_rule t ?mode ?loc ~dir build in
Rules.Produce.rule rule
match make_rule t ?mode ?loc ~dir build with
| None -> Memo.return ()
| Some rule -> Rules.Produce.rule rule
;;

let add_rule_get_targets t ?mode ?loc ~dir build =
let rule = make_rule t ?mode ?loc ~dir build in
let+ () = Rules.Produce.rule rule in
Some rule.targets
match make_rule t ?mode ?loc ~dir build with
| None -> Memo.return None
| Some rule ->
let+ () = Rules.Produce.rule rule in
Some rule.targets
;;

let add_rules t ?loc ~dir builds = Memo.parallel_iter builds ~f:(add_rule ?loc t ~dir)
Expand Down
3 changes: 3 additions & 0 deletions test/blackbox-tests/test-cases/missing-opam-generated-file.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ will overwrite `pkg.opam`. Now it does not update the file.
$ touch opam

$ dune build -p pkg @install
Error: No rule found for pkg.opam
-> required by alias install
[1]

0 comments on commit cb4e8b4

Please sign in to comment.