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 · A .cargo_vcs_info.json file is included that contains
31 information about the current VCS checkout hash if available
32 (not included with --allow-dirty).
33
34 3. Extract the .crate file and build it to verify it can build.
35
36 4. Check that build scripts did not modify any source files.
37
38 The list of files included can be controlled with the include and
39 exclude fields in the manifest.
40
41 See the reference
42 <https://doc.rust-lang.org/cargo/reference/publishing.html> for more
43 details about packaging and publishing.
44
46 Package Options
47 -l, --list
48 Print files included in a package without making one.
49
50 --no-verify
51 Don’t verify the contents by building them.
52
53 --no-metadata
54 Ignore warnings about a lack of human-usable metadata (such as the
55 description or the license).
56
57 --allow-dirty
58 Allow working directories with uncommitted VCS changes to be
59 packaged.
60
61 Compilation Options
62 --target TRIPLE
63 Package for the given architecture. The default is the host
64 architecture. The general format of the triple is
65 <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
66 a list of supported targets.
67
68 This may also be specified with the build.target config value
69 <https://doc.rust-lang.org/cargo/reference/config.html>.
70
71 --target-dir DIRECTORY
72 Directory for all generated artifacts and intermediate files. May
73 also be specified with the CARGO_TARGET_DIR environment variable,
74 or the build.target-dir config value
75 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
76 to target in the root of the workspace.
77
78 Feature Selection
79 When no feature options are given, the default feature is activated for
80 every selected package.
81
82 --features FEATURES
83 Space or comma separated list of features to activate. These
84 features only apply to the current directory’s package. Features of
85 direct dependencies may be enabled with <dep-name>/<feature-name>
86 syntax.
87
88 --all-features
89 Activate all available features of all selected packages.
90
91 --no-default-features
92 Do not activate the default feature of the current directory’s
93 package.
94
95 Manifest Options
96 --manifest-path PATH
97 Path to the Cargo.toml file. By default, Cargo searches in the
98 current directory or any parent directory for the Cargo.toml file.
99
100 --frozen, --locked
101 Either of these flags requires that the Cargo.lock file is
102 up-to-date. If the lock file is missing, or it needs to be updated,
103 Cargo will exit with an error. The --frozen flag also prevents
104 Cargo from attempting to access the network to determine if it is
105 out-of-date.
106
107 These may be used in environments where you want to assert that the
108 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
109 network access.
110
111 Miscellaneous Options
112 -j N, --jobs N
113 Number of parallel jobs to run. May also be specified with the
114 build.jobs config value
115 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
116 to the number of CPUs.
117
118 Display Options
119 -v, --verbose
120 Use verbose output. May be specified twice for "very verbose"
121 output which includes extra output such as dependency warnings and
122 build script output. May also be specified with the term.verbose
123 config value
124 <https://doc.rust-lang.org/cargo/reference/config.html>.
125
126 -q, --quiet
127 No output printed to stdout.
128
129 --color WHEN
130 Control when colored output is used. Valid values:
131
132 · auto (default): Automatically detect if color support is
133 available on the terminal.
134
135 · always: Always display colors.
136
137 · never: Never display colors.
138
139 May also be specified with the term.color config value
140 <https://doc.rust-lang.org/cargo/reference/config.html>.
141
142 Common Options
143 -h, --help
144 Prints help information.
145
146 -Z FLAG...
147 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
148 details.
149
151 See the reference
152 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
153 for details on environment variables that Cargo reads.
154
156 0
157 Cargo succeeded.
158
159 101
160 Cargo failed to complete.
161
163 1. Create a compressed .crate file of the current package:
164
165 cargo package
166
168 cargo(1), cargo-publish(1)
169
170
171
172 2019-02-13 CARGO-PACKAGE(1)