Refator DependencyBuilder construction
This commit is contained in:
parent
9f9f19810f
commit
987702f6b9
@ -118,22 +118,23 @@ fn miri_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
|
|||||||
config.comment_defaults.base().add_custom("edition", Edition("2021".into()));
|
config.comment_defaults.base().add_custom("edition", Edition("2021".into()));
|
||||||
|
|
||||||
if with_dependencies {
|
if with_dependencies {
|
||||||
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
|
|
||||||
// (It's a separate crate, so we don't get an env var from cargo.)
|
|
||||||
let mut program = CommandBuilder::cargo();
|
|
||||||
program.program = {
|
|
||||||
let mut prog = miri_path();
|
|
||||||
prog.set_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX));
|
|
||||||
prog
|
|
||||||
};
|
|
||||||
let builder_args = ["miri", "run"]; // There is no `cargo miri build` so we just use `cargo miri run`.
|
|
||||||
program.args = builder_args.into_iter().map(Into::into).collect();
|
|
||||||
let crate_manifest_path = Path::new("test_dependencies").join("Cargo.toml");
|
|
||||||
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
|
|
||||||
program.envs.push(("RUSTFLAGS".into(), None));
|
|
||||||
config.comment_defaults.base().set_custom(
|
config.comment_defaults.base().set_custom(
|
||||||
"dependencies",
|
"dependencies",
|
||||||
DependencyBuilder { program, crate_manifest_path, build_std: None },
|
DependencyBuilder {
|
||||||
|
program: CommandBuilder {
|
||||||
|
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
|
||||||
|
// (It's a separate crate, so we don't get an env var from cargo.)
|
||||||
|
program: miri_path()
|
||||||
|
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
|
||||||
|
// There is no `cargo miri build` so we just use `cargo miri run`.
|
||||||
|
args: ["miri", "run"].into_iter().map(Into::into).collect(),
|
||||||
|
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
|
||||||
|
envs: vec![("RUSTFLAGS".into(), None)],
|
||||||
|
..CommandBuilder::cargo()
|
||||||
|
},
|
||||||
|
crate_manifest_path: Path::new("test_dependencies").join("Cargo.toml"),
|
||||||
|
build_std: None,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
config
|
config
|
||||||
|
Loading…
Reference in New Issue
Block a user