use core::{Package, Source, Target};
use core::{PackageId, PackageIdSpec, Profile, Profiles, TargetKind, Workspace};
use core::resolver::{Method, Resolve};
-use ops::{self, BuildOutput, Context, DefaultExecutor, Executor};
+use ops::{self, BuildOutput, Context, DefaultExecutor, Executor, Kind, Unit};
use util::config::Config;
use util::{profile, CargoResult, CargoResultExt};
build_config,
profiles,
)?;
- cx.compile(&package_targets, export_dir.clone(), &exec)?
+ let units = package_targets
+ .iter()
+ .flat_map(|&(pkg, ref targets)| {
+ let default_kind = if cx.build_config.requested_target.is_some() {
+ Kind::Target
+ } else {
+ Kind::Host
+ };
+ targets.iter().map(move |&(target, profile)| Unit {
+ pkg,
+ target,
+ profile,
+ kind: if target.for_host() {
+ Kind::Host
+ } else {
+ default_kind
+ },
+ })
+ })
+ .collect::<Vec<_>>();
+ cx.compile(&units, export_dir.clone(), &exec)?
};
ret.to_doc_test = to_builds.into_iter().cloned().collect();
use super::job_queue::JobQueue;
use super::layout::Layout;
use super::links::Links;
-use super::{BuildConfig, Compilation, Executor, Kind, PackagesToBuild};
+use super::{BuildConfig, Compilation, Executor, Kind};
mod unit_dependencies;
use self::unit_dependencies::build_unit_dependencies;
// where the compiled libraries are all located.
pub fn compile(
mut self,
- pkg_targets: &'a PackagesToBuild<'a>,
+ units: &[Unit<'a>],
export_dir: Option<PathBuf>,
exec: &Arc<Executor>,
) -> CargoResult<Compilation<'cfg>> {
- let units = pkg_targets
- .iter()
- .flat_map(|&(pkg, ref targets)| {
- let default_kind = if self.build_config.requested_target.is_some() {
- Kind::Target
- } else {
- Kind::Host
- };
- targets.iter().map(move |&(target, profile)| Unit {
- pkg,
- target,
- profile,
- kind: if target.for_host() {
- Kind::Host
- } else {
- default_kind
- },
- })
- })
- .collect::<Vec<_>>();
-
let mut queue = JobQueue::new(&self);
- self.prepare_units(export_dir, &units)?;
+ self.prepare_units(export_dir, units)?;
self.prepare()?;
self.build_used_in_plugin_map(&units)?;
custom_build::build_map(&mut self, &units)?;
use same_file::is_same_file;
use serde_json;
-use core::{Feature, Package, PackageId, Profile, Target};
+use core::{Feature, PackageId, Profile, Target};
use core::manifest::Lto;
use core::shell::ColorChoice;
use util::{self, machine_message, ProcessBuilder};
pub overrides: HashMap<String, BuildOutput>,
}
-pub type PackagesToBuild<'a> = [(&'a Package, Vec<(&'a Target, &'a Profile)>)];
-
/// A glorified callback for executing calls to rustc. Rather than calling rustc
/// directly, we'll use an Executor, giving clients an opportunity to intercept
/// the build calls.