-use std::default::Default;
use std::fs;
use std::path::Path;
}
}
+ let mut build_config = BuildConfig::new(&opts.config.rustc()?.host, &opts.target);
+ build_config.release = opts.release;
let mut cx = Context::new(
ws,
&resolve,
&packages,
opts.config,
- BuildConfig {
- host_triple: opts.config.rustc()?.host.clone(),
- requested_target: opts.target.clone(),
- release: opts.release,
- jobs: 1,
- ..BuildConfig::default()
- },
+ build_config,
profiles,
None,
&units,
//!
use std::collections::{HashMap, HashSet};
-use std::default::Default;
use std::path::{Path, PathBuf};
use std::sync::Arc;
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 {
- host_triple: config.rustc()?.host.clone(),
- requested_target: target.clone(),
- jobs,
- ..Default::default()
- };
+ 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() {
Some(triple) => scrape_target_config(config, triple)?,
pub json_messages: bool,
}
+impl BuildConfig {
+ pub fn new(host_triple: &str, requested_target: &Option<String>) -> BuildConfig {
+ BuildConfig {
+ host_triple: host_triple.to_string(),
+ requested_target: (*requested_target).clone(),
+ jobs: 1,
+ ..Default::default()
+ }
+ }
+}
+
/// Information required to build for a target
#[derive(Clone, Default)]
pub struct TargetConfig {