]> git.proxmox.com Git - cargo.git/blob - src/doc/src/commands/cargo-vendor.md
Merge branch 'debian/sid' into proxmox/bullseye
[cargo.git] / src / doc / src / commands / cargo-vendor.md
1 # cargo-vendor(1)
2
3 ## NAME
4
5 cargo-vendor - Vendor all dependencies locally
6
7 ## SYNOPSIS
8
9 `cargo vendor` [_options_] [_path_]
10
11 ## DESCRIPTION
12
13 This cargo subcommand will vendor all crates.io and git dependencies for a
14 project into the specified directory at `<path>`. After this command completes
15 the vendor directory specified by `<path>` will contain all remote sources from
16 dependencies specified. Additional manifests beyond the default one can be
17 specified with the `-s` option.
18
19 The `cargo vendor` command will also print out the configuration necessary
20 to use the vendored sources, which you will need to add to `.cargo/config.toml`.
21
22 ## OPTIONS
23
24 ### Vendor Options
25
26 <dl>
27
28 <dt class="option-term" id="option-cargo-vendor--s"><a class="option-anchor" href="#option-cargo-vendor--s"></a><code>-s</code> <em>manifest</em></dt>
29 <dt class="option-term" id="option-cargo-vendor---sync"><a class="option-anchor" href="#option-cargo-vendor---sync"></a><code>--sync</code> <em>manifest</em></dt>
30 <dd class="option-desc">Specify an extra <code>Cargo.toml</code> manifest to workspaces which should also be
31 vendored and synced to the output. May be specified multiple times.</dd>
32
33
34 <dt class="option-term" id="option-cargo-vendor---no-delete"><a class="option-anchor" href="#option-cargo-vendor---no-delete"></a><code>--no-delete</code></dt>
35 <dd class="option-desc">Don't delete the &quot;vendor&quot; directory when vendoring, but rather keep all
36 existing contents of the vendor directory</dd>
37
38
39 <dt class="option-term" id="option-cargo-vendor---respect-source-config"><a class="option-anchor" href="#option-cargo-vendor---respect-source-config"></a><code>--respect-source-config</code></dt>
40 <dd class="option-desc">Instead of ignoring <code>[source]</code> configuration by default in <code>.cargo/config.toml</code>
41 read it and use it when downloading crates from crates.io, for example</dd>
42
43
44 <dt class="option-term" id="option-cargo-vendor---versioned-dirs"><a class="option-anchor" href="#option-cargo-vendor---versioned-dirs"></a><code>--versioned-dirs</code></dt>
45 <dd class="option-desc">Normally versions are only added to disambiguate multiple versions of the
46 same package. This option causes all directories in the &quot;vendor&quot; directory
47 to be versioned, which makes it easier to track the history of vendored
48 packages over time, and can help with the performance of re-vendoring when
49 only a subset of the packages have changed.</dd>
50
51
52 </dl>
53
54 ### Manifest Options
55
56 <dl>
57
58 <dt class="option-term" id="option-cargo-vendor---manifest-path"><a class="option-anchor" href="#option-cargo-vendor---manifest-path"></a><code>--manifest-path</code> <em>path</em></dt>
59 <dd class="option-desc">Path to the <code>Cargo.toml</code> file. By default, Cargo searches for the
60 <code>Cargo.toml</code> file in the current directory or any parent directory.</dd>
61
62
63
64 <dt class="option-term" id="option-cargo-vendor---frozen"><a class="option-anchor" href="#option-cargo-vendor---frozen"></a><code>--frozen</code></dt>
65 <dt class="option-term" id="option-cargo-vendor---locked"><a class="option-anchor" href="#option-cargo-vendor---locked"></a><code>--locked</code></dt>
66 <dd class="option-desc">Either of these flags requires that the <code>Cargo.lock</code> file is
67 up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
68 exit with an error. The <code>--frozen</code> flag also prevents Cargo from
69 attempting to access the network to determine if it is out-of-date.</p>
70 <p>These may be used in environments where you want to assert that the
71 <code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
72 access.</dd>
73
74
75 <dt class="option-term" id="option-cargo-vendor---offline"><a class="option-anchor" href="#option-cargo-vendor---offline"></a><code>--offline</code></dt>
76 <dd class="option-desc">Prevents Cargo from accessing the network for any reason. Without this
77 flag, Cargo will stop with an error if it needs to access the network and
78 the network is not available. With this flag, Cargo will attempt to
79 proceed without the network if possible.</p>
80 <p>Beware that this may result in different dependency resolution than online
81 mode. Cargo will restrict itself to crates that are downloaded locally, even
82 if there might be a newer version as indicated in the local copy of the index.
83 See the <a href="cargo-fetch.html">cargo-fetch(1)</a> command to download dependencies before going
84 offline.</p>
85 <p>May also be specified with the <code>net.offline</code> <a href="../reference/config.html">config value</a>.</dd>
86
87
88
89 </dl>
90
91 ### Display Options
92
93 <dl>
94
95 <dt class="option-term" id="option-cargo-vendor--v"><a class="option-anchor" href="#option-cargo-vendor--v"></a><code>-v</code></dt>
96 <dt class="option-term" id="option-cargo-vendor---verbose"><a class="option-anchor" href="#option-cargo-vendor---verbose"></a><code>--verbose</code></dt>
97 <dd class="option-desc">Use verbose output. May be specified twice for &quot;very verbose&quot; output which
98 includes extra output such as dependency warnings and build script output.
99 May also be specified with the <code>term.verbose</code>
100 <a href="../reference/config.html">config value</a>.</dd>
101
102
103 <dt class="option-term" id="option-cargo-vendor--q"><a class="option-anchor" href="#option-cargo-vendor--q"></a><code>-q</code></dt>
104 <dt class="option-term" id="option-cargo-vendor---quiet"><a class="option-anchor" href="#option-cargo-vendor---quiet"></a><code>--quiet</code></dt>
105 <dd class="option-desc">Do not print cargo log messages.
106 May also be specified with the <code>term.quiet</code>
107 <a href="../reference/config.html">config value</a>.</dd>
108
109
110 <dt class="option-term" id="option-cargo-vendor---color"><a class="option-anchor" href="#option-cargo-vendor---color"></a><code>--color</code> <em>when</em></dt>
111 <dd class="option-desc">Control when colored output is used. Valid values:</p>
112 <ul>
113 <li><code>auto</code> (default): Automatically detect if color support is available on the
114 terminal.</li>
115 <li><code>always</code>: Always display colors.</li>
116 <li><code>never</code>: Never display colors.</li>
117 </ul>
118 <p>May also be specified with the <code>term.color</code>
119 <a href="../reference/config.html">config value</a>.</dd>
120
121
122
123 </dl>
124
125 ### Common Options
126
127 <dl>
128
129 <dt class="option-term" id="option-cargo-vendor-+toolchain"><a class="option-anchor" href="#option-cargo-vendor-+toolchain"></a><code>+</code><em>toolchain</em></dt>
130 <dd class="option-desc">If Cargo has been installed with rustup, and the first argument to <code>cargo</code>
131 begins with <code>+</code>, it will be interpreted as a rustup toolchain name (such
132 as <code>+stable</code> or <code>+nightly</code>).
133 See the <a href="https://rust-lang.github.io/rustup/overrides.html">rustup documentation</a>
134 for more information about how toolchain overrides work.</dd>
135
136
137 <dt class="option-term" id="option-cargo-vendor---config"><a class="option-anchor" href="#option-cargo-vendor---config"></a><code>--config</code> <em>KEY=VALUE</em> or <em>PATH</em></dt>
138 <dd class="option-desc">Overrides a Cargo configuration value. The argument should be in TOML syntax of <code>KEY=VALUE</code>,
139 or provided as a path to an extra configuration file. This flag may be specified multiple times.
140 See the <a href="../reference/config.html#command-line-overrides">command-line overrides section</a> for more information.</dd>
141
142
143 <dt class="option-term" id="option-cargo-vendor--h"><a class="option-anchor" href="#option-cargo-vendor--h"></a><code>-h</code></dt>
144 <dt class="option-term" id="option-cargo-vendor---help"><a class="option-anchor" href="#option-cargo-vendor---help"></a><code>--help</code></dt>
145 <dd class="option-desc">Prints help information.</dd>
146
147
148 <dt class="option-term" id="option-cargo-vendor--Z"><a class="option-anchor" href="#option-cargo-vendor--Z"></a><code>-Z</code> <em>flag</em></dt>
149 <dd class="option-desc">Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for details.</dd>
150
151
152 </dl>
153
154
155 ## ENVIRONMENT
156
157 See [the reference](../reference/environment-variables.html) for
158 details on environment variables that Cargo reads.
159
160
161 ## EXIT STATUS
162
163 * `0`: Cargo succeeded.
164 * `101`: Cargo failed to complete.
165
166
167 ## EXAMPLES
168
169 1. Vendor all dependencies into a local "vendor" folder
170
171 cargo vendor
172
173 2. Vendor all dependencies into a local "third-party/vendor" folder
174
175 cargo vendor third-party/vendor
176
177 3. Vendor the current workspace as well as another to "vendor"
178
179 cargo vendor -s ../path/to/Cargo.toml
180
181 ## SEE ALSO
182 [cargo(1)](cargo.html)
183