1CARGO-PACKAGE(1) CARGO-PACKAGE(1)
2
3
4
6 cargo-package - Assemble the local package into a distributable tarball
7
9 cargo package [OPTIONS]
10
12 This command will create a distributable, compressed .crate file with
13 the source code of the package in the current directory. The resulting
14 file will be stored in the target/package directory. This performs the
15 following steps:
16
17 1. Load and check the current workspace, performing some basic checks.
18
19 · Path dependencies are not allowed unless they have a version
20 key. Cargo will ignore the path key for dependencies in
21 published packages.
22
23 2. Create the compressed .crate file.
24
25 · The original Cargo.toml file is rewritten and normalized.
26
27 · [patch], [replace], and [workspace] sections are removed from
28 the manifest.
29
30 · Cargo.lock is automatically included if the package contains an
31 executable binary or example target. cargo-install(1) will use
32 the packaged lock file if the --locked flag is used.
33
34 · A .cargo_vcs_info.json file is included that contains
35 information about the current VCS checkout hash if available
36 (not included with --allow-dirty).
37
38 3. Extract the .crate file and build it to verify it can build.
39
40 4. Check that build scripts did not modify any source files.
41
42 The list of files included can be controlled with the include and
43 exclude fields in the manifest.
44
45 See the reference
46 <https://doc.rust-lang.org/cargo/reference/publishing.html> for more
47 details about packaging and publishing.
48
50 Package Options
51 -l, --list
52 Print files included in a package without making one.
53
54 --no-verify
55 Don’t verify the contents by building them.
56
57 --no-metadata
58 Ignore warnings about a lack of human-usable metadata (such as the
59 description or the license).
60
61 --allow-dirty
62 Allow working directories with uncommitted VCS changes to be
63 packaged.
64
65 Compilation Options
66 --target TRIPLE
67 Package for the given architecture. The default is the host
68 architecture. The general format of the triple is
69 <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
70 a list of supported targets.
71
72 This may also be specified with the build.target config value
73 <https://doc.rust-lang.org/cargo/reference/config.html>.
74
75 --target-dir DIRECTORY
76 Directory for all generated artifacts and intermediate files. May
77 also be specified with the CARGO_TARGET_DIR environment variable,
78 or the build.target-dir config value
79 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
80 to target in the root of the workspace.
81
82 Feature Selection
83 When no feature options are given, the default feature is activated for
84 every selected package.
85
86 --features FEATURES
87 Space or comma separated list of features to activate. These
88 features only apply to the current directory’s package. Features of
89 direct dependencies may be enabled with <dep-name>/<feature-name>
90 syntax.
91
92 --all-features
93 Activate all available features of all selected packages.
94
95 --no-default-features
96 Do not activate the default feature of the current directory’s
97 package.
98
99 Manifest Options
100 --manifest-path PATH
101 Path to the Cargo.toml file. By default, Cargo searches in the
102 current directory or any parent directory for the Cargo.toml file.
103
104 --frozen, --locked
105 Either of these flags requires that the Cargo.lock file is
106 up-to-date. If the lock file is missing, or it needs to be updated,
107 Cargo will exit with an error. The --frozen flag also prevents
108 Cargo from attempting to access the network to determine if it is
109 out-of-date.
110
111 These may be used in environments where you want to assert that the
112 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
113 network access.
114
115 --offline
116 Prevents Cargo from accessing the network for any reason. Without
117 this flag, Cargo will stop with an error if it needs to access the
118 network and the network is not available. With this flag, Cargo
119 will attempt to proceed without the network if possible.
120
121 Beware that this may result in different dependency resolution than
122 online mode. Cargo will restrict itself to crates that are
123 downloaded locally, even if there might be a newer version as
124 indicated in the local copy of the index. See the cargo-fetch(1)
125 command to download dependencies before going offline.
126
127 May also be specified with the net.offline config value
128 <https://doc.rust-lang.org/cargo/reference/config.html>.
129
130 Miscellaneous Options
131 -j N, --jobs N
132 Number of parallel jobs to run. May also be specified with the
133 build.jobs config value
134 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
135 to the number of CPUs.
136
137 Display Options
138 -v, --verbose
139 Use verbose output. May be specified twice for "very verbose"
140 output which includes extra output such as dependency warnings and
141 build script output. May also be specified with the term.verbose
142 config value
143 <https://doc.rust-lang.org/cargo/reference/config.html>.
144
145 -q, --quiet
146 No output printed to stdout.
147
148 --color WHEN
149 Control when colored output is used. Valid values:
150
151 · auto (default): Automatically detect if color support is
152 available on the terminal.
153
154 · always: Always display colors.
155
156 · never: Never display colors.
157
158 May also be specified with the term.color config value
159 <https://doc.rust-lang.org/cargo/reference/config.html>.
160
161 Common Options
162 -h, --help
163 Prints help information.
164
165 -Z FLAG...
166 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
167 details.
168
170 See the reference
171 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
172 for details on environment variables that Cargo reads.
173
175 0
176 Cargo succeeded.
177
178 101
179 Cargo failed to complete.
180
182 1. Create a compressed .crate file of the current package:
183
184 cargo package
185
187 cargo(1), cargo-publish(1)
188
189
190
191 2019-07-15 CARGO-PACKAGE(1)