Skip to content

Commit df1c2c1

Browse files
committed
Auto merge of #7187 - ehuss:cargo-compile-doc, r=Eh2406
Update `cargo_compile` module doc. Update a hilariously outdated comment for `ops::cargo_compile`.
2 parents 137a36f + 2599c34 commit df1c2c1

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/cargo/ops/cargo_compile.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
//! Cargo `compile` currently does the following steps.
1+
//! The Cargo "compile" operation.
22
//!
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.
55
//!
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:
98
//!
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.
2224
2325
use std::collections::{BTreeSet, HashMap, HashSet};
2426
use std::iter::FromIterator;

0 commit comments

Comments
 (0)