(manifest: &BuildManifest)
| 311 | entry: manifest.entry.clone(), |
| 312 | stdlib: manifest.stdlib, |
| 313 | import_closure: manifest.import_closure, |
| 314 | root: manifest.root.name().to_owned(), |
| 315 | extra_objects: manifest |
| 316 | .extra_objects |
| 317 | .iter() |
| 318 | .map(|object| object.name.clone()) |
| 319 | .collect(), |
| 320 | abi_exports: manifest.abi_exports.clone(), |
| 321 | has_source_prelude: manifest.source_prelude.is_some(), |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | pub fn build(manifest: &BuildManifest) -> Result<BuildArtifacts, BuildError> { |
| 326 | let plan = Self::plan(manifest); |
| 327 | let mut units: Vec<BuiltUnit> = Vec::new(); |
| 328 | |
| 329 | for (name, assembled) in Self::compile_stdlib(manifest)? { |
| 330 | units.push(BuiltUnit { name, assembled }); |
| 331 | } |
| 332 | |
| 333 | for object in &manifest.extra_objects { |
| 334 | units.push(BuiltUnit { |
| 335 | name: object.name.clone(), |
| 336 | assembled: object.assembled.clone(), |
| 337 | }); |
| 338 | } |
| 339 | |
| 340 | let root = manifest.root.load()?; |
| 341 | let mut pipeline = Self::pipeline_for(manifest); |
| 342 | pipeline.set_current_source_path(root.source_path.clone()); |
| 343 | |
| 344 | match manifest.import_closure { |
| 345 | ImportClosurePolicy::Enabled { mangle_symbols } => { |
| 346 | pipeline.set_module_mangling(mangle_symbols); |
| 347 | for (name, mut assembled) in pipeline |
| 348 | .compile_program_closure(&root.name, &root.source) |
| 349 | .map_err(BuildError::Compile)? |
| 350 | { |
| 351 | if name == root.name { |
| 352 | Self::mark_abi_exports(manifest, &mut assembled); |
| 353 | } |
| 354 | units.push(BuiltUnit { name, assembled }); |
| 355 | } |
| 356 | } |
| 357 | ImportClosurePolicy::Disabled => { |
| 358 | let mut root_unit = Self::compile_one(&mut pipeline, &root)?; |
| 359 | Self::mark_abi_exports(manifest, &mut root_unit.assembled); |
| 360 | units.push(root_unit); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | let modules: Vec<(&str, &AssembledOutput)> = units |
| 365 | .iter() |
| 366 | .map(|unit| (unit.name.as_str(), &unit.assembled)) |
| 367 | .collect(); |
| 368 | let link_pipeline = Self::pipeline_for(manifest); |
| 369 | let linked = link_pipeline |
nothing calls this directly
no test coverage detected