feat: add cargo pkgid support for cargo-script#14961
Conversation
73e3975 to
3e3383a
Compare
|
Another test we'll need is that we error when a cargo script is specified as a dependency which might become possible with this change. |
3022d26 to
44ded93
Compare
Do you mean by |
|
I mean [package]
name = "foo"
[dependencies]
bar.path = "bar.rs" |
This comment has been minimized.
This comment has been minimized.
|
I just did a really rough commit to prove the idea here. It seems to work. But the code is totally messed up. I want to check two things with you before I move forward and improve the code.
|
The RFC says
cargo/src/cargo/util/toml/embedded.rs Line 115 in 0499e31 cargo/src/cargo/util/toml/embedded.rs Lines 147 to 176 in 0499e31 |
// FIXME: It should be `path+[ROOTURL]/foo#[email protected]`.
p.cargo("-Zscript pkgid --manifest-path script.rs")
.masquerade_as_nightly_cargo(&["script"])
.with_stdout_data(str![[r#"
path+[ROOTURL]/foo#[email protected]
"#]])this should instead be // FIXME: It should be `path+[ROOTURL]/foo/script.rs#0.0.0`.
p.cargo("-Zscript pkgid --manifest-path script.rs")
.masquerade_as_nightly_cargo(&["script"])
.with_stdout_data(str![[r#"
path+[ROOTURL]/foo/script.rs#0.0.0
"#]])according to #14831 (comment) Switching to that scheme should simplify the code, not requiring updates to |
Oh, I misunderstood
Yes. Got it. |
So I guess if the package name is foo, then we have: path+[ROOTURL]/foo/script.rs#foo@0.0.0 |
If the user explicitly overrode it, yes |
c10754e to
6659d5f
Compare
…ommand Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
d10f797 to
fc25d9d
Compare
Signed-off-by: Rustin170506 <[email protected]> fix
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
183eeff to
1d960c7
Compare
0xPoe
left a comment
There was a problem hiding this comment.
🔢 Self-check (PR reviewed by myself and ready for feedback.)
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
b8aac6b to
9fe45b2
Compare
|
Thanks! |
|
Thanks for your review! 💚 💙 💜 💛 ❤️ |
Update cargo 14 commits in 0e3d73849ab8cbbab3ec5c65cbd555586cb21339..2928e32734b04925ee51e1ae88bea9a83d2fd451 2025-02-01 20:14:40 +0000 to 2025-02-07 16:50:22 +0000 - Simplify backtrack (rust-lang/cargo#15150) - Don't use on Solaris libc::LOCK_* which were removed from libc in ver… (rust-lang/cargo#15143) - feat: emit error if package not found within workspace (rust-lang/cargo#15071) - Make cache tracking resilient to unexpected files (rust-lang/cargo#15147) - Small resolver cleanups (rust-lang/cargo#15040) - feat: add `cargo pkgid` support for cargo-script (rust-lang/cargo#14961) - Suggest similar feature names on CLI (rust-lang/cargo#15133) - fix: Don't use "did you mean" in errors (rust-lang/cargo#15138) - Fix changelog link (rust-lang/cargo#15142) - chore(deps): update rust crate rand to 0.9.0 (rust-lang/cargo#15129) - Remove the original changelog (rust-lang/cargo#15123) - chore(deps): update rust crate gix to 0.70.0 (rust-lang/cargo#15128) - allow windows reserved names in CI (rust-lang/cargo#15135) - removed a word that was repeated (rust-lang/cargo#15136)
This might have also broken dependencies whose path ends with `.rs` as well This broke in rust-lang#14961
…st-lang#15240) ### What does this PR try to resolve? This likely only affects `-Zpackage-workspace` but it might have also broken dependencies whose path ends with `.rs` as well This broke in rust-lang#14961 ### How should we test and review this PR? ### Additional information
What does this PR try to resolve?
close #14831
In this PR, we added the
cargo pkgidsupport for the cargo-script.For the package itself:
For its dependence:
How should we test and review this PR?
I have updated the unit tests and also added more test cases for it.
Additional information
None