Skip to content

feat: rebuild source package if a build dependency changed#4171

Merged
remimimimimi merged 11 commits intoprefix-dev:mainfrom
baszalmstra:feat/rebuild_on_transitive_change
Jul 22, 2025
Merged

feat: rebuild source package if a build dependency changed#4171
remimimimimi merged 11 commits intoprefix-dev:mainfrom
baszalmstra:feat/rebuild_on_transitive_change

Conversation

@baszalmstra
Copy link
Contributor

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.

@baszalmstra baszalmstra force-pushed the feat/rebuild_on_transitive_change branch from 7953dd0 to 5408183 Compare July 22, 2025 07:21
Copy link
Contributor

@remimimimimi remimimimimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall well written! Could you also add test that check that we rebuild all dependencies that we want?

@baszalmstra baszalmstra requested a review from remimimimimi July 22, 2025 09:10
@lucascolley lucascolley added enhancement New features area:build Related to pixi build labels Jul 22, 2025
Copy link
Contributor

@remimimimimi remimimimimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, love that test! Just fix CI issues, and I would be glad to approve.

Copy link
Contributor

@remimimimimi remimimimimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@remimimimimi remimimimimi merged commit 463ae37 into prefix-dev:main Jul 22, 2025
74 of 75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build Related to pixi build enhancement New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants