Repository navigation
fix: only fill lower bound on existing menhir deps; do not auto-add - #14434
Conversation
Bump the cram tests from `(lang dune 3.23)` to `(lang dune 3.24)` and rename the changelog entry to the PR number to match repo convention (`(ocaml#14434, fixes ocaml#14428, @robinbb)`). Signed-off-by: Robin Bate Boerop <[email protected]>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR fixes #14428 by limiting Dune’s auto-injected menhir (>= 20180523) opam dependency to only those packages that actually use a (menhir ...) stanza, instead of injecting it into every package when (using menhir ...) is enabled project-wide.
Changes:
- Compute a per-project
packages_using_menhirset by scanning dune files for(menhir ...)stanzas and mapping co-located installable stanzas back to packages. - Thread
packages_using_menhirthroughOpam_create.generate/opam_fieldsand update callers. - Add/adjust blackbox tests (including a new multi-package regression test) and add a changelog entry.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/blackbox-tests/test-cases/menhir/opam-menhir-dep.t | Updates existing test setup to ensure the package actually contains a (menhir ...) stanza. |
| test/blackbox-tests/test-cases/menhir/opam-menhir-dep-multi-package.t | Adds regression coverage for multi-package projects where only some packages use menhir. |
| src/dune_rules/opam_create.mli | Exposes packages_using_menhir and updates generate API to accept the computed set. |
| src/dune_rules/opam_create.ml | Implements packages_using_menhir and gates menhir dep injection on membership in that set. |
| bin/dune_init.ml | Updates call site to new generate signature. |
| bin/describe/describe_opam_files.ml | Computes packages_using_menhir before generating opam contents. |
| doc/changes/fixed/14434.md | Documents the fix in the changelog. |
Two of the four Copilot comments are still applicable; the third was already resolved by a later commit on this branch (the [(mli)] doc no longer claims context-independence — see e7bdede which restored the [Context_name.t] parameter). - `add_rules`: skip the [packages_using_menhir] computation in [`Inside_opam_directory] mode, where [add_opam_file_rule] is invoked from [add_opam_file_rules] instead and the value here is unused. Eliminates the duplicate scan flagged by Copilot. - Cram tests: replace the `[1]`-exit-code expectations on `dune build @Opam --auto-promote` with `|| true`. The exit code (non-zero on first promotion, zero thereafter) is incidental to what the tests prove; the file-content assertions are what matter. Signed-off-by: Robin Bate Boerop <[email protected]>
Mirrors the existing `has_standard`. Callers that need to summarise an `Unexpanded.t` syntactically — without reading the file an `(:include FN)` directive points to — must now check `has_include` and widen their answer accordingly, since `fold_strings` skips `Include` AST nodes entirely. Used by the menhir auto-injection in opam-create (ocaml#14434, fixes ocaml#14428): a `(modules (:include FN))` library would otherwise be mis-summarised as compiling no modules. Signed-off-by: Robin Bate Boerop <[email protected]>
67bd319 to
7ac6714
Compare
|
This fix has grown quite large. It might be worth considering if we want to revert the original feature and reopen that issue until a better implementation can be found. Otherwise this will be painful to backport. |
Mirrors the existing `has_standard`. Callers that need to summarise an `Unexpanded.t` syntactically — without reading the file an `(:include FN)` directive points to — must now check `has_include` and widen their answer accordingly, since `fold_strings` skips `Include` AST nodes entirely. Used by the menhir auto-injection in opam-create (ocaml#14434, fixes ocaml#14428): a `(modules (:include FN))` library would otherwise be mis-summarised as compiling no modules. Signed-off-by: Robin Bate Boerop <[email protected]>
7ac6714 to
114d281
Compare
I can simplify.... |
a43da16 to
2e68c3f
Compare
|
@Alizter The PR is now small, and easily reviewed. Thanks for pointing out that it was getting out of control. :-) |
2e68c3f to
071e2ec
Compare
Case 4 leaves a [bar.opam] behind. Case 5's dune-project has no [bar] package stanza, so dune errors on the orphan opam file before regenerating [foo.opam] unless [bar.opam] is removed first. Signed-off-by: Robin Bate Boerop <[email protected]>
Each case ran [dune build @Opam --auto-promote] (allowed to exit [1] when a promotion happened), then [dune build @Opam] again to confirm a fixed point, then [grep] on the promoted file. The fixed-point check is generic dune behaviour, not specific to what this test exercises (the content of the [menhir] line in the generated opam file). Drop it; the [grep] assertions still cover the intended behaviour. Signed-off-by: Robin Bate Boerop <[email protected]>
Yes. I went down that path initially, and that's what caused the PR to become too big - the logic for figuring out where to inject it. Perhaps I was making a simple mistake, but I did not have a simple solutions. So, I fell back to this, because this is all that is required to both solve the open bug (#14428) and the original issue (#10707). |
…caml#14434) ## Summary Fixes ocaml#14428. The 3.23 menhir auto-injection (ocaml#14168) was triggered by the project-wide `(using menhir ...)` extension and added `menhir` as a *new* dependency to every package's generated opam file, regardless of whether the package's own `(depends ...)` field declared it. In multi-package projects where only some packages used menhir, every package gained a spurious build-time dependency. The original ask in ocaml#10707 was narrower: when a generated opam file *already* lists `menhir`, fill in the lower bound `{>= "20180523"}` that dune's menhir rules require. This PR restricts the behaviour to that. ## Behaviour - A package that does not declare `(depends menhir)` no longer has `menhir` added by dune. - A package that declares bare `(depends menhir)` has the lower bound filled in. - A package whose `(depends ...)` already specifies a constraint (version bound, `{with-test}`, etc.) is preserved verbatim. - Gated on `(using menhir ...)` being enabled — without the extension, no upgrade. The convenience of auto-adding `menhir` for users who use a `(menhir ...)` stanza but forget to declare `(depends menhir)` is deliberately removed: the dependency-inference logic that supported it was the source of ocaml#14428 and out of scope for ocaml#10707. --------- Signed-off-by: Robin Bate Boerop <[email protected]> (cherry picked from commit b471f2f) Signed-off-by: Sudha Parimala <[email protected]>
…caml#14434) ## Summary Fixes ocaml#14428. The 3.23 menhir auto-injection (ocaml#14168) was triggered by the project-wide `(using menhir ...)` extension and added `menhir` as a *new* dependency to every package's generated opam file, regardless of whether the package's own `(depends ...)` field declared it. In multi-package projects where only some packages used menhir, every package gained a spurious build-time dependency. The original ask in ocaml#10707 was narrower: when a generated opam file *already* lists `menhir`, fill in the lower bound `{>= "20180523"}` that dune's menhir rules require. This PR restricts the behaviour to that. ## Behaviour - A package that does not declare `(depends menhir)` no longer has `menhir` added by dune. - A package that declares bare `(depends menhir)` has the lower bound filled in. - A package whose `(depends ...)` already specifies a constraint (version bound, `{with-test}`, etc.) is preserved verbatim. - Gated on `(using menhir ...)` being enabled — without the extension, no upgrade. The convenience of auto-adding `menhir` for users who use a `(menhir ...)` stanza but forget to declare `(depends menhir)` is deliberately removed: the dependency-inference logic that supported it was the source of ocaml#14428 and out of scope for ocaml#10707. --------- Signed-off-by: Robin Bate Boerop <[email protected]> (cherry picked from commit b471f2f) Signed-off-by: Sudha Parimala <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep (not adding it to packages that don't declare it). That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Effects on the generated opam file: - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (unchanged from ocaml#14434). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Updates [opam-menhir-dep.t] Case 5 expected output and adds Case 6 covering the override-low warning path. Signed-off-by: Robin Bate Boerop <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep (not adding it to packages that don't declare it). That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Effects on the generated opam file: - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (unchanged from ocaml#14434). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Updates [opam-menhir-dep.t] Case 5 expected output and adds Case 6 covering the override-low warning path. Signed-off-by: Robin Bate Boerop <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep. That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Gate the entire menhir upgrade step on [(lang dune 3.23)] or newer. Earlier lang versions get the user's constraint verbatim (no fill, no warn), parallelling ocaml#14466 / the fix for ocaml#14436. The 3.23 gate also covers the bare-[(menhir)] fill from ocaml#14434, which previously applied unversioned. Effects on the generated opam file (under [(lang dune 3.23)] or newer): - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (was already the behaviour from ocaml#14434, now gated). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Lang-version gate per @Leonidas-from-XIV's review of ocaml#14453. Updates [opam-menhir-dep.t] Case 5 expected output, adds Case 6 covering the override-low warning path, and adds Case 7 covering the [(lang dune 3.22)] gate-off behaviour. Signed-off-by: Robin Bate Boerop <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep. That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Gate the entire menhir upgrade step on [(lang dune 3.23)] or newer. Earlier lang versions get the user's constraint verbatim (no fill, no warn), parallelling ocaml#14466 / the fix for ocaml#14436. The 3.23 gate also covers the bare-[(menhir)] fill from ocaml#14434, which previously applied unversioned. Effects on the generated opam file (under [(lang dune 3.23)] or newer): - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (was already the behaviour from ocaml#14434, now gated). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Lang-version gate per @Leonidas-from-XIV's review of ocaml#14453. Updates [opam-menhir-dep.t] Case 5 expected output, adds Case 6 covering the override-low warning path, and adds Case 7 covering the [(lang dune 3.22)] gate-off behaviour. Case 6 reads the generated file directly from [_build/default/] instead of going through [--auto-promote], and uses [dune_cmd print-from | print-until] to extract just the warning text (dropping the [Promoting] line that was incidental to what the case actually asserts), addressing review feedback that the prior compound [sed] was unreadable. Signed-off-by: Robin Bate Boerop <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep. That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Gate the entire menhir upgrade step on [(lang dune 3.23)] or newer. Earlier lang versions get the user's constraint verbatim (no fill, no warn), parallelling ocaml#14466 / the fix for ocaml#14436. The 3.23 gate also covers the bare-[(menhir)] fill from ocaml#14434, which previously applied unversioned. Effects on the generated opam file (under [(lang dune 3.23)] or newer): - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (was already the behaviour from ocaml#14434, now gated). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Lang-version gate per @Leonidas-from-XIV's review of ocaml#14453. Updates [opam-menhir-dep.t] Case 5 expected output, adds Case 6 covering the override-low warning path, and adds Case 7 covering the [(lang dune 3.22)] gate-off behaviour. Case 6 reads the generated file directly from [_build/default/] instead of going through [--auto-promote], and uses [dune_cmd print-from | print-until] to extract just the warning text (dropping the [Promoting] line that was incidental to what the case actually asserts), addressing review feedback that the prior compound [sed] was unreadable. Signed-off-by: Robin Bate Boerop <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep. That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Gate the entire menhir upgrade step on [(lang dune 3.23)] or newer. Earlier lang versions get the user's constraint verbatim (no fill, no warn), parallelling ocaml#14466 / the fix for ocaml#14436. The 3.23 gate also covers the bare-[(menhir)] fill from ocaml#14434, which previously applied unversioned. Effects on the generated opam file (under [(lang dune 3.23)] or newer): - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (was already the behaviour from ocaml#14434, now gated). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Lang-version gate per @Leonidas-from-XIV's review of ocaml#14453. Updates [opam-menhir-dep.t] Case 5 expected output, adds Case 6 covering the override-low warning path, and adds Case 7 covering the [(lang dune 3.22)] gate-off behaviour. Case 6 reads the generated file directly from [_build/default/] instead of going through [--auto-promote], and uses [dune_cmd print-from | print-until] to extract just the warning text (dropping the [Promoting] line that was incidental to what the case actually asserts), addressing review feedback that the prior compound [sed] was unreadable. Signed-off-by: Robin Bate Boerop <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep. That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Gate the entire menhir upgrade step on [(lang dune 3.23)] or newer. Earlier lang versions get the user's constraint verbatim (no fill, no warn), parallelling ocaml#14466 / the fix for ocaml#14436. The 3.23 gate also covers the bare-[(menhir)] fill from ocaml#14434, which previously applied unversioned. Effects on the generated opam file (under [(lang dune 3.23)] or newer): - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (was already the behaviour from ocaml#14434, now gated). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Lang-version gate per @Leonidas-from-XIV's review of ocaml#14453. Updates [opam-menhir-dep.t] Case 5 expected output, adds Case 6 covering the override-low warning path, and adds Cases 7 and 8 covering the [(lang dune 3.22)] gate-off behaviour for both the user-constrained and bare-[(menhir)] shapes. Case 6 reads the generated file directly from [_build/default/] instead of going through [--auto-promote], and uses [dune_cmd print-from | print-until] to extract just the warning text (dropping the [Promoting] line that was incidental to what the case actually asserts), addressing review feedback that the prior compound [sed] was unreadable. Signed-off-by: Robin Bate Boerop <[email protected]>
Follows up ocaml#14434, which fixed the over-injection bug from ocaml#14428 by filling [>= "20180523"] only on packages that already declare a [menhir] dep. That fix only handled the *bare* declaration case; user-written constraints were preserved verbatim, including bounds below dune's required minimum and non-version filters that didn't combine with the bound. Tighten [upgrade_menhir_constraint] in [opam_create.ml] to mirror [merge_dune_constraints]: - Two [>= "v"] literals collapse to the higher of the two. When the user's bound is below dune's required minimum, emit a [User_warning.emit] and use [>= "20180523"]. - Any other shape (e.g. [{with-test}]) is ANDed with the lower bound: [(menhir :with-test)] now generates [{>= "20180523" & with-test}], not just [{with-test}]. Gate the entire menhir upgrade step on [(lang dune 3.23)] or newer. Earlier lang versions get the user's constraint verbatim (no fill, no warn), parallelling ocaml#14466 / the fix for ocaml#14436. The 3.23 gate also covers the bare-[(menhir)] fill from ocaml#14434, which previously applied unversioned. Effects on the generated opam file (under [(lang dune 3.23)] or newer): - [(menhir (>= 20100101))] -> warn, [{>= "20180523"}]. - [(menhir :with-test)] -> [{>= "20180523" & with-test}]. - [(menhir (>= 20211128))] -> [{>= "20211128"}] (unchanged; user's bound already at or above dune's). - bare [(menhir)] -> [{>= "20180523"}] (was already the behaviour from ocaml#14434, now gated). Suggestion from @Leonidas-from-XIV in ocaml#14434 (comment) and agreed direction in ocaml#14434 (comment). Lang-version gate per @Leonidas-from-XIV's review of ocaml#14453. Updates [opam-menhir-dep.t] Case 5 expected output, adds Case 6 covering the override-low warning path, and adds Cases 7 and 8 covering the [(lang dune 3.22)] gate-off behaviour for both the user-constrained and bare-[(menhir)] shapes. Case 6 reads the generated file directly from [_build/default/] instead of going through [--auto-promote], and uses [dune_cmd print-from | print-until] to extract just the warning text (dropping the [Promoting] line that was incidental to what the case actually asserts), addressing review feedback that the prior compound [sed] was unreadable. Signed-off-by: Robin Bate Boerop <[email protected]>
Adds a tier between the existing < 3.23 skip and the post-PR full merge behaviour, so that [(lang dune 3.23)] projects keep the pre-ocaml#14453 behaviour they shipped under and avoid silent changes to opam output on dune-binary upgrade. [merge_dune_constraints] (dune-package side): - >= 3.24: enhanced rewrite/normalise (this PR's new behaviour). - >= 3.23: [merge_dune_constraints_simple] — the pre-ocaml#14453 simple dedup body (resurrected). Preserves the ocaml#14436 / ocaml#14466 behaviour shipped in 3.23.1. - else: bare [And [lang_constraint; user_constraint]]. [upgrade_menhir_constraint] (menhir-package side): - >= 3.24: full upgrade — bare-fill plus [merge_menhir_constraint] for user-written constraints (this PR's new behaviour). - >= 3.23: [upgrade_menhir_constraint_simple] — the pre-ocaml#14453 bare-fill-only body (resurrected). Preserves the ocaml#14168 / ocaml#14434 behaviour shipped in 3.23.x. - < 3.23: skip entirely (the original guard added by this PR). Tests: - Cases 7-8 reverted to [(lang dune 3.22)] — they exercise the < 3.23 skip tier. - New Cases 23-24 at [(lang dune 3.23)] — they exercise the simple tier (bare-fill yes, user-constraint preserved verbatim). - Existing Cases 0-22 stay at [(lang dune 3.24)] for the enhanced tier. - [dune-dep.t]'s "lower bound below lang" warning reverts to the pre-ocaml#14453 wording, since lang 3.23 now uses the simple function again. Signed-off-by: Robin Bate Boerop <[email protected]>
CHANGES:
### Fixed
- Fix the `menhir` opam dependency injection introduced in 3.23. Dune
now only fills in the lower bound `{>= "20180523"}` on an existing
user-declared `menhir` dependency; it no longer adds `menhir` as a
new dependency to packages that did not declare it themselves.
(ocaml/dune#14434, fixes ocaml/dune#14428, @robinbb)
- Gate the `dune` version-bound deduplication in generated opam files
(introduced in 3.23) on `(lang dune 3.23)`. Projects at earlier lang
versions get the prior `And [...]` shape — e.g.
`{>= "3.17" & >= "3.20"}` — restoring 3.22 behaviour and avoiding a
silent change to opam output on dune-binary upgrade. (ocaml/dune#14436,
@robinbb)
- Preserve library order when building a shared jsoo standalone runtime.
(ocaml/dune#14438, @vouillon)
- Fix the fallback to the secondary compiler, allowing recovering of support for
packages with upper bounds on OCaml less than 4.14. Packages depending on dune
3.23.1 or later and with an upper bound on the OCaml compiler that is less
than 4.14, will now be able to use the latest dune, but dune will be built
with the secondary compiler at version 4.14. (ocaml/dune#14443, @Alizter)
- Fix the bootstrap on NetBSD by including `<sys/wait.h>` in `lev_stubs.c`,
matching the existing FreeBSD/OpenBSD guard.
(ocaml/dune#14512, fixes ocaml/dune#14484, @0-wiz-0)
Summary
Fixes #14428.
The 3.23 menhir auto-injection (#14168) was triggered by the project-wide
(using menhir ...)extension and addedmenhiras a new dependency to every package's generated opam file, regardless of whether the package's own(depends ...)field declared it. In multi-package projects where only some packages used menhir, every package gained a spurious build-time dependency.The original ask in #10707 was narrower: when a generated opam file already lists
menhir, fill in the lower bound{>= "20180523"}that dune's menhir rules require. This PR restricts the behaviour to that.Behaviour
(depends menhir)no longer hasmenhiradded by dune.(depends menhir)has the lower bound filled in.(depends ...)already specifies a constraint (version bound,{with-test}, etc.) is preserved verbatim.(using menhir ...)being enabled — without the extension, no upgrade.The convenience of auto-adding
menhirfor users who use a(menhir ...)stanza but forget to declare(depends menhir)is deliberately removed: the dependency-inference logic that supported it was the source of #14428 and out of scope for #10707.