use cargo::ops::cargo_add::AddOptions;
use cargo::ops::cargo_add::DepOp;
use cargo::ops::cargo_add::DepTable;
+use cargo::ops::resolve_ws;
use cargo::util::command_prelude::*;
use cargo::util::interning::InternedString;
use cargo::CargoResult;
};
add(&ws, &options)?;
+ if !dry_run {
+ // Reload the workspace since we've changed dependencies
+ let ws = args.workspace(config)?;
+ resolve_ws(&ws)?;
+ }
+
Ok(())
}
Updating git repository `[ROOTURL]/git-package`
Adding git-package (git) to dependencies.
+ Updating git repository `[ROOTURL]/git-package`
Updating git repository `[ROOTURL]/git-package`
Adding git-package (git) to dependencies.
+ Updating git repository `[ROOTURL]/git-package`
Updating git repository `[ROOTURL]/git-package`
Adding git-package (git) to dev-dependencies.
+ Updating git repository `[ROOTURL]/git-package`
Updating git repository `[ROOTURL]/git-package`
Updating git repository `[ROOTURL]/git-package`
Adding git-package (git) to dependencies.
+ Updating git repository `[ROOTURL]/git-package`
Updating git repository `[ROOTURL]/git-package`
Adding my-package1 (git) to dependencies.
Adding my-package2 (git) to dependencies.
+ Updating git repository `[ROOTURL]/git-package`
])
.current_dir(cwd)
.assert()
- .success()
+ .failure()
.stdout_matches_path(curr_dir!().join("stdout.log"))
.stderr_matches_path(curr_dir!().join("stderr.log"));
Updating git repository `[ROOTURL]/versioned-package`
Adding versioned-package (git) to dependencies.
+error: failed to parse manifest at `[ROOT]/case/Cargo.toml`
+
+Caused by:
+ dependency (versioned-package) specification is ambiguous. Only one of `git` or `registry` is allowed.
Updating git repository `[ROOTURL]/git-package`
Adding git-package (git) to dependencies.
+ Updating git repository `[ROOTURL]/git-package`
Updating git repository `[ROOTURL]/git-package`
Adding git-package (git) to dependencies.
+ Updating git repository `[ROOTURL]/git-package`
+ nose
- eyes
- optional-dependency
+ Updating `dummy-registry` index
- mouth
- nose
- optional-dependency
+ Updating `dummy-registry` index
--- /dev/null
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "cargo-list-test-fixture"
+version = "0.0.0"
+dependencies = [
+ "my-package",
+]
+
+[[package]]
+name = "my-package"
+version = "99999.0.0+my-package"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62c45acf9e11d2f97f5b318143219c0b4102eafef1c22a4b545b47104691d915"
--- /dev/null
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "cargo-list-test-fixture"
+version = "0.0.0"
+dependencies = [
+ "my-package",
+ "unrelateed-crate",
+]
+
+[[package]]
+name = "unrelateed-crate"
+version = "0.2.0+my-package"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "266de4849a570b5dfda5e8e082a2aff885e9d2d4965dae8f8b6c8535e1ec731f"
--- /dev/null
+[workspace]
+
+[package]
+name = "cargo-list-test-fixture"
+version = "0.0.0"
+
+[dependencies]
+unrelateed-crate = "0.2.0"
--- /dev/null
+use cargo_test_support::compare::assert_ui;
+use cargo_test_support::prelude::*;
+use cargo_test_support::Project;
+
+use crate::cargo_add::init_registry;
+use cargo_test_support::curr_dir;
+
+#[cargo_test]
+fn lockfile_updated() {
+ init_registry();
+ let project = Project::from_template(curr_dir!().join("in"));
+ let project_root = project.root();
+ let cwd = &project_root;
+
+ snapbox::cmd::Command::cargo_ui()
+ .arg("add")
+ .arg_line("my-package")
+ .current_dir(cwd)
+ .assert()
+ .success()
+ .stdout_matches_path(curr_dir!().join("stdout.log"))
+ .stderr_matches_path(curr_dir!().join("stderr.log"));
+
+ assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
+}
--- /dev/null
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "cargo-list-test-fixture"
+version = "0.0.0"
+dependencies = [
+ "my-package",
+ "unrelateed-crate",
+]
+
+[[package]]
+name = "my-package"
+version = "99999.0.0+my-package"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62c45acf9e11d2f97f5b318143219c0b4102eafef1c22a4b545b47104691d915"
+
+[[package]]
+name = "unrelateed-crate"
+version = "0.2.0+my-package"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "266de4849a570b5dfda5e8e082a2aff885e9d2d4965dae8f8b6c8535e1ec731f"
--- /dev/null
+[workspace]
+
+[package]
+name = "cargo-list-test-fixture"
+version = "0.0.0"
+
+[dependencies]
+my-package = "99999.0.0"
+unrelateed-crate = "0.2.0"
--- /dev/null
+ Updating `dummy-registry` index
+ Adding my-package v99999.0.0 to dependencies.
mod list_features_path_no_default;
mod locked_changed;
mod locked_unchanged;
+mod lockfile_updated;
mod manifest_path_package;
mod merge_activated_features;
mod multiple_conflicts_with_features;
cargo_test_support::registry::Package::new(name, "0.1.1+my-package")
.alternative(alt)
.publish();
+ cargo_test_support::registry::Package::new(name, "0.2.0+my-package")
+ .alternative(alt)
+ .publish();
cargo_test_support::registry::Package::new(name, "0.2.3+my-package")
.alternative(alt)
.publish();
Updating git repository `[ROOTURL]/versioned-package`
Adding versioned-package (git) to optional dependencies.
+ Updating git repository `[ROOTURL]/versioned-package`