|
6 | 6 | //! The [`compile`] function will do all the work to compile a workspace. A
|
7 | 7 | //! rough outline is:
|
8 | 8 | //!
|
9 |
| -//! - Resolve the dependency graph (see [`ops::resolve`]). |
10 |
| -//! - Download any packages needed (see [`PackageSet`](crate::core::PackageSet)). |
11 |
| -//! - Generate a list of top-level "units" of work for the targets the user |
| 9 | +//! 1. Resolve the dependency graph (see [`ops::resolve`]). |
| 10 | +//! 2. Download any packages needed (see [`PackageSet`](crate::core::PackageSet)). |
| 11 | +//! 3. Generate a list of top-level "units" of work for the targets the user |
12 | 12 | //! requested on the command-line. Each [`Unit`] corresponds to a compiler
|
13 | 13 | //! invocation. This is done in this module ([`UnitGenerator::generate_root_units`]).
|
14 |
| -//! - Build the graph of `Unit` dependencies (see [`unit_dependencies`]). |
15 |
| -//! - Create a [`Context`] which will perform the following steps: |
16 |
| -//! - Prepare the `target` directory (see [`Layout`]). |
17 |
| -//! - Create a job queue (see `JobQueue`). The queue checks the |
| 14 | +//! 4. Starting from the root [`Unit`]s, generate the [`UnitGraph`] by walking the dependency graph |
| 15 | +//! from the resolver. See also [`unit_dependencies`]. |
| 16 | +//! 5. Construct the [`BuildContext`] with all of the information collected so |
| 17 | +//! far. This is the end of the "front end" of compilation. |
| 18 | +//! 6. Create a [`Context`] which oordinates the compilation process a |
| 19 | +//! and will perform the following steps: |
| 20 | +//! 1. Prepare the `target` directory (see [`Layout`]). |
| 21 | +//! 2. Create a [`JobQueue`]. The queue checks the |
18 | 22 | //! fingerprint of each `Unit` to determine if it should run or be
|
19 | 23 | //! skipped.
|
20 |
| -//! - Execute the queue. Each leaf in the queue's dependency graph is |
21 |
| -//! executed, and then removed from the graph when finished. This |
22 |
| -//! repeats until the queue is empty. |
| 24 | +//! 3. Execute the queue via [`drain_the_queue`]. Each leaf in the queue's dependency graph is |
| 25 | +//! executed, and then removed from the graph when finished. This repeats until the queue is |
| 26 | +//! empty. Note that this is the only point in cargo that currently uses threads. |
| 27 | +//! 7. The result of the compilation is stored in the [`Compilation`] struct. This can be used for |
| 28 | +//! various things, such as running tests after the compilation has finished. |
23 | 29 | //!
|
24 | 30 | //! **Note**: "target" inside this module generally refers to ["Cargo Target"],
|
25 | 31 | //! which corresponds to artifact that will be built in a package. Not to be
|
26 | 32 | //! confused with target-triple or target architecture.
|
27 | 33 | //!
|
28 | 34 | //! [`unit_dependencies`]: crate::core::compiler::unit_dependencies
|
29 | 35 | //! [`Layout`]: crate::core::compiler::Layout
|
| 36 | +//! [`JobQueue`]: crate::core::compiler::job_queue |
| 37 | +//! [`drain_the_queue`]: crate::core::compiler::job_queue |
30 | 38 | //! ["Cargo Target"]: https://doc.rust-lang.org/nightly/cargo/reference/cargo-targets.html
|
31 | 39 |
|
32 | 40 | use std::collections::{HashMap, HashSet};
|
|
0 commit comments