-
Notifications
You must be signed in to change notification settings - Fork 474
crate_universe
: Review how to interract with environment variables
#662
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
Comments
I think the smarter thing to do would be to check for the version of the feature resolver and embed that into the metadata since that's the thing impacting the lockfile and not specifically the version of cargo. The version of cargo just has different behavior for when that's not set. |
Sure, we could hard-code logic to parse out the edition and the cargo version and embed that. But how would you handle the other example I gave? Where a bug was fixed which means that dependencies which used to accidentally be put into multiple kinds (e.g. a normal dep would also appear as a dev dep) is now only put in one? Or the I'm sure dozens of other bugfixes or changes in behaviour which mean that resolves are slightly different. My point is there are a bunch of places where different cargo versions can lead to different behaviours. We could try to find all of them and hard-code an indicator into our cache key (where for the other example I gave, the thing we're hard-coding would be "Are you >= 1.52"), but that ends up basically coming down to embedding the cargo version. We'd get a small gain (we would maybe consider 1.50 and 1.51 equivalent, for instance), and the expense of maybe being incorrect because we didn't analyse every change that went into cargo correctly... |
Perhaps it's not necessary to include this information at all? There seems to be two modes here (which might be obvious to some):
I think it makes sense to store information like the cargo version and any and all information related to generating a lockfile to ensure it's reproducible given the same available revisions and releases. But once a lockfile is generated, I no longer care about the way the file was generated, I want to take a lockfile and go get those dependencies. It sounds like the current implementation combines those two steps and prevents the lockfile from being usable between two different versions of cargo? Is that true? |
Going back to the two important properties from #655 (comment):
If we ignore the version of cargo being used, we violate 2. Example scenario:
This is what we're trying to avoid. We want the person who changes the cargo version to be the person who finds out they broke it, rather than the hapless person who next happens to touch the file. |
This makes the file unsharable. Which is fine, but then how do you allow for cross workspace dependency resolution? |
What makes the file unsharable? |
WORKSPACE.bazel
BUILD.bazelrust_binary(
name = "mars",
deps = [
"@crates//:cargo_raze",
# ...
],
# ...
) This is specifically what I'm looking to be able to support and what I mean by "sharable". Perhaps the lockfile is not the thing that should be sharable. And if that's the case then I agree with you, it'd make sense to have a very locked down lockfile which should largely be based on the configuration of the current repo, then have something else which can be used to share dependency trees. This is seeming like a separate feature request but I think is important to consider early on. |
I don't think this is relevant since the crate_universe rewrite. Closing this out for now but feel free to reopen if there's an aspect of it that I missed. |
Continuing a conversation from #655 (comment)
cc @illicitonion
The text was updated successfully, but these errors were encountered: