-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
Given the following virtual workspace:
[workspace]
resolver = "2"
members = [
"apps/bin1",
"apps/bin2",
"apps/bin3",
"libs/libA",
"libs/libB",
...
]
Building bin1
with cargo build -p bin1
should be allowed even if bin2
is missing from the file system.
Use case: In docker when building a binary, only the relevant files are sent to the build context. For example, consider the following ignore file for building bin1
# Exclude everything
*
# Include relevant files only
!apps/bin1
!libs
!Cargo.toml
!Cargo.lock
The binary is then built with:
cargo build -p bin1 --locked --release
This fails with error: failed to load manifest for workspace member /code/app/bin2
because the other binaries which are members of the workspace aren't present, but they are irrelevant to this build so should not be needed.
Proposed Solution
An option to prevent a build from failing because of a missing member.
This could be done either:
through a flag:
cargo build -p bin1 --ignore-missing-members
(with a better flag name)
or directly in the manifest?
[workspace]
ignore-missing-members = true
Notes
No response