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: raise awareness of resolver used inside workspace #12388

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Changes from 1 commit
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/src/reference/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ To create a workspace, you add the `[workspace]` table to a `Cargo.toml`:

At minimum, a workspace has to have a member, either with a root package or as
a virtual manifest.
It's also a good practice to specify the `resolver = "2"` unless it is necessary
zvolin marked this conversation as resolved.
Show resolved Hide resolved
to rely on the old one. It is a default resolver for all packages in the `2021` edition
but it has to be explicitely set under the workspace.
epage marked this conversation as resolved.
Show resolved Hide resolved
zvolin marked this conversation as resolved.
Show resolved Hide resolved

#### Root package

Expand All @@ -49,6 +52,7 @@ where the workspace's `Cargo.toml` is located.

```toml
[workspace]
resolver = "2"
zvolin marked this conversation as resolved.
Show resolved Hide resolved

[package]
name = "hello_world" # the name of the package
Expand All @@ -67,6 +71,7 @@ you want to keep all the packages organized in separate directories.
# [PROJECT_DIR]/Cargo.toml
[workspace]
members = ["hello_world"]
resolver = "2"
```

```toml
Expand All @@ -86,6 +91,7 @@ the workspace:
[workspace]
members = ["member1", "path/to/member2", "crates/*"]
exclude = ["crates/foo", "path/to/other"]
resolver = "2"
```

All [`path` dependencies] residing in the workspace directory automatically
Expand Down Expand Up @@ -127,6 +133,7 @@ used:
[workspace]
members = ["path/to/member1", "path/to/member2", "path/to/member3/*"]
default-members = ["path/to/member2", "path/to/member3/foo"]
resolver = "2"
zvolin marked this conversation as resolved.
Show resolved Hide resolved
```

When specified, `default-members` must expand to a subset of `members`.
Expand Down Expand Up @@ -158,6 +165,7 @@ Example:
# [PROJECT_DIR]/Cargo.toml
[workspace]
members = ["bar"]
resolver = "2"

[workspace.package]
version = "1.2.3"
Expand Down Expand Up @@ -192,6 +200,7 @@ Example:
# [PROJECT_DIR]/Cargo.toml
[workspace]
members = ["bar"]
resolver = "2"

[workspace.dependencies]
cc = "1.0.73"
Expand Down Expand Up @@ -224,6 +233,7 @@ configuration in `Cargo.toml`. For example:
```toml
[workspace]
members = ["member1", "member2"]
resolver = "2"

[workspace.metadata.webcontents]
root = "path/to/webproject"
Expand Down