Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: More information on what is and isn't included by cargo package #14684

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/doc/man/cargo-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ stored in the `target/package` directory. This performs the following steps:
- A `.cargo_vcs_info.json` file is included that contains information
about the current VCS checkout hash if available, as well as a flag if the
worktree is dirty.
- Symlinks are flattened to their target files.
- Subdirectories containing `Cargo.toml` are excluded, as they are assumed
to be separate packages.
- A `target` directory in the root of the package is excluded.
- Files and directories matching the `[include]` and `[exclude]` fields in
the manifest are included or excluded. Include patterns can override the
following rules.
- Files that are ignored by VCS are excluded.
- Unix hidden files and directories (starting with `.`) are excluded.
sourcefrog marked this conversation as resolved.
Show resolved Hide resolved

3. Extract the `.crate` file and build it to verify it can build.
- This will rebuild your package from scratch to ensure that it can be
built from a pristine state. The `--no-verify` flag can be used to skip
Expand Down
18 changes: 18 additions & 0 deletions src/doc/man/generated_txt/cargo-package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ DESCRIPTION
following steps:

1. Load and check the current workspace, performing some basic checks.

o 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.

2. Create the compressed .crate file.

o The original Cargo.toml file is rewritten and normalized.

o [patch], [replace], and [workspace] sections are removed from the
Expand All @@ -32,7 +34,23 @@ DESCRIPTION
about the current VCS checkout hash if available, as well as a
flag if the worktree is dirty.

o Symlinks are flattened to their target files.

o Subdirectories containing Cargo.toml are excluded, as they are
assumed to be separate packages.

o A target directory in the root of the package is excluded.

o Files and directories matching the [include] and [exclude] fields
in the manifest are included or excluded. Include patterns can
override the following rules.

o Files that are ignored by VCS are excluded.

o Unix hidden files and directories (starting with .) are excluded.

3. Extract the .crate file and build it to verify it can build.

o This will rebuild your package from scratch to ensure that it can
be built from a pristine state. The --no-verify flag can be used
to skip this step.
Expand Down
10 changes: 10 additions & 0 deletions src/doc/src/commands/cargo-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ stored in the `target/package` directory. This performs the following steps:
- A `.cargo_vcs_info.json` file is included that contains information
about the current VCS checkout hash if available, as well as a flag if the
worktree is dirty.
- Symlinks are flattened to their target files.
- Subdirectories containing `Cargo.toml` are excluded, as they are assumed
to be separate packages.
- A `target` directory in the root of the package is excluded.
- Files and directories matching the `[include]` and `[exclude]` fields in
the manifest are included or excluded. Include patterns can override the
following rules.
- Files that are ignored by VCS are excluded.
- Unix hidden files and directories (starting with `.`) are excluded.

3. Extract the `.crate` file and build it to verify it can build.
- This will rebuild your package from scratch to ensure that it can be
built from a pristine state. The `--no-verify` flag can be used to skip
Expand Down
27 changes: 27 additions & 0 deletions src/etc/man/cargo-package.1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,33 @@ packaged lock file if the \fB\-\-locked\fR flag is used.
about the current VCS checkout hash if available, as well as a flag if the
worktree is dirty.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+02'Symlinks are flattened to their target files.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+02'Subdirectories containing \fBCargo.toml\fR are excluded, as they are assumed
to be separate packages.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+02'A \fBtarget\fR directory in the root of the package is excluded.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+02'Files and directories matching the \fB[include]\fR and \fB[exclude]\fR fields in
the manifest are included or excluded. Include patterns can override the
following rules.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+02'Files that are ignored by VCS are excluded.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+02'Unix hidden files and directories (starting with \fB\&.\fR) are excluded.
.RE
.RE
.sp
.RS 4
Expand Down
Loading