@@ -116,6 +116,7 @@ Each new feature described below should explain how to use it.
116
116
* [ gitoxide] ( #gitoxide ) --- Use ` gitoxide ` instead of ` git2 ` for a set of operations.
117
117
* [ script] ( #script ) --- Enable support for single-file ` .rs ` packages.
118
118
* [ lockfile-path] ( #lockfile-path ) --- Allows to specify a path to lockfile other than the default path ` <workspace_root>/Cargo.lock ` .
119
+ * [ package-workspace] ( #package-workspace ) --- Allows for packaging and publishing multiple crates in a workspace.
119
120
120
121
## allow-features
121
122
@@ -1643,6 +1644,48 @@ Example:
1643
1644
cargo +nightly metadata --lockfile-path=$LOCKFILES_ROOT /my-project/Cargo.lock -Z unstable-options
1644
1645
```
1645
1646
1647
+ ## package-workspace
1648
+ * Tracking Issue: [ #10948 ] ( https://github.com/rust-lang/cargo/issues/10948 )
1649
+
1650
+ This allows cargo to package (or publish) multiple crates in a workspace, even
1651
+ if they have inter-dependencies. For example, consider a workspace containing
1652
+ packages ` foo ` and ` dep ` , where ` foo ` depends on ` dep ` . Then
1653
+
1654
+ ``` sh
1655
+ cargo +nightly -Zpackage-workspace package -p foo -p dep
1656
+ ```
1657
+
1658
+ will package both ` foo ` and ` dep ` , while
1659
+
1660
+ ``` sh
1661
+ cargo +nightly -Zpackage-workspace publish -p foo -p dep
1662
+ ```
1663
+
1664
+ will publish both ` foo ` and ` dep ` .
1665
+ If ` foo ` and ` dep ` are the only crates in the workspace, you can use the ` --workspace `
1666
+ flag instead of specifying the crates individually:
1667
+
1668
+ ``` sh
1669
+ cargo +nightly -Zpackage-workspace package --workspace
1670
+ cargo +nightly -Zpackage-workspace publish --workspace
1671
+ ```
1672
+
1673
+ #### Lock-file behavior
1674
+
1675
+ When packaging a binary at the same time as one of its dependencies, the binary
1676
+ will be packaged with a lock-file pointing at the dependency's registry entry
1677
+ * as though the dependency were already published* , even though it has not yet
1678
+ been. In this case, ` cargo ` needs to know the registry that the dependency
1679
+ will eventually be published on. ` cargo ` will attempt to infer this registry
1680
+ by examining the [ the ` publish ` field] ( manifest.md#the-publish-field ) , falling back
1681
+ to ` crates.io ` if no ` publish ` field is set. To explicitly set the registry,
1682
+ pass a ` --registry ` or ` --index ` flag.
1683
+
1684
+ ``` sh
1685
+ cargo +nightly -Zpackage-workspace --registry=my-registry package -p foo -p dep
1686
+ cargo +nightly -Zpackage-workspace --index=https://example.com package -p foo -p dep
1687
+ ```
1688
+
1646
1689
# Stabilized and removed features
1647
1690
1648
1691
## Compile progress
0 commit comments