mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 04:51:31 +00:00
Auto merge of #5874 - japaric:revert-revert-gh5606, r=alexcrichton
make `cargo install` ignore .cargo/config closes #5850 r? @alexcrichton
This commit is contained in:
commit
78bae459fe
|
@ -75,6 +75,11 @@ continuous integration systems.",
|
|||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
let mut compile_opts = args.compile_options(config, CompileMode::Build)?;
|
||||
|
||||
// for `cargo-install` we want to use what the user specified via `--target` and ignore what's
|
||||
// in `.cargo/config` and what the environment says
|
||||
compile_opts.build_config.requested_target = args.target();
|
||||
|
||||
compile_opts.build_config.release = !args.is_present("debug");
|
||||
|
||||
let krates = args.values_of("crate")
|
||||
|
|
|
@ -100,7 +100,7 @@ check-revoke = true # Indicates whether SSL certs are checked for revocation
|
|||
jobs = 1 # number of parallel jobs, defaults to # of CPUs
|
||||
rustc = "rustc" # the rust compiler tool
|
||||
rustdoc = "rustdoc" # the doc generator tool
|
||||
target = "triple" # build for the target triple
|
||||
target = "triple" # build for the target triple (ignored by `cargo install`)
|
||||
target-dir = "target" # path of where to place all generated artifacts
|
||||
rustflags = ["..", ".."] # custom flags to pass to all compiler invocations
|
||||
incremental = true # whether or not to enable incremental compilation
|
||||
|
|
|
@ -1237,3 +1237,31 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina
|
|||
",
|
||||
).run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn install_ignores_cargo_config() {
|
||||
pkg("bar", "0.0.1");
|
||||
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
".cargo/config",
|
||||
r#"
|
||||
[build]
|
||||
target = "non-existing-target"
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
cargo_process("install bar").cwd(p.root()).with_status(0).run();
|
||||
assert_has_installed_exe(cargo_home(), "bar");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue