Skip to content

Commit 8c30ce5

Browse files
committed
Auto merge of #14684 - sourcefrog:package-help, r=weihanglo
docs: More information on what is and isn't included by cargo package <!-- homu-ignore:start --> <!-- Thanks for submitting a pull request 🎉! Here are some tips for you: * If this is your first contribution, read "Cargo Contribution Guide" first: https://doc.crates.io/contrib/ * Run `cargo fmt --all` to format your code changes. * Small commits and pull requests are always preferable and easy to review. * If your idea is large and needs feedback from the community, read how: https://doc.crates.io/contrib/process/#working-on-large-features * Cargo takes care of compatibility. Read our design principles: https://doc.crates.io/contrib/design.html * When changing help text of cargo commands, follow the steps to generate docs: https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages * If your PR is not finished, set it as "draft" PR or add "WIP" in its title. * It's ok to use the CI resources to test your PR, but please don't abuse them. --> ### What does this PR try to resolve? Add more detail to `cargo package` explaining what is and isn't included. This doesn't add the feature requested by #11203 (shipping symlinks) but it does at least make it more clear that it's not supported. ### How should we test and review this PR? Docs only change. I wrote this by reading [src/cargo/sources/path.rs](https://github.com/rust-lang/cargo/blob/82c489f1c612096c2dffc48a4091d21af4b8e046/src/cargo/sources/path.rs), in addition to my observations of cargo behavior, so it might be helpful for reviewers to check the new docs against the code.
2 parents 430fabe + b8125da commit 8c30ce5

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/doc/man/cargo-package.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ stored in the `target/package` directory. This performs the following steps:
3232
- A `.cargo_vcs_info.json` file is included that contains information
3333
about the current VCS checkout hash if available, as well as a flag if the
3434
worktree is dirty.
35+
- Symlinks are flattened to their target files.
36+
- Files and directories are included or excluded based on rules mentioned in
37+
[the `[include]` and `[exclude]` fields](../reference/manifest.html#the-exclude-and-include-fields).
38+
3539
3. Extract the `.crate` file and build it to verify it can build.
3640
- This will rebuild your package from scratch to ensure that it can be
3741
built from a pristine state. The `--no-verify` flag can be used to skip

src/doc/man/generated_txt/cargo-package.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ DESCRIPTION
1414
following steps:
1515

1616
1. Load and check the current workspace, performing some basic checks.
17+
1718
o Path dependencies are not allowed unless they have a version key.
1819
Cargo will ignore the path key for dependencies in published
1920
packages. dev-dependencies do not have this restriction.
2021

2122
2. Create the compressed .crate file.
23+
2224
o The original Cargo.toml file is rewritten and normalized.
2325

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

37+
o Symlinks are flattened to their target files.
38+
39+
o Files and directories are included or excluded based on rules
40+
mentioned in the [include] and [exclude] fields
41+
<https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields>.
42+
3543
3. Extract the .crate file and build it to verify it can build.
44+
3645
o This will rebuild your package from scratch to ensure that it can
3746
be built from a pristine state. The --no-verify flag can be used
3847
to skip this step.

src/doc/src/commands/cargo-package.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ stored in the `target/package` directory. This performs the following steps:
2727
- A `.cargo_vcs_info.json` file is included that contains information
2828
about the current VCS checkout hash if available, as well as a flag if the
2929
worktree is dirty.
30+
- Symlinks are flattened to their target files.
31+
- Files and directories are included or excluded based on rules mentioned in
32+
[the `[include]` and `[exclude]` fields](../reference/manifest.html#the-exclude-and-include-fields).
33+
3034
3. Extract the `.crate` file and build it to verify it can build.
3135
- This will rebuild your package from scratch to ensure that it can be
3236
built from a pristine state. The `--no-verify` flag can be used to skip

src/etc/man/cargo-package.1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ packaged lock file if the \fB\-\-locked\fR flag is used.
4545
about the current VCS checkout hash if available, as well as a flag if the
4646
worktree is dirty.
4747
.RE
48+
.sp
49+
.RS 4
50+
\h'-04'\(bu\h'+02'Symlinks are flattened to their target files.
51+
.RE
52+
.sp
53+
.RS 4
54+
\h'-04'\(bu\h'+02'Files and directories are included or excluded based on rules mentioned in
55+
\fIthe \f(BI[include]\fI and \f(BI[exclude]\fI fields\fR <https://doc.rust\-lang.org/cargo/reference/manifest.html#the\-exclude\-and\-include\-fields>\&.
56+
.RE
4857
.RE
4958
.sp
5059
.RS 4

0 commit comments

Comments
 (0)