use core::{Package, PackageId, Target, TargetKind};
use util::{self, join_paths, process, CargoResult, Config, ProcessBuilder};
+use super::BuildContext;
/// A structure returning the result of a compilation.
pub struct Compilation<'cfg> {
}
impl<'cfg> Compilation<'cfg> {
- pub fn new(config: &'cfg Config, rustc_process: ProcessBuilder) -> Compilation<'cfg> {
+ pub fn new<'a>(bcx: &BuildContext<'a, 'cfg>) -> Compilation<'cfg> {
Compilation {
libraries: HashMap::new(),
native_dirs: BTreeSet::new(), // TODO: deprecated, remove
root_output: PathBuf::from("/"),
deps_output: PathBuf::from("/"),
host_deps_output: PathBuf::from("/"),
- host_dylib_path: None,
- target_dylib_path: None,
+ host_dylib_path: bcx.host_info.sysroot_libdir.clone(),
+ target_dylib_path: bcx.target_info.sysroot_libdir.clone(),
tests: Vec::new(),
binaries: Vec::new(),
extra_env: HashMap::new(),
to_doc_test: Vec::new(),
cfgs: HashMap::new(),
rustdocflags: HashMap::new(),
- config,
- rustc_process,
- host: String::new(),
- target: String::new(),
+ config: bcx.config,
+ rustc_process: bcx.build_config.rustc.process(),
+ host: bcx.build_config.host_triple().to_string(),
+ target: bcx.build_config.target_triple().to_string(),
target_runner: LazyCell::new(),
}
}
.chain_err(|| "failed to create jobserver")?,
};
- let mut compilation = Compilation::new(config, bcx.build_config.rustc.process());
- compilation.host_dylib_path = bcx.host_info.sysroot_libdir.clone();
- compilation.target_dylib_path = bcx.target_info.sysroot_libdir.clone();
Ok(Self {
bcx,
- compilation,
+ compilation: Compilation::new(bcx),
build_state: Arc::new(BuildState::new(
&bcx.build_config.host,
&bcx.build_config.target,
self.compilation.native_dirs.insert(dir.clone());
}
}
- self.compilation.host = self.bcx.build_config.host_triple().to_string();
- self.compilation.target = self.bcx.build_config.target_triple().to_string();
Ok(self.compilation)
}