|
6 | 6 | // necessarily an improvement, we prefer to not use them at this time.
|
7 | 7 | #![allow(clippy::all)]
|
8 | 8 |
|
| 9 | +//! # Cargo as a library |
| 10 | +//! |
| 11 | +//! Cargo, the Rust package manager, is also provided as a library. |
| 12 | +//! |
| 13 | +//! There are two places you can find API documentation of cargo-the-library, |
| 14 | +//! |
| 15 | +//! - <https://docs.rs/cargo> and |
| 16 | +//! - <https://doc.crates.io/contrib/apidoc/cargo>. |
| 17 | +//! |
| 18 | +//! Each of them targets on a slightly different audience. |
| 19 | +//! |
| 20 | +//! ## For external tool developers |
| 21 | +//! |
| 22 | +//! The documentation on <https://docs.rs/cargo> contains public-facing items in cargo-the-library. |
| 23 | +//! External tool developers may find it useful when trying to reuse existing building blocks from Cargo. |
| 24 | +//! However, using Cargo as a library has drawbacks, especially cargo-the-library is unstable, |
| 25 | +//! and there is no clear path to stabilize it soon at the time of writing. |
| 26 | +//! See [The Cargo Book: External tools] for more on this topic. |
| 27 | +//! |
| 28 | +//! Cargo API documentation on docs.rs gets updates along with each Rust release. |
| 29 | +//! Its version always has a 0 major version to state it is unstable. |
| 30 | +//! The minor version is always +1 of rustc's minor version |
| 31 | +//! (that is, `cargo 0.66.0` corresponds to `rustc 1.65`). |
| 32 | +//! |
| 33 | +//! ## For Cargo contributors |
| 34 | +//! |
| 35 | +//! The documentation on <https://doc.crates.io/contrib/apidoc/cargo> contains all items in Cargo. |
| 36 | +//! Contributors of Cargo may find it useful as a reference of Cargo's implementation details. |
| 37 | +//! It's built with `--document-private-items` rustdoc flag, |
| 38 | +//! so you might expect to see some noise and strange items here. |
| 39 | +//! The Cargo team and contributors strive for jotting down every details |
| 40 | +//! from their brains in each issue and PR. |
| 41 | +//! However, something might just disappear in the air with no reason. |
| 42 | +//! This documentation can be seen as their extended minds, |
| 43 | +//! sharing designs and hacks behind both public and private interfaces. |
| 44 | +//! |
| 45 | +//! If you are just diving into Cargo internals, [Cargo Architecture Overview] |
| 46 | +//! is the best material to get a broader context of how Cargo works under the hood. |
| 47 | +//! Things also worth a read are important concepts reside in source code, |
| 48 | +//! which Cargo developers have been crafting for a while, namely |
| 49 | +//! |
| 50 | +//! - [`cargo::core::resolver`](crate::core::resolver), |
| 51 | +//! - [`cargo::core::compiler::fingerprint`](core/compiler/fingerprint/index.html), |
| 52 | +//! - [`cargo::util::config`](crate::util::config), |
| 53 | +//! - [`cargo::ops::fix`](ops/fix/index.html), and |
| 54 | +//! - [`cargo::sources::registry`](crate::sources::registry). |
| 55 | +//! |
| 56 | +//! This API documentation is published on each push of rust-lang/cargo master branch. |
| 57 | +//! In other words, it always reflects the latest doc comments in source code on master branch. |
| 58 | +//! |
| 59 | +//! ## Contribute to Cargo documentations |
| 60 | +//! |
| 61 | +//! The Cargo team always continues improving all external and internal documentations. |
| 62 | +//! If you spot anything could be better, don't hesitate to discuss with the team on |
| 63 | +//! Zulip [`t-cargo` stream], or [submit an issue] right on GitHub. |
| 64 | +//! There is also an issue label [`A-documenting-cargo-itself`], |
| 65 | +//! which is generally for documenting user-facing [The Cargo Book], |
| 66 | +//! but the Cargo team is welcome any form of enhancement for the [Cargo Contributor Guide] |
| 67 | +//! and this API documentation as well. |
| 68 | +//! |
| 69 | +//! [The Cargo Book: External tools]: https://doc.rust-lang.org/stable/cargo/reference/external-tools.html |
| 70 | +//! [Cargo Architecture Overview]: https://doc.crates.io/contrib/architecture |
| 71 | +//! [`t-cargo` stream]: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo |
| 72 | +//! [submit an issue]: https://github.com/rust-lang/cargo/issues/new/choose |
| 73 | +//! [`A-documenting-cargo-itself`]: https://github.com/rust-lang/cargo/labels/A-documenting-cargo-itself |
| 74 | +//! [The Cargo Book]: https://doc.rust-lang.org/cargo/ |
| 75 | +//! [Cargo Contributor Guide]: https://doc.crates.io/contrib/ |
| 76 | +
|
9 | 77 | use crate::core::shell::Verbosity::Verbose;
|
10 | 78 | use crate::core::Shell;
|
11 | 79 | use anyhow::Error;
|
|
0 commit comments