453 lines
12 KiB
HTML
453 lines
12 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of CARGO-PACKAGE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>CARGO-PACKAGE</H1>
|
|
Section: (1)<BR>Updated: 2020-06-25<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
cargo-package - Assemble the local package into a distributable tarball
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>cargo package [</B><I>OPTIONS</I>]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
This command will create a distributable, compressed <B>.crate</B> file with the
|
|
source code of the package in the current directory. The resulting file will
|
|
be stored in the <B>target/package</B> directory. This performs the following
|
|
steps:
|
|
<P>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
1.
|
|
|
|
|
|
Load and check the current workspace, performing some basic checks.
|
|
<P>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
•
|
|
|
|
|
|
Path dependencies are not allowed unless they have a version key. Cargo
|
|
will ignore the path key for dependencies in published packages.
|
|
<B>dev-dependencies</B> do not have this restriction.
|
|
</DL>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
2.
|
|
|
|
|
|
Create the compressed <B>.crate</B> file.
|
|
<P>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
•
|
|
|
|
|
|
The original <B>Cargo.toml</B> file is rewritten and normalized.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="5"><DD>
|
|
•
|
|
|
|
|
|
<B>[patch]</B>, <B>[replace]</B>, and <B>[workspace]</B> sections are removed from the
|
|
manifest.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
•
|
|
|
|
|
|
<B>Cargo.lock</B> is automatically included if the package contains an
|
|
executable binary or example target. <B><A HREF="/cgi-bin/man/man2html?1+cargo-install">cargo-install</A></B>(1) will use the
|
|
packaged lock file if the <B>--locked</B> flag is used.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
•
|
|
|
|
|
|
A <B>.cargo_vcs_info.json</B> file is included that contains information
|
|
about the current VCS checkout hash if available (not included with
|
|
<B>--allow-dirty</B>).
|
|
</DL>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
3.
|
|
|
|
|
|
Extract the <B>.crate</B> file and build it to verify it can build.
|
|
<P>
|
|
<DL COMPACT><DT id="9"><DD>
|
|
•
|
|
|
|
|
|
This will rebuild your package from scratch to ensure that it can be
|
|
built from a pristine state. The <B>--no-verify</B> flag can be used to skip
|
|
this step.
|
|
</DL>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="10"><DD>
|
|
4.
|
|
|
|
|
|
Check that build scripts did not modify any source files.
|
|
</DL>
|
|
|
|
<P>
|
|
The list of files included can be controlled with the <B>include</B> and <B>exclude</B>
|
|
fields in the manifest.
|
|
<P>
|
|
See
|
|
<I>the reference</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/publishing.html">https://doc.rust-lang.org/cargo/reference/publishing.html</A>>
|
|
|
|
for more details about
|
|
packaging and publishing.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Package Options</H3>
|
|
|
|
<P>
|
|
<B>-l</B>, <B>--list</B>
|
|
<DL COMPACT><DT id="11"><DD>
|
|
Print files included in a package without making one.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--no-verify</B>
|
|
<DL COMPACT><DT id="12"><DD>
|
|
Don't verify the contents by building them.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--no-metadata</B>
|
|
<DL COMPACT><DT id="13"><DD>
|
|
Ignore warnings about a lack of human-usable metadata (such as the
|
|
description or the license).
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--allow-dirty</B>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
Allow working directories with uncommitted VCS changes to be packaged.
|
|
</DL>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Compilation Options</H3>
|
|
|
|
<P>
|
|
<B>--target</B> <I>TRIPLE</I>
|
|
<DL COMPACT><DT id="15"><DD>
|
|
Package for the given architecture. The default is the host
|
|
architecture. The general format of the triple is
|
|
<B><arch><sub>-<vendor>-<sys>-<abi></B>. Run <B>rustc --print target-list</B> for a
|
|
list of supported targets.
|
|
<P>
|
|
This may also be specified with the <B>build.target</B>
|
|
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
<P>
|
|
Note that specifying this flag makes Cargo run in a different mode where the
|
|
target artifacts are placed in a separate directory. See the
|
|
|
|
<I>build cache</I> <<A HREF="https://doc.rust-lang.org/cargo/guide/build-cache.html">https://doc.rust-lang.org/cargo/guide/build-cache.html</A>>
|
|
|
|
documentation for more details.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--target-dir</B> <I>DIRECTORY</I>
|
|
<DL COMPACT><DT id="16"><DD>
|
|
Directory for all generated artifacts and intermediate files. May also be
|
|
specified with the <B>CARGO_TARGET_DIR</B> environment variable, or the
|
|
<B>build.target-dir</B>
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
Defaults
|
|
to <B>target</B> in the root of the workspace.
|
|
</DL>
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Feature Selection</H3>
|
|
|
|
<P>
|
|
The feature flags allow you to control the enabled features for the "current"
|
|
package. The "current" package is the package in the current directory, or the
|
|
one specified in <B>--manifest-path</B>. If running in the root of a virtual
|
|
workspace, then the default features are selected for all workspace members,
|
|
or all features if <B>--all-features</B> is specified.
|
|
<P>
|
|
When no feature options are given, the <B>default</B> feature is activated for
|
|
every selected package.
|
|
<P>
|
|
<B>--features</B> <I>FEATURES</I>
|
|
<DL COMPACT><DT id="17"><DD>
|
|
Space or comma separated list of features to activate. These features only
|
|
apply to the current directory's package. Features of direct dependencies
|
|
may be enabled with <B><dep-name>/<feature-name></B> syntax. This flag may be
|
|
specified multiple times, which enables all specified features.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--all-features</B>
|
|
<DL COMPACT><DT id="18"><DD>
|
|
Activate all available features of all selected packages.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--no-default-features</B>
|
|
<DL COMPACT><DT id="19"><DD>
|
|
Do not activate the <B>default</B> feature of the current directory's
|
|
package.
|
|
</DL>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Manifest Options</H3>
|
|
|
|
<P>
|
|
<B>--manifest-path</B> <I>PATH</I>
|
|
<DL COMPACT><DT id="20"><DD>
|
|
Path to the <B>Cargo.toml</B> file. By default, Cargo searches for the
|
|
<B>Cargo.toml</B> file in the current directory or any parent directory.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--frozen</B>, <B>--locked</B>
|
|
<DL COMPACT><DT id="21"><DD>
|
|
Either of these flags requires that the <B>Cargo.lock</B> file is
|
|
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
|
|
exit with an error. The <B>--frozen</B> flag also prevents Cargo from
|
|
attempting to access the network to determine if it is out-of-date.
|
|
<P>
|
|
These may be used in environments where you want to assert that the
|
|
<B>Cargo.lock</B> file is up-to-date (such as a CI build) or want to avoid network
|
|
access.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--offline</B>
|
|
<DL COMPACT><DT id="22"><DD>
|
|
Prevents Cargo from accessing the network for any reason. Without this
|
|
flag, Cargo will stop with an error if it needs to access the network and
|
|
the network is not available. With this flag, Cargo will attempt to
|
|
proceed without the network if possible.
|
|
<P>
|
|
Beware that this may result in different dependency resolution than online
|
|
mode. Cargo will restrict itself to crates that are downloaded locally, even
|
|
if there might be a newer version as indicated in the local copy of the index.
|
|
See the <B><A HREF="/cgi-bin/man/man2html?1+cargo-fetch">cargo-fetch</A></B>(1) command to download dependencies before going
|
|
offline.
|
|
<P>
|
|
May also be specified with the <B>net.offline</B>
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>Miscellaneous Options</H3>
|
|
|
|
<P>
|
|
<B>-j</B> <I>N</I>, <B>--jobs</B> <I>N</I>
|
|
<DL COMPACT><DT id="23"><DD>
|
|
Number of parallel jobs to run. May also be specified with the
|
|
<B>build.jobs</B>
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
Defaults to
|
|
the number of CPUs.
|
|
</DL>
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H3>Display Options</H3>
|
|
|
|
<P>
|
|
<B>-v</B>, <B>--verbose</B>
|
|
<DL COMPACT><DT id="24"><DD>
|
|
Use verbose output. May be specified twice for "very verbose" output which
|
|
includes extra output such as dependency warnings and build script output.
|
|
May also be specified with the <B>term.verbose</B>
|
|
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-q</B>, <B>--quiet</B>
|
|
<DL COMPACT><DT id="25"><DD>
|
|
No output printed to stdout.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--color</B> <I>WHEN</I>
|
|
<DL COMPACT><DT id="26"><DD>
|
|
Control when colored output is used. Valid values:
|
|
<P>
|
|
<DL COMPACT><DT id="27"><DD>
|
|
•
|
|
|
|
|
|
<B>auto</B> (default): Automatically detect if color support is available on the
|
|
terminal.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="28"><DD>
|
|
•
|
|
|
|
|
|
<B>always</B>: Always display colors.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="29"><DD>
|
|
•
|
|
|
|
|
|
<B>never</B>: Never display colors.
|
|
</DL>
|
|
|
|
<P>
|
|
May also be specified with the <B>term.color</B>
|
|
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H3>Common Options</H3>
|
|
|
|
<P>
|
|
<B>+TOOLCHAIN</B>
|
|
<DL COMPACT><DT id="30"><DD>
|
|
If Cargo has been installed with rustup, and the first argument to <B>cargo</B>
|
|
begins with <B>+</B>, it will be interpreted as a rustup toolchain name (such
|
|
as <B>+stable</B> or <B>+nightly</B>).
|
|
See the
|
|
<I>rustup documentation</I> <<A HREF="https://github.com/rust-lang/rustup/">https://github.com/rust-lang/rustup/</A>>
|
|
|
|
for more information about how toolchain overrides work.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-h</B>, <B>--help</B>
|
|
<DL COMPACT><DT id="31"><DD>
|
|
Prints help information.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-Z</B> <I>FLAG</I>...
|
|
<DL COMPACT><DT id="32"><DD>
|
|
Unstable (nightly-only) flags to Cargo. Run <B>cargo -Z help</B> for
|
|
details.
|
|
</DL>
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
<P>
|
|
See
|
|
<I>the reference</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/environment-variables.html">https://doc.rust-lang.org/cargo/reference/environment-variables.html</A>>
|
|
|
|
for
|
|
details on environment variables that Cargo reads.
|
|
<A NAME="lbAN"> </A>
|
|
<H2>EXIT STATUS</H2>
|
|
|
|
<P>
|
|
0
|
|
<DL COMPACT><DT id="33"><DD>
|
|
Cargo succeeded.
|
|
</DL>
|
|
|
|
<P>
|
|
101
|
|
<DL COMPACT><DT id="34"><DD>
|
|
Cargo failed to complete.
|
|
</DL>
|
|
|
|
<A NAME="lbAO"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="35"><DD>
|
|
1.
|
|
|
|
|
|
Create a compressed <B>.crate</B> file of the current package:
|
|
<P>
|
|
<DL COMPACT><DT id="36"><DD>
|
|
|
|
<PRE>
|
|
cargo package
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAP"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
<B><A HREF="/cgi-bin/man/man2html?1+cargo">cargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+cargo-publish">cargo-publish</A></B>(1)
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="37"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="38"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="39"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="40"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DL>
|
|
<DT id="41"><A HREF="#lbAF">Package Options</A><DD>
|
|
<DT id="42"><A HREF="#lbAG">Compilation Options</A><DD>
|
|
<DT id="43"><A HREF="#lbAH">Feature Selection</A><DD>
|
|
<DT id="44"><A HREF="#lbAI">Manifest Options</A><DD>
|
|
<DT id="45"><A HREF="#lbAJ">Miscellaneous Options</A><DD>
|
|
<DT id="46"><A HREF="#lbAK">Display Options</A><DD>
|
|
<DT id="47"><A HREF="#lbAL">Common Options</A><DD>
|
|
</DL>
|
|
<DT id="48"><A HREF="#lbAM">ENVIRONMENT</A><DD>
|
|
<DT id="49"><A HREF="#lbAN">EXIT STATUS</A><DD>
|
|
<DT id="50"><A HREF="#lbAO">EXAMPLES</A><DD>
|
|
<DT id="51"><A HREF="#lbAP">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:08 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|