1CARGO-PACKAGE(1)                                              CARGO-PACKAGE(1)
2
3
4

NAME

6       cargo-package - Assemble the local package into a distributable tarball
7

SYNOPSIS

9       cargo package [OPTIONS]
10

DESCRIPTION

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. dev-dependencies do not have this
22               restriction.
23
24        2. Create the compressed .crate file.
25
26           ·   The original Cargo.toml file is rewritten and normalized.
27
28           ·   [patch], [replace], and [workspace] sections are removed from
29               the manifest.
30
31           ·   Cargo.lock is automatically included if the package contains an
32               executable binary or example target. cargo-install(1) will use
33               the packaged lock file if the --locked flag is used.
34
35           ·   A .cargo_vcs_info.json file is included that contains
36               information about the current VCS checkout hash if available
37               (not included with --allow-dirty).
38
39        3. Extract the .crate file and build it to verify it can build.
40
41           ·   This will rebuild your package from scratch to ensure that it
42               can be built from a pristine state. The --no-verify flag can be
43               used to skip this step.
44
45        4. Check that build scripts did not modify any source files.
46
47       The list of files included can be controlled with the include and
48       exclude fields in the manifest.
49
50       See the reference
51       <https://doc.rust-lang.org/cargo/reference/publishing.html> for more
52       details about packaging and publishing.
53

OPTIONS

55   Package Options
56       -l, --list
57           Print files included in a package without making one.
58
59       --no-verify
60           Don’t verify the contents by building them.
61
62       --no-metadata
63           Ignore warnings about a lack of human-usable metadata (such as the
64           description or the license).
65
66       --allow-dirty
67           Allow working directories with uncommitted VCS changes to be
68           packaged.
69
70   Compilation Options
71       --target TRIPLE
72           Package for the given architecture. The default is the host
73           architecture. The general format of the triple is
74           <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
75           a list of supported targets.
76
77           This may also be specified with the build.target config value
78           <https://doc.rust-lang.org/cargo/reference/config.html>.
79
80           Note that specifying this flag makes Cargo run in a different mode
81           where the target artifacts are placed in a separate directory. See
82           the build cache
83           <https://doc.rust-lang.org/cargo/guide/build-cache.html>
84           documentation for more details.
85
86       --target-dir DIRECTORY
87           Directory for all generated artifacts and intermediate files. May
88           also be specified with the CARGO_TARGET_DIR environment variable,
89           or the build.target-dir config value
90           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
91           to target in the root of the workspace.
92
93   Feature Selection
94       The feature flags allow you to control the enabled features for the
95       "current" package. The "current" package is the package in the current
96       directory, or the one specified in --manifest-path. If running in the
97       root of a virtual workspace, then the default features are selected for
98       all workspace members, or all features if --all-features is specified.
99
100       When no feature options are given, the default feature is activated for
101       every selected package.
102
103       --features FEATURES
104           Space or comma separated list of features to activate. These
105           features only apply to the current directory’s package. Features of
106           direct dependencies may be enabled with <dep-name>/<feature-name>
107           syntax. This flag may be specified multiple times, which enables
108           all specified features.
109
110       --all-features
111           Activate all available features of all selected packages.
112
113       --no-default-features
114           Do not activate the default feature of the current directory’s
115           package.
116
117   Manifest Options
118       --manifest-path PATH
119           Path to the Cargo.toml file. By default, Cargo searches for the
120           Cargo.toml file in the current directory or any parent directory.
121
122       --frozen, --locked
123           Either of these flags requires that the Cargo.lock file is
124           up-to-date. If the lock file is missing, or it needs to be updated,
125           Cargo will exit with an error. The --frozen flag also prevents
126           Cargo from attempting to access the network to determine if it is
127           out-of-date.
128
129           These may be used in environments where you want to assert that the
130           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
131           network access.
132
133       --offline
134           Prevents Cargo from accessing the network for any reason. Without
135           this flag, Cargo will stop with an error if it needs to access the
136           network and the network is not available. With this flag, Cargo
137           will attempt to proceed without the network if possible.
138
139           Beware that this may result in different dependency resolution than
140           online mode. Cargo will restrict itself to crates that are
141           downloaded locally, even if there might be a newer version as
142           indicated in the local copy of the index. See the cargo-fetch(1)
143           command to download dependencies before going offline.
144
145           May also be specified with the net.offline config value
146           <https://doc.rust-lang.org/cargo/reference/config.html>.
147
148   Miscellaneous Options
149       -j N, --jobs N
150           Number of parallel jobs to run. May also be specified with the
151           build.jobs config value
152           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
153           to the number of CPUs.
154
155   Display Options
156       -v, --verbose
157           Use verbose output. May be specified twice for "very verbose"
158           output which includes extra output such as dependency warnings and
159           build script output. May also be specified with the term.verbose
160           config value
161           <https://doc.rust-lang.org/cargo/reference/config.html>.
162
163       -q, --quiet
164           No output printed to stdout.
165
166       --color WHEN
167           Control when colored output is used. Valid values:
168
169           ·   auto (default): Automatically detect if color support is
170               available on the terminal.
171
172           ·   always: Always display colors.
173
174           ·   never: Never display colors.
175
176           May also be specified with the term.color config value
177           <https://doc.rust-lang.org/cargo/reference/config.html>.
178
179   Common Options
180       -h, --help
181           Prints help information.
182
183       -Z FLAG...
184           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
185           details.
186

ENVIRONMENT

188       See the reference
189       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
190       for details on environment variables that Cargo reads.
191

EXIT STATUS

193       0
194           Cargo succeeded.
195
196       101
197           Cargo failed to complete.
198

EXAMPLES

200        1. Create a compressed .crate file of the current package:
201
202               cargo package
203

SEE ALSO

205       cargo(1), cargo-publish(1)
206
207
208
209                                  2020-02-06                  CARGO-PACKAGE(1)
Impressum