-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
A-workspacesArea: workspacesArea: workspacesC-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Description
Problem
It doesn't appear as though the workspace.exclude key works for paths that are nested under a path included in workspace.members
Steps
- Create a nested package structure:
/tmp % cargo new outer
Created binary (application) `outer` package
/tmp % cd outer
/tmp/outer % cargo new middle
Created binary (application) `middle` package
/tmp/outer % cd middle
/tmp/outer/middle % cargo new inner
Created binary (application) `inner` package- Add a
workspace.memberskey to the outermost level, and observe that the workspace build succeeds:
/tmp/outer/middle % cd /tmp/outer
/tmp/outer % echo "[workspace]\n members = [\".\", \"middle\"]" >> Cargo.toml
/tmp/outer % cargo build --all
Compiling middle v0.1.0 (/tmp/outer/middle)
Compiling outer v0.1.0 (/tmp/outer)
Finished dev [unoptimized + debuginfo] target(s) in 0.34s- Now go to the inner package and observe that the build fails:
/tmp/outer % cd /tmp/outer/middle/inner
/tmp/outer/middle/inner % cargo build
error: current package believes it's in a workspace when it's not:
current: /tmp/outer/middle/inner/Cargo.toml
workspace: /tmp/outer/Cargo.toml
this may be fixable by adding `middle/inner` to the `workspace.members` array of the manifest located at: /tmp/outer/Cargo.toml- Fair enough; let's explicitly exclude this package instead, and try again:
/tmp/outer/middle/inner % cd /tmp/outer
/tmp/outer % echo "exclude = [\"middle/inner\"]" >> Cargo.toml
/tmp/outer % cd /tmp/outer/middle/inner
/tmp/outer/middle/inner % cargo build
error: current package believes it's in a workspace when it's not:
current: /tmp/outer/middle/inner/Cargo.toml
workspace: /tmp/outer/Cargo.toml
this may be fixable by adding `middle/inner` to the `workspace.members` array of the manifest located at: /tmp/outer/Cargo.tomlIt still wants to be in the workspace! We're stuck.
Possible Solution(s)
If there's overlap between paths in members and exclude, I would expect the more-specific path to win. In this case, the excluded path "middle/inner" is more specific than the member paths "." or "middle", so the exclusion should win. This is probably not so simple if the paths contain globs, though.
Notes
Output of cargo version:
% cargo version
cargo 1.31.0 (339d9f9c8 2018-11-16)Thanks for your looking into this 🦀
Dirbaio, mrshiposha, genya0407, DzenanJupic, Kobzol and 5 more
Metadata
Metadata
Assignees
Labels
A-workspacesArea: workspacesArea: workspacesC-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.