blob: 788f55f9b0d38170c13d60fc85083249df530be0 [file] [log] [blame]
= cargo-package(1)
:idprefix: cargo_package_
:doctype: manpage
:actionverb: Package
== NAME
cargo-package - Assemble the local package into a distributable tarball
== SYNOPSIS
`cargo package [_OPTIONS_]`
== DESCRIPTION
This command will create a distributable, compressed `.crate` file with the
source code of the package in the current directory. The resulting file will
be stored in the `target/package` directory. This performs the following
steps:
. Load and check the current workspace, performing some basic checks.
- Path dependencies are not allowed unless they have a version key. Cargo
will ignore the path key for dependencies in published packages.
`dev-dependencies` do not have this restriction.
. Create the compressed `.crate` file.
- The original `Cargo.toml` file is rewritten and normalized.
- `[patch]`, `[replace]`, and `[workspace]` sections are removed from the
manifest.
- `Cargo.lock` is automatically included if the package contains an
executable binary or example target. man:cargo-install[1] will use the
packaged lock file if the `--locked` flag is used.
- A `.cargo_vcs_info.json` file is included that contains information
about the current VCS checkout hash if available (not included with
`--allow-dirty`).
. Extract the `.crate` file and build it to verify it can build.
. Check that build scripts did not modify any source files.
The list of files included can be controlled with the `include` and `exclude`
fields in the manifest.
See linkcargo:reference/publishing.html[the reference] for more details about
packaging and publishing.
== OPTIONS
=== Package Options
*-l*::
*--list*::
Print files included in a package without making one.
*--no-verify*::
Don't verify the contents by building them.
*--no-metadata*::
Ignore warnings about a lack of human-usable metadata (such as the
description or the license).
*--allow-dirty*::
Allow working directories with uncommitted VCS changes to be packaged.
=== Compilation Options
include::options-target-triple.adoc[]
include::options-target-dir.adoc[]
include::options-features.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Create a compressed `.crate` file of the current package:
cargo package
== SEE ALSO
man:cargo[1], man:cargo-publish[1]