-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Consider public dependencies when choosing a version in cargo add (#1… #15966
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
base: master
Are you sure you want to change the base?
Changes from all commits
20f6b2a
2a9f9ac
75768e0
bd1029e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cargo-features = ["public-dependency"] | ||
[workspace] | ||
|
||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" | ||
edition = "2015" | ||
|
||
[dependencies] | ||
my-package = "0.1.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crate::prelude::*; | ||
use cargo_test_support::Project; | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::current_dir; | ||
use cargo_test_support::file; | ||
use cargo_test_support::registry::Dependency; | ||
use cargo_test_support::str; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
cargo_test_support::registry::init(); | ||
cargo_test_support::registry::Package::new("my-package-dep", "0.1.0").publish(); | ||
cargo_test_support::registry::Package::new("my-package-dep", "0.2.0").publish(); | ||
cargo_test_support::registry::Package::new("my-package", "0.1.0") | ||
.add_dep(Dependency::new("my-package-dep", "0.1.0").public(true)) | ||
.publish(); | ||
cargo_test_support::registry::Package::new("my-package", "0.2.0") | ||
.add_dep(Dependency::new("my-package-dep", "0.2.0").public(true)) | ||
.publish(); | ||
let project = Project::from_template(current_dir!().join("in")); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("add") | ||
.arg_line("my-package-dep") | ||
.current_dir(cwd) | ||
.masquerade_as_nightly_cargo(&["public-dependency"]) | ||
.assert() | ||
.success() | ||
.stdout_eq(str![""]) | ||
.stderr_eq(file!["stderr.term.svg"]); | ||
|
||
assert_ui().subset_matches(current_dir!().join("out"), &project_root); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cargo-features = ["public-dependency"] | ||
[workspace] | ||
|
||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" | ||
edition = "2015" | ||
|
||
[dependencies] | ||
my-package = "0.1.0" | ||
my-package-dep = "^0.1.0" |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By resolving before Adding, the output becomes unclear where the locking ends and the manifest editing begins Since this is unstable, we could possibly punt on this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Someone also suggested trying to read the lockfile rather than doing a full resolve when possible, but yeah I think this might just be an area for further improvement. |
Uh oh!
There was an error while loading. Please reload this page.