Module cargo::ops::cargo_compile
source · Expand description
The Cargo “compile” operation
This module contains the entry point for starting the compilation process
for commands like build
, test
, doc
, rustc
, etc.
The compile
function will do all the work to compile a workspace. A
rough outline is:
- Resolve the dependency graph (see
ops::resolve
). - Download any packages needed (see
PackageSet
). - Generate a list of top-level “units” of work for the targets the user
requested on the command-line. Each
Unit
corresponds to a compiler invocation. This is done in this module (UnitGenerator::generate_root_units
). - Build the graph of
Unit
dependencies (seeunit_dependencies
). - Create a
Context
which will perform the following steps:- Prepare the
target
directory (seeLayout
). - Create a job queue (see
JobQueue
). The queue checks the fingerprint of eachUnit
to determine if it should run or be skipped. - Execute the queue. Each leaf in the queue’s dependency graph is executed, and then removed from the graph when finished. This repeats until the queue is empty.
- Prepare the
Note: “target” inside this module generally refers to “Cargo Target”, which corresponds to artifact that will be built in a package. Not to be confused with target-triple or target architecture.
Re-exports
pub use compile_filter::CompileFilter;
pub use compile_filter::FilterRule;
pub use compile_filter::LibRule;
pub use packages::Packages;
Modules
Structs
- Contains information about how a package should be compiled.
Functions
- Compiles!
- Like
compile_with_exec
but without warnings from manifest parsing. - Prepares all required information for the actual compilation.
- Override crate types for given units.
- Executes
rustc --print <VALUE>
. - This is used to rebuild the unit graph, sharing host dependencies if possible.
- Removes duplicate CompileMode::Doc units that would cause problems with filename collisions.
- Gets all of the features enabled for a package, plus its dependencies’ features.
- Recursive function for rebuilding the graph.
- visit 🔒