-
Notifications
You must be signed in to change notification settings - Fork 92
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
--workspace
and --package foo
build dependencies with different features (cache miss)
#396
Comments
If I understand correctly. Yes, it's how cargo work. In our CI for the project that has dozens of members, builds 9 separate binaries etc, we have basically two types of crane-based workflows:
I was thinking about introducing explicit handling of this to |
Yes this is precisely what I've experienced and what is likely happening here. I believe cargo does content-address the results of building different crates with different features (meaning you could build them side by side and they shouldn't clobber each other and be reusable later), but it would mean that you'd have to change the deps-only derivation to build those exact same packages in a similar way that you build the final results. This should end up building the different combinations of dependencies' feature flags and make the caching work better... Another approach is to use cargo-hakiri to let it manage the workspace (so that you end up using a single unification of all dependency features of the workspace), though I haven't used it myself and can't speak to it more than that! |
What I do is use @ipetkov I was just going to attempt to make a |
@dpc is the difference mostly to pass in Originally the default cargo args would pass that in, but I wanted |
@ipetkov The difference between what exactly? " When dealing with multi-crate project, the best workflow for CI seems to be:
Indeed |
@ipetkov Oh, and |
We've been using
buildDepsOnly
with--workspace
to cache all the dependencies in the workspace. Unfortunately, this doesn't actually work properly if feature unification takes place. At least, I think that's the problem. It's not 100% clear.As I understand it the issue is that when building multiple packages simultaneously, cargo will unify the features of dependencies so that it doesn't have to build the dependencies more than once. But when building the packages separately, it won't re-use the version of the package with extra features turned on, it will re-compile the dependency at that point.
Workaround:
The text was updated successfully, but these errors were encountered: