|
1 |
| -//! Cargo `compile` currently does the following steps. |
| 1 | +//! The Cargo "compile" operation. |
2 | 2 | //!
|
3 |
| -//! All configurations are already injected as environment variables via the |
4 |
| -//! main cargo command. |
| 3 | +//! This module contains the entry point for starting the compilation process |
| 4 | +//! for commands like `build`, `test`, `doc`, `rustc`, etc. |
5 | 5 | //!
|
6 |
| -//! 1. Read the manifest. |
7 |
| -//! 2. Shell out to `cargo-resolve` with a list of dependencies and sources as |
8 |
| -//! stdin. |
| 6 | +//! The `compile` function will do all the work to compile a workspace. A |
| 7 | +//! rough outline is: |
9 | 8 | //!
|
10 |
| -//! a. Shell out to `--do update` and `--do list` for each source. |
11 |
| -//! b. Resolve dependencies and return a list of name/version/source. |
12 |
| -//! |
13 |
| -//! 3. Shell out to `--do download` for each source. |
14 |
| -//! 4. Shell out to `--do get` for each source, and build up the list of paths |
15 |
| -//! to pass to `rustc -L`. |
16 |
| -//! 5. Call `cargo-rustc` with the results of the resolver zipped together with |
17 |
| -//! the results of the `get`. |
18 |
| -//! |
19 |
| -//! a. Topologically sort the dependencies. |
20 |
| -//! b. Compile each dependency in order, passing in the -L's pointing at each |
21 |
| -//! previously compiled dependency. |
| 9 | +//! - Resolve the dependency graph (see `ops::resolve`). |
| 10 | +//! - Download any packages needed (see `PackageSet`). |
| 11 | +//! - Generate a list of top-level "units" of work for the targets the user |
| 12 | +//! requested on the command-line. Each `Unit` corresponds to a compiler |
| 13 | +//! invocation. This is done in this module (`generate_targets`). |
| 14 | +//! - Create a `Context` which will perform the following steps: |
| 15 | +//! - Build the graph of `Unit` dependencies (see |
| 16 | +//! `core::compiler::context::unit_dependencies`). |
| 17 | +//! - Prepare the `target` directory (see `Layout`). |
| 18 | +//! - Create a job queue (see `JobQueue`). The queue checks the |
| 19 | +//! fingerprint of each `Unit` to determine if it should run or be |
| 20 | +//! skipped. |
| 21 | +//! - Execute the queue. Each leaf in the queue's dependency graph is |
| 22 | +//! executed, and then removed from the graph when finished. This |
| 23 | +//! repeats until the queue is empty. |
22 | 24 |
|
23 | 25 | use std::collections::{BTreeSet, HashMap, HashSet};
|
24 | 26 | use std::iter::FromIterator;
|
|
0 commit comments