-
Notifications
You must be signed in to change notification settings - Fork 198
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
Allow crates to opt-in to building a single target #632
Conversation
as a side effect, only calculate metadata once instead of for each target
This comment has been minimized.
This comment has been minimized.
@@ -111,6 +120,8 @@ impl Metadata { | |||
.and_then(|v| v.as_bool()).unwrap_or(metadata.all_features); | |||
metadata.default_target = table.get("default-target") | |||
.and_then(|v| v.as_str()).map(|v| v.to_owned()); | |||
metadata.extra_targets = table.get("extra-targets").and_then(|f| f.as_array()) | |||
.and_then(|f| f.iter().map(|v| v.as_str().map(|v| v.to_owned())).collect()); |
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.
You don't have to do it in this PR, but it would be nice to just use #[derive(Deserialize)]
.
Oh, also, at least for now we need to filter the targets to make sure someone doesn't use an unsupported target, and fail the build in that case. |
This is our current behavior for an unsupported
Our behavior for an unsupported |
Addressed review comments. |
Keep in mind that we only show the build log of the default target, so users wouldn't be able to see those errors. |
Hmm, that does make it harder ... I don't want to fail the default build if one of the targets isn't installed, since that would require publishing a full point release. Maybe we could show a popup on the |
Also I plan to make a follow-up PR very shortly which will install targets dynamically so I'm not sure it's worth worrying about. |
This is almost entirely untested.
802e4c0
to
591eaf2
Compare
591eaf2
to
e06990b
Compare
c89044e
to
ff96849
Compare
This is ready for review. |
Other than these two comments this looks good to be merged! |
Addressed review comments. |
Based off of #532, but backwards compatible.
Closes #627.
Motivation: If crates are only built on one target, I'd be much more comfortable raising limits on a case-by-case basis (e.g. #608, #616). I would also be more comfortable adding more targets (i.e. not tier 1: #563), since specifying those targets would require setting
extra-targets
and thereby opting out of all others.Waiting on me to test that this actually works since we don't have unit tests for builds.Done..rustwide-docker
directory)build add-essential-files
)--target
for proc-macros (and in general, for the default build unlessdefault-target
is explicitly set) (build crate rstest 0.4.0
, testing for Missing docs for procedural macro crate #422)targets
behaves as documented (I only testedtargets = ["x86_64-pc-windows-msvc"]
and unsetdefault-target
; others are tested with unit tests)default-target
still only builds the default target once