fork/cargo

git clone https://git.julia.blue/fork/cargo

Weihang Lofix: use `host-tuple` for host target subsitution (#16003)f2932725b

home-0.5.12
8.4 KiB211 linesraw
1CARGO-CLEAN(1)
2
3NAME
4       cargo-clean — Remove generated artifacts
5
6SYNOPSIS
7       cargo clean [options]
8
9DESCRIPTION
10       Remove artifacts from the target directory that Cargo has generated in
11       the past.
12
13       With no options, cargo clean will delete the entire target directory.
14
15OPTIONS
16   Package Selection
17       When no packages are selected, all packages and all dependencies in the
18       workspace are cleaned.
19
20       -p spec…, --package spec…
21           Clean only the specified packages. This flag may be specified
22           multiple times. See cargo-pkgid(1) for the SPEC format.
23
24   Clean Options
25       --dry-run
26           Displays a summary of what would be deleted without deleting
27           anything. Use with --verbose to display the actual files that would
28           be deleted.
29
30       --doc
31           This option will cause cargo clean to remove only the doc directory
32           in the target directory.
33
34       --release
35           Remove all artifacts in the release directory.
36
37       --profile name
38           Remove all artifacts in the directory with the given profile name.
39
40       --target-dir directory
41           Directory for all generated artifacts and intermediate files. May
42           also be specified with the CARGO_TARGET_DIR environment variable, or
43           the build.target-dir config value
44           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to
45           target in the root of the workspace.
46
47       --target triple
48           Clean for the specified target architecture. Flag may be specified
49           multiple times. The default is the host architecture. The general
50           format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
51
52           Possible values:
53
54           o  Any supported target in rustc --print target-list.
55
56           o  "host-tuple", which will internally be substituted by the
57              host’s target. This can be particularly useful if you’re
58              cross-compiling some crates, and don’t want to specify your
59              host’s machine as a target (for instance, an xtask in a shared
60              project that may be worked on by many hosts).
61
62           o  A path to a custom target specification. See Custom Target Lookup
63              Path
64              <https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
65              for more information.
66
67           This may also be specified with the build.target config value
68           <https://doc.rust-lang.org/cargo/reference/config.html>.
69
70           Note that specifying this flag makes Cargo run in a different mode
71           where the target artifacts are placed in a separate directory. See
72           the build cache
73           <https://doc.rust-lang.org/cargo/reference/build-cache.html>
74           documentation for more details.
75
76   Display Options
77       -v, --verbose
78           Use verbose output. May be specified twice for “very verbose”
79           output which includes extra output such as dependency warnings and
80           build script output. May also be specified with the term.verbose
81           config value
82           <https://doc.rust-lang.org/cargo/reference/config.html>.
83
84       -q, --quiet
85           Do not print cargo log messages. May also be specified with the
86           term.quiet config value
87           <https://doc.rust-lang.org/cargo/reference/config.html>.
88
89       --color when
90           Control when colored output is used. Valid values:
91
92           o  auto (default): Automatically detect if color support is
93              available on the terminal.
94
95           o  always: Always display colors.
96
97           o  never: Never display colors.
98
99           May also be specified with the term.color config value
100           <https://doc.rust-lang.org/cargo/reference/config.html>.
101
102   Manifest Options
103       --manifest-path path
104           Path to the Cargo.toml file. By default, Cargo searches for the
105           Cargo.toml file in the current directory or any parent directory.
106
107       --locked
108           Asserts that the exact same dependencies and versions are used as
109           when the existing Cargo.lock file was originally generated. Cargo
110           will exit with an error when either of the following scenarios
111           arises:
112
113           o  The lock file is missing.
114
115           o  Cargo attempted to change the lock file due to a different
116              dependency resolution.
117
118           It may be used in environments where deterministic builds are
119           desired, such as in CI pipelines.
120
121       --offline
122           Prevents Cargo from accessing the network for any reason. Without
123           this flag, Cargo will stop with an error if it needs to access the
124           network and the network is not available. With this flag, Cargo will
125           attempt to proceed without the network if possible.
126
127           Beware that this may result in different dependency resolution than
128           online mode. Cargo will restrict itself to crates that are
129           downloaded locally, even if there might be a newer version as
130           indicated in the local copy of the index. See the cargo-fetch(1)
131           command to download dependencies before going offline.
132
133           May also be specified with the net.offline config value
134           <https://doc.rust-lang.org/cargo/reference/config.html>.
135
136       --frozen
137           Equivalent to specifying both --locked and --offline.
138
139       --lockfile-path PATH
140           Changes the path of the lockfile from the default
141           (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock
142           (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that
143           providing --lockfile-path will ignore existing lockfile at the
144           default path, and instead will either use the lockfile from PATH, or
145           write a new lockfile into the provided PATH if it doesn’t exist.
146           This flag can be used to run most commands in read-only directories,
147           writing lockfile into the provided PATH.
148
149           This option is only available on the nightly channel
150           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
151           requires the -Z unstable-options flag to enable (see #14421
152           <https://github.com/rust-lang/cargo/issues/14421>).
153
154   Common Options
155       +toolchain
156           If Cargo has been installed with rustup, and the first argument to
157           cargo begins with +, it will be interpreted as a rustup toolchain
158           name (such as +stable or +nightly). See the rustup documentation
159           <https://rust-lang.github.io/rustup/overrides.html> for more
160           information about how toolchain overrides work.
161
162       --config KEY=VALUE or PATH
163           Overrides a Cargo configuration value. The argument should be in
164           TOML syntax of KEY=VALUE, or provided as a path to an extra
165           configuration file. This flag may be specified multiple times. See
166           the command-line overrides section
167           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
168           for more information.
169
170       -C PATH
171           Changes the current working directory before executing any specified
172           operations. This affects things like where cargo looks by default
173           for the project manifest (Cargo.toml), as well as the directories
174           searched for discovering .cargo/config.toml, for example. This
175           option must appear before the command name, for example cargo -C
176           path/to/my-project build.
177
178           This option is only available on the nightly channel
179           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
180           requires the -Z unstable-options flag to enable (see #10098
181           <https://github.com/rust-lang/cargo/issues/10098>).
182
183       -h, --help
184           Prints help information.
185
186       -Z flag
187           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
188           details.
189
190ENVIRONMENT
191       See the reference
192       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
193       for details on environment variables that Cargo reads.
194
195EXIT STATUS
196       o  0: Cargo succeeded.
197
198       o  101: Cargo failed to complete.
199
200EXAMPLES
201       1. Remove the entire target directory:
202
203              cargo clean
204
205       2. Remove only the release artifacts:
206
207              cargo clean --release
208
209SEE ALSO
210       cargo(1), cargo-build(1)
211