Merge commit '3187d32079
' into subtree-update
This commit is contained in:
commit
325b70890a
42 changed files with 943 additions and 365 deletions
|
@ -24,16 +24,6 @@ impl BuildArg {
|
|||
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--features" => {
|
||||
if let Some(arg) = args.next() {
|
||||
build_arg.flags.push("--features".to_string());
|
||||
build_arg.flags.push(arg.as_str().into());
|
||||
} else {
|
||||
return Err(
|
||||
"Expected a value after `--features`, found nothing".to_string()
|
||||
);
|
||||
}
|
||||
}
|
||||
"--sysroot" => {
|
||||
build_arg.build_sysroot = true;
|
||||
}
|
||||
|
@ -56,7 +46,6 @@ impl BuildArg {
|
|||
r#"
|
||||
`build` command help:
|
||||
|
||||
--features [arg] : Add a new feature [arg]
|
||||
--sysroot : Build with sysroot"#
|
||||
);
|
||||
ConfigInfo::show_usage();
|
||||
|
@ -142,14 +131,11 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
|
|||
rustflags.push_str(" -Csymbol-mangling-version=v0");
|
||||
}
|
||||
|
||||
let mut args: Vec<&dyn AsRef<OsStr>> = vec![
|
||||
&"cargo",
|
||||
&"build",
|
||||
&"--target",
|
||||
&config.target,
|
||||
&"--features",
|
||||
&"compiler-builtins-no-f16-f128",
|
||||
];
|
||||
let mut args: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &"build", &"--target", &config.target];
|
||||
for feature in &config.features {
|
||||
args.push(&"--features");
|
||||
args.push(feature);
|
||||
}
|
||||
|
||||
if config.no_default_features {
|
||||
rustflags.push_str(" -Csymbol-mangling-version=v0");
|
||||
|
|
|
@ -98,7 +98,7 @@ impl ConfigFile {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct ConfigInfo {
|
||||
pub target: String,
|
||||
pub target_triple: String,
|
||||
|
@ -123,6 +123,7 @@ pub struct ConfigInfo {
|
|||
pub no_download: bool,
|
||||
pub no_default_features: bool,
|
||||
pub backend: Option<String>,
|
||||
pub features: Vec<String>,
|
||||
}
|
||||
|
||||
impl ConfigInfo {
|
||||
|
@ -133,6 +134,13 @@ impl ConfigInfo {
|
|||
args: &mut impl Iterator<Item = String>,
|
||||
) -> Result<bool, String> {
|
||||
match arg {
|
||||
"--features" => {
|
||||
if let Some(arg) = args.next() {
|
||||
self.features.push(arg);
|
||||
} else {
|
||||
return Err("Expected a value after `--features`, found nothing".to_string());
|
||||
}
|
||||
}
|
||||
"--target" => {
|
||||
if let Some(arg) = args.next() {
|
||||
self.target = arg;
|
||||
|
@ -443,6 +451,7 @@ impl ConfigInfo {
|
|||
pub fn show_usage() {
|
||||
println!(
|
||||
"\
|
||||
--features [arg] : Add a new feature [arg]
|
||||
--target-triple [arg] : Set the target triple to [arg]
|
||||
--target [arg] : Set the target to [arg]
|
||||
--out-dir : Location where the files will be generated
|
||||
|
|
|
@ -92,6 +92,7 @@ struct TestArg {
|
|||
current_part: Option<usize>,
|
||||
sysroot_panic_abort: bool,
|
||||
config_info: ConfigInfo,
|
||||
sysroot_features: Vec<String>,
|
||||
}
|
||||
|
||||
impl TestArg {
|
||||
|
@ -127,6 +128,14 @@ impl TestArg {
|
|||
"--sysroot-panic-abort" => {
|
||||
test_arg.sysroot_panic_abort = true;
|
||||
}
|
||||
"--sysroot-features" => match args.next() {
|
||||
Some(feature) if !feature.is_empty() => {
|
||||
test_arg.sysroot_features.push(feature);
|
||||
}
|
||||
_ => {
|
||||
return Err(format!("Expected an argument after `{}`, found nothing", arg));
|
||||
}
|
||||
},
|
||||
"--help" => {
|
||||
show_usage();
|
||||
return Ok(None);
|
||||
|
@ -250,7 +259,9 @@ fn mini_tests(env: &Env, args: &TestArg) -> Result<(), String> {
|
|||
fn build_sysroot(env: &Env, args: &TestArg) -> Result<(), String> {
|
||||
// FIXME: create a function "display_if_not_quiet" or something along the line.
|
||||
println!("[BUILD] sysroot");
|
||||
build::build_sysroot(env, &args.config_info)?;
|
||||
let mut config = args.config_info.clone();
|
||||
config.features.extend(args.sysroot_features.iter().cloned());
|
||||
build::build_sysroot(env, &config)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -626,7 +637,8 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
|
|||
"https://github.com/BurntSushi/memchr",
|
||||
"https://github.com/dtolnay/itoa",
|
||||
"https://github.com/rust-lang/cfg-if",
|
||||
"https://github.com/rust-lang-nursery/lazy-static.rs",
|
||||
//"https://github.com/rust-lang-nursery/lazy-static.rs", // TODO: re-enable when the
|
||||
//failing test is fixed upstream.
|
||||
//"https://github.com/marshallpierce/rust-base64", // FIXME: one test is OOM-killed.
|
||||
// TODO: ignore the base64 test that is OOM-killed.
|
||||
"https://github.com/time-rs/time",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue