feat: rebuild source package if a build dependency changed#4171
Merged
remimimimimi merged 11 commits intoprefix-dev:mainfrom Jul 22, 2025
Merged
feat: rebuild source package if a build dependency changed#4171remimimimimi merged 11 commits intoprefix-dev:mainfrom
remimimimimi merged 11 commits intoprefix-dev:mainfrom
Conversation
7953dd0 to
5408183
Compare
remimimimimi
suggested changes
Jul 22, 2025
Contributor
remimimimimi
left a comment
There was a problem hiding this comment.
Overall well written! Could you also add test that check that we rebuild all dependencies that we want?
crates/pixi_command_dispatcher/src/command_dispatcher_processor/source_build.rs
Outdated
Show resolved
Hide resolved
crates/pixi_command_dispatcher/src/command_dispatcher_processor/source_build.rs
Outdated
Show resolved
Hide resolved
crates/pixi_command_dispatcher/src/command_dispatcher_processor/source_build.rs
Outdated
Show resolved
Hide resolved
crates/pixi_command_dispatcher/src/command_dispatcher_processor/source_build_cache_status.rs
Outdated
Show resolved
Hide resolved
remimimimimi
suggested changes
Jul 22, 2025
Contributor
remimimimimi
left a comment
There was a problem hiding this comment.
Awesome, love that test! Just fix CI issues, and I would be glad to approve.
crates/pixi_command_dispatcher/src/source_build_cache_status/mod.rs
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pixi already rebuilt packages if their source files changed. This PR extends that by also rebuilding if one of the build dependencies of a package changed. Without this it is very easy to introduce ABI incompatibilities.
I implemented this by taking a two step approach coupled with memoization in the command dispatcher. A new function was added that reads the build cache and checks the staleness of the entry but doesnt actually act on it. The result is cached for the remainder of the programs execution. When we perform a source build the cache is first checked, if a cached build exists and is still fresh it is used, otherwise it is rebuild. The on-disk representation is modified but the command dispatcher remembers the previous state. This allows checking if a build dependency of a package is stale even while rebuilding them.
This PR does not detect metadata changes yet, only full rebuilds. Metadata changes are next.