This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
handle platform dependencies + update feature graph construction #82
Merged
Conversation
This file contains 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
sunshowers
force-pushed
the
target-spec
branch
3 times, most recently
from
March 28, 2020 02:27
d0ca869
to
f2f6be4
Compare
I'd want to get EmbarkStudios/cfg-expr#6 landed + include the three-value logic support in https://github.com/sunshowers/cfg-expr/tree/logic. |
metajack
approved these changes
Mar 31, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. A few minor comments below.
Since target features are CPU-dependent, the caller has to pass in a list to match against.
This is useful for evaluating against the current platform.
Addressing review feedback -- it's somewhat inconvenient to try and amend the earlier commits with this change, so here it is.
We're standardizing on naming the `cfg()` expression a `TargetSpec` and a triple a `Platform`.
Move the definitions and tests for `TargetSpec` and `Target` into `parser.rs`.
Moving this earlier provides a type-level guarantee that this works, which means that the `eval` method no longer needs to return any errors. The next commit will clean `eval` up.
Now that all checking happens at parse time, this can be done.
This wasn't really obvious to me when I was looking at this code.
This is because we're going to replace the Dependency enum's variants with TargetPredicates, which don't implement any of those. We may reintroduce this in the future if necessary.
This is a complete overhaul of the way platform-specific dependencies are handled. Based on my experimentation and reading the Cargo source code, I believe that this is now correct. Doing so also required feature graph construction to be updated, so the feature graph construction is ready for the new feature resolver, and is now platform-sensitive as well. The APIs for the feature graph are still to come, but making the data model be full-fidelity allows for both the current and new feature resolvers to be implemented. Now that target logic is internalized in guppy, cargo-guppy no longer needs to do its own evaluation. For more about the new feature resolver, see: * https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#features * rust-lang/cargo#7914 * rust-lang/cargo#7915 * rust-lang/cargo#7916
Thanks for the review! Before landing, I did some further refactoring so that Just need to wait on EmbarkStudios/cfg-expr#7 to land and be published to crates.io now. At that point we can release a guppy update ^_^ |
sunshowers
added a commit
to sunshowers/cargo-guppy
that referenced
this pull request
May 1, 2020
This works by: * setting up a real, fairly complex fixture * generating random queries using proptest * running them through cargo and guppy * ensuring that they produce the same results Not only does this give us high confidence that cargo and guppy produce the same results, it also gets us most of the way to facebookarchive#82. Most of the work in this commit is simply setting up all the necessary test infrastructure. We piggy-back on existing proptest infrastructure as much as possible.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This is a complete overhaul of the way platform-specific dependencies are
handled. Based on my experimentation and reading the Cargo source code, I
believe that this is now correct.
Doing so also required feature graph construction to be updated, so the
feature graph construction is ready for the new feature resolver, and is now
platform-sensitive as well. The APIs for the feature graph are still to
come, but making the data model be full-fidelity allows for both the current
and new feature resolvers to be implemented.
Now that target logic is internalized in guppy, cargo-guppy no longer needs
to do its own evaluation.
For more about the new feature resolver, see:
Closes #64.