-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: add cargo pkgid
support for cargo-script
#14961
base: master
Are you sure you want to change the base?
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
@@ -1800,7 +1800,10 @@ impl<'gctx> Packages<'gctx> { | |||
match self.packages.entry(key.to_path_buf()) { |
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 like this will be ambiguous when we add workspace support and will be hard to find. By working around this now, we are laying a trap for ourselves in the future.
Maybe we should have a refactor commit before this one that changes the key
from being the manifest-dir to being the manifest-path.
…ommand Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
6659d5f
to
d10f797
Compare
Signed-off-by: Rustin170506 <[email protected]>
d10f797
to
fc25d9d
Compare
cargo pkgid
support for cargo-scriptcargo pkgid
support for cargo-script
What does this PR try to resolve?
close #14831
In this PR, we added the
cargo pkgid
support 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