mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

Cargo has of #7143 enabled pipelined compilation by default which affects how the compiler is invoked, especially with respect to JSON messages. This, in some testing, has proven to cause quite a few issues with rustbuild's current integration with Cargo. This commit is aimed at adding features to Cargo to solve this issue. This commit adds the ability to customize the stream of JSON messages coming from Cargo. The new feature for Cargo is that it now also mirrors rustc in how you can configure the JSON stream. Multiple `--message-format` arguments are now supported and the value specified is a comma-separated list of directives. In addition to the existing `human`, `short`, and `json` directives these new directives have been added: * `json-render-diagnostics` - instructs Cargo to render rustc diagnostics and only print out JSON messages for artifacts and Cargo things. * `json-diagnostic-short` - indicates that the `rendered` field of rustc diagnostics should use the "short" rendering. * `json-diagnostic-rendered-ansi` - indicates that the `rendered` field of rustc diagnostics should embed ansi color codes. The first option here, `json-render-diagnostics`, will be used by rustbuild unconditionally. Additionally `json-diagnostic-short` will be conditionally used based on the input to rustbuild itself. This should be enough for external tools to customize how Cargo is invoked and how all kinds of JSON diagnostics get printed, and it's thought that we can relatively easily tweak this as necessary to extend it and such.
205 lines
4.9 KiB
Groff
205 lines
4.9 KiB
Groff
'\" t
|
|
.\" Title: cargo-fetch
|
|
.\" Author: [see the "AUTHOR(S)" section]
|
|
.\" Generator: Asciidoctor 2.0.8
|
|
.\" Date: 2019-06-07
|
|
.\" Manual: \ \&
|
|
.\" Source: \ \&
|
|
.\" Language: English
|
|
.\"
|
|
.TH "CARGO\-FETCH" "1" "2019-06-07" "\ \&" "\ \&"
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.ss \n[.ss] 0
|
|
.nh
|
|
.ad l
|
|
.de URL
|
|
\fI\\$2\fP <\\$1>\\$3
|
|
..
|
|
.als MTO URL
|
|
.if \n[.g] \{\
|
|
. mso www.tmac
|
|
. am URL
|
|
. ad l
|
|
. .
|
|
. am MTO
|
|
. ad l
|
|
. .
|
|
. LINKSTYLE blue R < >
|
|
.\}
|
|
.SH "NAME"
|
|
cargo\-fetch \- Fetch dependencies of a package from the network
|
|
.SH "SYNOPSIS"
|
|
.sp
|
|
\fBcargo fetch [\fIOPTIONS\fP]\fP
|
|
.SH "DESCRIPTION"
|
|
.sp
|
|
If a \fBCargo.lock\fP file is available, this command will ensure that all of the
|
|
git dependencies and/or registry dependencies are downloaded and locally
|
|
available. Subsequent Cargo commands never touch the network after a \fBcargo
|
|
fetch\fP unless the lock file changes.
|
|
.sp
|
|
If the lock file is not available, then this command will generate the lock
|
|
file before fetching the dependencies.
|
|
.sp
|
|
If \fB\-\-target\fP is not specified, then all target dependencies are fetched.
|
|
.sp
|
|
See also the \c
|
|
.URL "https://crates.io/crates/cargo\-prefetch" "cargo\-prefetch"
|
|
plugin which adds a command to download popular crates. This may be useful if
|
|
you plan to use Cargo without a network with the \fB\-\-offline\fP flag.
|
|
.SH "OPTIONS"
|
|
.SS "Fetch options"
|
|
.sp
|
|
\fB\-\-target\fP \fITRIPLE\fP
|
|
.RS 4
|
|
Fetch for the given architecture. The default is the host
|
|
architecture. The general format of the triple is
|
|
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a
|
|
list of supported targets.
|
|
.sp
|
|
This may also be specified with the \fBbuild.target\fP
|
|
.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
|
|
.RE
|
|
.SS "Display Options"
|
|
.sp
|
|
\fB\-v\fP, \fB\-\-verbose\fP
|
|
.RS 4
|
|
Use verbose output. May be specified twice for "very verbose" output which
|
|
includes extra output such as dependency warnings and build script output.
|
|
May also be specified with the \fBterm.verbose\fP
|
|
.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
|
|
.RE
|
|
.sp
|
|
\fB\-q\fP, \fB\-\-quiet\fP
|
|
.RS 4
|
|
No output printed to stdout.
|
|
.RE
|
|
.sp
|
|
\fB\-\-color\fP \fIWHEN\fP
|
|
.RS 4
|
|
Control when colored output is used. Valid values:
|
|
.sp
|
|
.RS 4
|
|
.ie n \{\
|
|
\h'-04'\(bu\h'+03'\c
|
|
.\}
|
|
.el \{\
|
|
. sp -1
|
|
. IP \(bu 2.3
|
|
.\}
|
|
\fBauto\fP (default): Automatically detect if color support is available on the
|
|
terminal.
|
|
.RE
|
|
.sp
|
|
.RS 4
|
|
.ie n \{\
|
|
\h'-04'\(bu\h'+03'\c
|
|
.\}
|
|
.el \{\
|
|
. sp -1
|
|
. IP \(bu 2.3
|
|
.\}
|
|
\fBalways\fP: Always display colors.
|
|
.RE
|
|
.sp
|
|
.RS 4
|
|
.ie n \{\
|
|
\h'-04'\(bu\h'+03'\c
|
|
.\}
|
|
.el \{\
|
|
. sp -1
|
|
. IP \(bu 2.3
|
|
.\}
|
|
\fBnever\fP: Never display colors.
|
|
.RE
|
|
.sp
|
|
May also be specified with the \fBterm.color\fP
|
|
.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
|
|
.RE
|
|
.SS "Manifest Options"
|
|
.sp
|
|
\fB\-\-manifest\-path\fP \fIPATH\fP
|
|
.RS 4
|
|
Path to the \fBCargo.toml\fP file. By default, Cargo searches in the current
|
|
directory or any parent directory for the \fBCargo.toml\fP file.
|
|
.RE
|
|
.sp
|
|
\fB\-\-frozen\fP, \fB\-\-locked\fP
|
|
.RS 4
|
|
Either of these flags requires that the \fBCargo.lock\fP file is
|
|
up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
|
|
exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from
|
|
attempting to access the network to determine if it is out\-of\-date.
|
|
.sp
|
|
These may be used in environments where you want to assert that the
|
|
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
|
|
access.
|
|
.RE
|
|
.sp
|
|
\fB\-\-offline\fP
|
|
.RS 4
|
|
Prevents Cargo from accessing the network for any reason. Without this
|
|
flag, Cargo will stop with an error if it needs to access the network and
|
|
the network is not available. With this flag, Cargo will attempt to
|
|
proceed without the network if possible.
|
|
.sp
|
|
Beware that this may result in different dependency resolution than online
|
|
mode. Cargo will restrict itself to crates that are downloaded locally, even
|
|
if there might be a newer version as indicated in the local copy of the index.
|
|
See the \fBcargo\-fetch\fP(1) command to download dependencies before going
|
|
offline.
|
|
.sp
|
|
May also be specified with the \fBnet.offline\fP \c
|
|
.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
|
|
.RE
|
|
.SS "Common Options"
|
|
.sp
|
|
\fB\-h\fP, \fB\-\-help\fP
|
|
.RS 4
|
|
Prints help information.
|
|
.RE
|
|
.sp
|
|
\fB\-Z\fP \fIFLAG\fP...
|
|
.RS 4
|
|
Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for
|
|
details.
|
|
.RE
|
|
.SH "ENVIRONMENT"
|
|
.sp
|
|
See \c
|
|
.URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " "
|
|
for
|
|
details on environment variables that Cargo reads.
|
|
.SH "EXIT STATUS"
|
|
.sp
|
|
0
|
|
.RS 4
|
|
Cargo succeeded.
|
|
.RE
|
|
.sp
|
|
101
|
|
.RS 4
|
|
Cargo failed to complete.
|
|
.RE
|
|
.SH "EXAMPLES"
|
|
.sp
|
|
.RS 4
|
|
.ie n \{\
|
|
\h'-04' 1.\h'+01'\c
|
|
.\}
|
|
.el \{\
|
|
. sp -1
|
|
. IP " 1." 4.2
|
|
.\}
|
|
Fetch all dependencies:
|
|
.sp
|
|
.if n .RS 4
|
|
.nf
|
|
cargo fetch
|
|
.fi
|
|
.if n .RE
|
|
.RE
|
|
.SH "SEE ALSO"
|
|
.sp
|
|
\fBcargo\fP(1), \fBcargo\-update\fP(1), \fBcargo\-generate\-lockfile\fP(1) |