mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
parent
592b253634
commit
d1ef031a62
@ -224,7 +224,14 @@ fn install_one(
|
||||
Some(Filesystem::new(config.cwd().join("target-install")))
|
||||
};
|
||||
|
||||
let ws = Workspace::ephemeral(pkg, config, overidden_target_dir, false)?;
|
||||
let ws = match overidden_target_dir {
|
||||
Some(dir) => Workspace::ephemeral(pkg, config, Some(dir), false)?,
|
||||
None => {
|
||||
let mut ws = Workspace::new(pkg.manifest_path(), config)?;
|
||||
ws.set_require_optional_deps(false);
|
||||
ws
|
||||
}
|
||||
};
|
||||
let pkg = ws.current()?;
|
||||
|
||||
if from_cwd {
|
||||
|
@ -1641,3 +1641,47 @@ fn git_repo_replace() {
|
||||
.contains(&format!("{}", new_rev))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn workspace_uses_workspace_target_dir() {
|
||||
let p = project("foo")
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
bar = { path = 'bar' }
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.file(
|
||||
"bar/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "bar"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
"#,
|
||||
)
|
||||
.file("bar/src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
assert_that(p.cargo("build").cwd(p.root().join("bar")).arg("--release"),
|
||||
execs().with_status(0));
|
||||
assert_that(
|
||||
cargo_process("install").arg("--path").arg(p.root().join("bar")),
|
||||
execs().with_status(0).with_stderr(
|
||||
"[INSTALLING] [..]
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] [..]
|
||||
warning: be sure to add `[..]` to your PATH to be able to run the installed binaries
|
||||
",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user