Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop recording deps in Action_builder.contents #10446

Merged

Conversation

Alizter
Copy link
Collaborator

@Alizter Alizter commented Apr 20, 2024

PR #9552 changed the semantics of Action_builder.contents so that it records a dependency. The Coq rules were relying on the previous behaviour of not recording a dependency in order to generate a build plan. This caused issue #10149 to appear.

This PR fixes #10149 by removing the dependency being recorded in Action_builder.contents matching the previous semantics.

cc @rgrinberg

Here is the semantic change in #9552
https://github.com/ocaml/dune/pull/9552/files#r1573098164

  • changelog

Signed-off-by: Rodolphe Lepigre <rodolphe@bedrocksystems.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter Alizter force-pushed the fix-semantics-of-action-builder-contents branch from b9e5247 to d0f3266 Compare April 20, 2024 01:55
@snowleopard
Copy link
Collaborator

Wow, that seems like a pretty serious bug. It probably made incremental builds much worse in general, not just for Coq. Thanks for the fix!

Do we have any benchmarks that show an improvement after this commit?

It may be worth patching some earlier releases.

@rgrinberg
Copy link
Member

Thanks, could you add a change log entry?

We do not have any incremental benchmarks.

PR ocaml#9552 changed the semantics of Action_builder.contents so that it
records a dependency. The Coq rules were relying on the previous
behaviour of not recording a dependency in order to generate a build
plan. This caused issue ocaml#10149 to appear.

This PR fixes ocaml#10149 by removing the dependency being recorded in
Action_builder.contents matching the previous semantics.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter Alizter force-pushed the fix-semantics-of-action-builder-contents branch from d0f3266 to 26bf387 Compare April 20, 2024 12:25
@Alizter
Copy link
Collaborator Author

Alizter commented Apr 20, 2024

@rgrinberg I've added a changelog.

I don't see exactly how this would make incremental builds worse outside of Coq. The Coq support appears to be the only serious consumer of Action_builder.contents in terms of using it to generate a build plan. But that also means we have more motivation to keep the original semantics.

I've only mentioned Coq in the changelog since it is the only user-visible effect I am aware of.

@rgrinberg rgrinberg merged commit 57d35db into ocaml:main Apr 22, 2024
27 checks passed
@Alizter Alizter deleted the fix-semantics-of-action-builder-contents branch April 22, 2024 11:27
@ejgallego
Copy link
Collaborator

ejgallego commented Apr 22, 2024

Thanks for the fix @Alizter , a couple of additional comments:

  • I can see how the semantics of contents and dep recording can be confusing some times, maybe it would be worth to make the documentation of contents more precise in the .mli file?
  • I have seen various criteria for naming PRs as "refactor", maybe we should clarify the rules of what do we consider as a "refactoring"? [I fear that indeed when we tag stuff as refactor, we tend to review less carefully as most of those are boring / straightforward]

@emillon emillon mentioned this pull request Apr 22, 2024
13 tasks
emillon pushed a commit that referenced this pull request Apr 23, 2024
* Add reproduction test case for #10149.

Signed-off-by: Rodolphe Lepigre <rodolphe@bedrocksystems.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>

* stop recording deps in Action_builder.contents

PR #9552 changed the semantics of Action_builder.contents so that it
records a dependency. The Coq rules were relying on the previous
behaviour of not recording a dependency in order to generate a build
plan. This caused issue #10149 to appear.

This PR fixes #10149 by removing the dependency being recorded in
Action_builder.contents matching the previous semantics.

Signed-off-by: Ali Caglayan <alizter@gmail.com>

---------

Signed-off-by: Rodolphe Lepigre <rodolphe@bedrocksystems.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Co-authored-by: Rodolphe Lepigre <rodolphe@bedrocksystems.com>
Co-authored-by: Ali Caglayan <alizter@gmail.com>
emillon added a commit to emillon/opam-repository that referenced this pull request Apr 23, 2024
CHANGES:

### Fixed

- If no directory targets are defined, then do not evaluate `enabled_if`
  (ocaml/dune#10442, @rgrinberg)

- Fix a bug where Coq projects were being rebuilt from scratch each time the
  dependency graph changed. (ocaml/dune#10446, fixes ocaml/dune#10149, @Alizter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dune always rebuilds all coq files as soon as any dependency changes
4 participants