Skip to content

Commit fda6616

Browse files
jonaspleyersyphar
authored andcommitted
add snippet to explain in more detail how to package crate
1 parent b3e2343 commit fda6616

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ cargo run -- build world
210210
# Usually this command can be applied directly to a crate root
211211
# In certain scenarios it might be necessary to first package the respective
212212
# crate by using the `cargo package` command.
213+
# See also /docs/build-workspaces.md
213214
cargo run -- build crate --local /path/to/source
214215
```
215216

docs/build-workspaces.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Build Workspaces
2+
## When do we need this?
3+
Many workspace packages do not need manual intervention and can be built simply by executing the commands listed in the main [Readme.md](../Readme.md) file.
4+
However, some workspaces require an additional step.
5+
This is the case when values such as
6+
```toml
7+
version.workspace = true
8+
```
9+
are inherited from the workspaces `Cargo.toml` configuration file.
10+
11+
## Fix
12+
To build documentation, rustdoc requires a fully specified package but rustdoc does not understand workspaces which are only defined in cargo.
13+
Thus our crate needs to be packaged by cargo before running the documentation.
14+
This step will replace all of the `value.workspace = true` statements with their respective values.
15+
```
16+
cargo package
17+
```
18+
This will emit a packaged crate into the `target/package/your_crate_name-version` folder.
19+
Now the commands specified in [Readme.md](../Readme.md) can be executed targeting this folder.
20+
```
21+
cargo run -- build crate --local /path/to/source/target/package/your_crate_name-version/
22+
```
23+

0 commit comments

Comments
 (0)