Remove --target option

This commit is contained in:
Guillaume Gomez 2023-11-24 22:05:08 +01:00
parent 970b2c7700
commit ff04316243
3 changed files with 11 additions and 36 deletions

View File

@ -43,22 +43,6 @@ impl BuildArg {
Self::usage();
return Ok(None);
}
"--target-triple" => {
if args.next().is_some() {
// Handled in config.rs.
} else {
return Err(
"Expected a value after `--target-triple`, found nothing".to_string()
);
}
}
"--target" => {
if args.next().is_some() {
// Handled in config.rs.
} else {
return Err("Expected a value after `--target`, found nothing".to_string());
}
}
arg => {
if !build_arg.config_info.parse_argument(arg, &mut args)? {
return Err(format!("Unknown argument `{}`", arg));
@ -152,7 +136,7 @@ fn build_sysroot_inner(
&"cargo",
&"build",
&"--target",
&config.target,
&config.target_triple,
&"--release",
],
Some(start_dir),
@ -160,13 +144,10 @@ fn build_sysroot_inner(
)?;
"release"
} else {
env.insert(
"RUSTFLAGS".to_string(),
rustflags,
);
env.insert("RUSTFLAGS".to_string(), rustflags);
run_command_with_output_and_env(
&[&"cargo", &"build", &"--target", &config.target],
&[&"cargo", &"build", &"--target", &config.target_triple],
Some(start_dir),
Some(&env),
)?;

View File

@ -4,7 +4,6 @@ use std::env as std_env;
#[derive(Default)]
pub struct ConfigInfo {
pub target: String,
pub target_triple: String,
pub host_triple: String,
pub rustc_command: Vec<String>,
@ -31,10 +30,6 @@ impl ConfigInfo {
)
}
},
"--target" => match args.next() {
Some(arg) if !arg.is_empty() => self.target = arg.to_string(),
_ => return Err("Expected a value after `--target`, found nothing".to_string()),
},
"--out-dir" => match args.next() {
Some(arg) if !arg.is_empty() => {
// env.insert("CARGO_TARGET_DIR".to_string(), arg.to_string());
@ -83,12 +78,6 @@ impl ConfigInfo {
};
self.host_triple = rustc_version_info(Some(&rustc))?.host.unwrap_or_default();
if !self.target_triple.is_empty() && self.target.is_empty() {
self.target = self.target_triple.clone();
}
if self.target.is_empty() {
self.target = self.host_triple.clone();
}
if self.target_triple.is_empty() {
self.target_triple = self.host_triple.clone();
}
@ -223,7 +212,6 @@ impl ConfigInfo {
pub fn show_usage() {
println!(
"\
--target [arg] : Set the target to [arg]
--target-triple [arg] : Set the target triple to [arg]
--out-dir : Location where the files will be generated
--release-sysroot : Build sysroot in release mode

View File

@ -750,7 +750,10 @@ fn extended_regex_example_tests(env: &Env, args: &TestArg) -> Result<(), String>
println!("[TEST] rust-lang/regex example shootout-regex-dna");
let mut env = env.clone();
// newer aho_corasick versions throw a deprecation warning
let rustflags = format!("{} --cap-lints warn", env.get("RUSTFLAGS").cloned().unwrap_or_default());
let rustflags = format!(
"{} --cap-lints warn",
env.get("RUSTFLAGS").cloned().unwrap_or_default()
);
env.insert("RUSTFLAGS".to_string(), rustflags);
// Make sure `[codegen mono items] start` doesn't poison the diff
run_cargo_command(
@ -799,7 +802,10 @@ fn extended_regex_tests(env: &Env, args: &TestArg) -> Result<(), String> {
println!("[TEST] rust-lang/regex tests");
let mut env = env.clone();
// newer aho_corasick versions throw a deprecation warning
let rustflags = format!("{} --cap-lints warn", env.get("RUSTFLAGS").cloned().unwrap_or_default());
let rustflags = format!(
"{} --cap-lints warn",
env.get("RUSTFLAGS").cloned().unwrap_or_default()
);
env.insert("RUSTFLAGS".to_string(), rustflags);
run_cargo_command(
&[