diff --git a/CHANGES.md b/CHANGES.md index 9af1caf41ee..21b05ca4f3d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -91,6 +91,9 @@ Unreleased - Support `(link_flags ...)` in `(cinaps ...)` stanza. (#7423, fixes #7416, @nojb) +- Allow `(package ...)` in any position within `(rule ...)` stanza (#7445, + @Leonidas-from-XIV) + 3.7.0 (2023-02-17) ------------------ diff --git a/src/dune_rules/dune_file.ml b/src/dune_rules/dune_file.ml index 75d25048e14..7b2139f2a58 100644 --- a/src/dune_rules/dune_file.ml +++ b/src/dune_rules/dune_file.ml @@ -1728,6 +1728,7 @@ module Rule = struct ; ("aliases", Field) ; ("alias", Field) ; ("enabled_if", Field) + ; ("package", Field) ] let short_form = diff --git a/test/blackbox-tests/test-cases/package-rule.t/a.opam b/test/blackbox-tests/test-cases/package-rule.t/a.opam new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/blackbox-tests/test-cases/package-rule.t/dune b/test/blackbox-tests/test-cases/package-rule.t/dune new file mode 100644 index 00000000000..7fb4c837630 --- /dev/null +++ b/test/blackbox-tests/test-cases/package-rule.t/dune @@ -0,0 +1,12 @@ +(test + (name test) + (modules test test_a test_b) + (package a)) + +(rule + (action (copy test_temp.ml test_a.ml)) + (package a)) + +(rule + (package a) + (action (copy test_temp.ml test_b.ml))) diff --git a/test/blackbox-tests/test-cases/package-rule.t/dune-project b/test/blackbox-tests/test-cases/package-rule.t/dune-project new file mode 100644 index 00000000000..929c696e561 --- /dev/null +++ b/test/blackbox-tests/test-cases/package-rule.t/dune-project @@ -0,0 +1 @@ +(lang dune 2.0) diff --git a/test/blackbox-tests/test-cases/package-rule.t/run.t b/test/blackbox-tests/test-cases/package-rule.t/run.t new file mode 100644 index 00000000000..f5996486b33 --- /dev/null +++ b/test/blackbox-tests/test-cases/package-rule.t/run.t @@ -0,0 +1,5 @@ +When --only-packages is passed, it runs + + $ dune build --only-packages a @runtest + A + A diff --git a/test/blackbox-tests/test-cases/package-rule.t/test.ml b/test/blackbox-tests/test-cases/package-rule.t/test.ml new file mode 100644 index 00000000000..75ac96eddc2 --- /dev/null +++ b/test/blackbox-tests/test-cases/package-rule.t/test.ml @@ -0,0 +1,2 @@ +module _ = Test_a +module _ = Test_b diff --git a/test/blackbox-tests/test-cases/package-rule.t/test_temp.ml b/test/blackbox-tests/test-cases/package-rule.t/test_temp.ml new file mode 100644 index 00000000000..5c90cb66203 --- /dev/null +++ b/test/blackbox-tests/test-cases/package-rule.t/test_temp.ml @@ -0,0 +1 @@ +let () = print_endline "A"