}
}
- let mut build_config = BuildConfig::new(&opts.config.rustc()?.host, &opts.target);
+ let mut build_config = BuildConfig::new(&opts.config.rustc()?.host, &opts.target)?;
build_config.release = opts.release;
let mut cx = Context::new(
ws,
let jobs = jobs.or(cfg_jobs).unwrap_or(::num_cpus::get() as u32);
let cfg_target = config.get_string("build.target")?.map(|s| s.val);
let target = target.or(cfg_target);
- let mut base = ops::BuildConfig::new(&config.rustc()?.host, &target);
+ let mut base = ops::BuildConfig::new(&config.rustc()?.host, &target)?;
base.jobs = jobs;
base.host = scrape_target_config(config, &base.host_triple)?;
base.target = match target.as_ref() {
if let Some(triple) = triple {
path.push(Path::new(triple)
.file_stem()
- .ok_or_else(|| format_err!("target was empty"))?);
+ .ok_or_else(|| format_err!("invalid target"))?);
}
path.push(dest);
Layout::at(ws.config(), path)
}
impl BuildConfig {
- pub fn new(host_triple: &str, requested_target: &Option<String>) -> BuildConfig {
- BuildConfig {
+ pub fn new(host_triple: &str, requested_target: &Option<String>) -> CargoResult<BuildConfig> {
+ if let Some(ref s) = *requested_target {
+ if s.trim().is_empty() {
+ bail!("target was empty")
+ }
+ }
+ Ok(BuildConfig {
host_triple: host_triple.to_string(),
requested_target: (*requested_target).clone(),
jobs: 1,
..Default::default()
- }
+ })
}
}