Skip to content

Commit 9d7b0e2

Browse files
committed
Revert "fix: make ignored rules fallback (ocaml#8706)"
This reverts commit b326c30.
1 parent b326c30 commit 9d7b0e2

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

doc/changes/8518.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
- Turn internal promote rules into fallback rules when
2-
`--ignore-promoted-rules` is set (#8518, #...., fix #8417, fix #8703,
3-
@rgrinberg, @emillon)
1+
- Ignore internal promote rules when `--ignore-promoted-rules` is set (#8518,
2+
fix #8417, @rgrinberg)

src/dune_rules/super_context.ml

+19-17
Original file line numberDiff line numberDiff line change
@@ -259,29 +259,31 @@ let extend_action t ~dir action =
259259
;;
260260

261261
let make_rule t ?mode ?loc ~dir { Action_builder.With_targets.build; targets } =
262-
let (mode : Rule.Mode.t option) =
263-
match mode with
264-
| Some mode when Rule_mode_decoder.is_ignored mode ~until_clean:`Keep -> Some Fallback
265-
| _ -> mode
266-
in
267-
let build = extend_action t build ~dir in
268-
Rule.make
269-
?mode
270-
~info:(Rule.Info.of_loc_opt loc)
271-
~context:(Some (Context.build_context (Env_tree.context t)))
272-
~targets
273-
build
262+
match mode with
263+
| Some mode when Rule_mode_decoder.is_ignored mode ~until_clean:`Keep -> None
264+
| _ ->
265+
let build = extend_action t build ~dir in
266+
Some
267+
(Rule.make
268+
?mode
269+
~info:(Rule.Info.of_loc_opt loc)
270+
~context:(Some (Context.build_context (Env_tree.context t)))
271+
~targets
272+
build)
274273
;;
275274

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

281281
let add_rule_get_targets t ?mode ?loc ~dir build =
282-
let rule = make_rule t ?mode ?loc ~dir build in
283-
let+ () = Rules.Produce.rule rule in
284-
Some rule.targets
282+
match make_rule t ?mode ?loc ~dir build with
283+
| None -> Memo.return None
284+
| Some rule ->
285+
let+ () = Rules.Produce.rule rule in
286+
Some rule.targets
285287
;;
286288

287289
let add_rules t ?loc ~dir builds = Memo.parallel_iter builds ~f:(add_rule ?loc t ~dir)

test/blackbox-tests/test-cases/missing-opam-generated-file.t

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ will overwrite `pkg.opam`. Now it does not update the file.
1616
$ touch opam
1717

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

0 commit comments

Comments
 (0)