-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix: Allow embedded manifests in all commands #12289
Conversation
I originally centralized the error reporting until I realized it likely is intentionally not centralized so we report errors in terms of the arguments the user provided.
r? @ehuss (rustbot has picked a reviewer for you, use r? to override) |
There should be a later check when parsing but just in case, let's have a check here as well.
In 3a29410, we switched to anstream which doesn't seem to be locking properly (rust-lang/cargo#12289). For now, we are working around it. Fixes crate-ci#749
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.
Looks good. Just wanting more tests to cover these error paths.
let ext = path.extension(); | ||
ext.is_none() || ext == Some(OsStr::new("rs")) | ||
ext == Some(OsStr::new("rs")) || |
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.
- Should we always verify that embedded manifest is a file?
- Can we have some tests around this? Like failure when
script.rs
is a directory. - (Not a blocker) Is it worth having a better error message for each failed case?
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.
Should we always verify that embedded manifest is a file?
We have a separate, more specific error check for that.
(Not a blocker) Is it worth having a better error message for each failed case?
What do you have in mind?
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.
- When missing file at manifest-path, it shows
error: the manifest-path must be a path to a Cargo.toml file
- When
script.rs
is a directory, it showserror: failed to read `/projects/cargo/test.rs` Caused by: Is a directory (os error 21)
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.
When script.rs is a directory, it shows
This is true for Cargo.toml
as well. We can more generally improve it though that is unrelated to this PR
Thanks for the update! @bors r+ |
☀️ Test successful - checks-actions |
Update cargo 2 commits in dead4b8740c4b6a8ed5211e37c99cf81d01c3b1c..4cebd130ebca3bc219180a54f3e26cc1b14a91de 2023-06-20 20:07:17 +0000 to 2023-06-21 18:59:29 +0000 - fix: Allow embedded manifests in all commands (rust-lang/cargo#12289) - feat(cli): Support `cargo Cargo.toml` (rust-lang/cargo#12281) r? `@ghost`
In 3a29410, we switched to anstream which doesn't seem to be locking properly (rust-lang/cargo#12289). For now, we are working around it. Fixes crate-ci#749
What does this PR try to resolve?
This is a part of #12207.
One of the goals is for embedded manifests to be a first class citizen. If you have a script, you should be able to run tests on it, for example.
This expands the error check from just
Cargo.toml
to also single-file packages so you can use it in--manifest-path
.This, however, does mean that these can be used in places that likely won't work yet, like
cargo publish
.How should we test and review this PR?
By commit. We introduce tests for basic commands and then implement and refine the support for this.
Additional information
Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.