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

unnecessary rebuild of unrelated packages in monorepo on member version bump #445

Open
iwinux opened this issue Oct 30, 2023 · 1 comment

Comments

@iwinux
Copy link

iwinux commented Oct 30, 2023

Suppose I have crates/foo and crates/bar in a monorepo. Whenever I bump the version of crates/foo, the content of Cargo.lock at the repo root also changes. That inevitably triggers rebuild of crates/bar and all of its deps, even if crates/bar does not depends on crates/foo and none of its files (except for the shared Cargo.lock) change.

Is there any way to avoid this?

@ipetkov
Copy link
Owner

ipetkov commented Nov 6, 2023

Hi @iwinux thanks for the report!

Currently we copy over the Cargo.lock completely untouched when creating the dummified sources (to build only dependency crates). When a workspace package's version changes, it gets recorded in the Cargo.lock and as you've observed it leads to a rebuild...

I don't think there is a (good?) way to avoid this besides adding an additional Cargo.lock file (i.e. workspace) for crates/bar and telling crane to build that workspace separately (crates/foo can still refer to crates/bar, but that workspace will also get rebuilt whenever crates/foo or crates/bar's versions change)


Implementing #288 may be able to help with this (or rather it will avoid having to rebuild all of crates/bar's dependencies. Changing any version of a workspace package would still end up rebuilding the workspace crates even if all external deps aren't fwiw)

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

No branches or pull requests

2 participants