Skip to content

Implement recompilation checking for pre-build rules#11731

Merged
mergify[bot] merged 2 commits intohaskell:masterfrom
sheaf:hooks-recomp
Apr 26, 2026
Merged

Implement recompilation checking for pre-build rules#11731
mergify[bot] merged 2 commits intohaskell:masterfrom
sheaf:hooks-recomp

Conversation

@sheaf
Copy link
Copy Markdown
Collaborator

@sheaf sheaf commented Apr 10, 2026

Template Α: This PR modifies behaviour or interface


This PR adds recompilation logic for SetupHooks pre-build rules, implementing the behaviour described in the SetupHooks API. That is, a rule is considered stale if:

  • The rule is new, or
  • A dependency of the rule is stale. That is, either we have re-run another rule that this rule depends on, or one of the file inputs to the rule is newer than the oldest output of the rule (or the rule output doesn't exist at all), or
  • The rule itself has changed, e.g. the parameters stored in RuleData have changed.

Tested in cabal-testsuite/PackageTests/SetupHooks/SetupHooksRecompRules/setup.test.hs.

@sheaf sheaf changed the title Hooks recomp Implement recompilation checking for pre-build rules Apr 10, 2026
@sheaf sheaf force-pushed the hooks-recomp branch 2 times, most recently from 215dc25 to 5703687 Compare April 10, 2026 13:58
@sheaf sheaf marked this pull request as ready for review April 10, 2026 15:06
Comment thread Cabal/src/Distribution/Simple/SetupHooks/Internal.hs Outdated
Comment thread Cabal/src/Distribution/Simple/SetupHooks/Internal.hs Outdated
Comment thread changelog.d/hooks-recomp.md Outdated
@sheaf
Copy link
Copy Markdown
Collaborator Author

sheaf commented Apr 20, 2026

Anyone else interested in taking a look? Not sure who to ping.

Comment thread Cabal/src/Distribution/Simple/SetupHooks/Internal.hs Outdated
Comment thread Cabal/src/Distribution/Simple/SetupHooks/Internal.hs Outdated
Comment thread Cabal/src/Distribution/Simple/SetupHooks/Internal.hs Outdated
Comment thread cabal-testsuite/PackageTests/SetupHooks/SetupHooksRecompRules/cabal.project Outdated
Comment thread Cabal-hooks/src/Distribution/Simple/SetupHooks.hs Outdated
@sheaf
Copy link
Copy Markdown
Collaborator Author

sheaf commented Apr 23, 2026

Thanks for the suggestions @philderbeast! All applied now.

@Mikolaj
Copy link
Copy Markdown
Member

Mikolaj commented Apr 23, 2026

@sheaf: please add merge labels to the PRs! :)

@sheaf sheaf added the merge me Tell Mergify Bot to merge label Apr 24, 2026
sheaf added 2 commits April 24, 2026 11:46
This commit adds 'Structured' instances for the 'RuleCommands' and
'RuleData' datatypes. This allows us to serialise and deserialise them,
which allows us to compute which rules have changed across builds.
This is necessary for recompilation checking for pre-build rules.
This commit adds recompilation logic for SetupHooks pre-build rules.
This implements the behaviour described in the SetupHooks API. That is,
a rule is considered stale if:

  [N] The rule is new, or
  [S1] A dependency of the rule is stale. That is, either we have
       re-run another rule that this rule depends on, or one of the
       file inputs to the rule is newer than the oldest output of the
       rule (or the rule output doesn't exist at all), or
  [S2] The rule itself has changed, e.g. the parameters stored in
       RuleData have changed.

Fixes haskell#11730
@mergify mergify Bot added ready and waiting Mergify is waiting out the cooldown period merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days queued labels Apr 24, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 26, 2026

Merge Queue Status

This pull request spent 1 hour 59 minutes 43 seconds in the queue, including 1 hour 49 minutes 6 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Doctest Cabal
    • check-neutral = Doctest Cabal
    • check-skipped = Doctest Cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Meta checks
    • check-neutral = Meta checks
    • check-skipped = Meta checks
  • any of [🛡 GitHub branch protection]:
    • check-success = docs/readthedocs.org:cabal
    • check-neutral = docs/readthedocs.org:cabal
    • check-skipped = docs/readthedocs.org:cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Validate post job
    • check-neutral = Validate post job
    • check-skipped = Validate post job
  • any of [🛡 GitHub branch protection]:
    • check-success = fourmolu
    • check-neutral = fourmolu
    • check-skipped = fourmolu
  • any of [🛡 GitHub branch protection]:
    • check-success = hlint
    • check-neutral = hlint
    • check-skipped = hlint
  • any of [🛡 GitHub branch protection]:
    • check-success = Bootstrap post job
    • check-neutral = Bootstrap post job
    • check-skipped = Bootstrap post job
  • any of [🛡 GitHub branch protection]:
    • check-success = whitespace
    • check-neutral = whitespace
    • check-skipped = whitespace
  • any of [🛡 GitHub branch protection]:
    • check-success = Check sdist post job
    • check-neutral = Check sdist post job
    • check-skipped = Check sdist post job
  • any of [🛡 GitHub branch protection]:
    • check-success = Changelogs
    • check-neutral = Changelogs
    • check-skipped = Changelogs

mergify Bot added a commit that referenced this pull request Apr 26, 2026
@mergify mergify Bot merged commit 70ed8a5 into haskell:master Apr 26, 2026
175 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge ready and waiting Mergify is waiting out the cooldown period

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants