cargo-bundle
cargo-bundle copied to clipboard
Workspace not correctly detected if workspace is also a project
#47 implemented awareness of parent workspaces when running cargo bundle
. It seems not to work, though, when the parent workspace is also a project of its own - e.g. foo
contains bar
, like so:
foo
├── Cargo.toml
├── bar
│ ├── Cargo.toml
│ └── src
│ └── main.rs
└── src
└── main.rs
The contents of foo/Cargo.toml
are:
[package]
name = "foo"
version = "0.1.0"
authors = ["Søren Mortensen <[email protected]>"]
[dependencies]
[workspace]
members = [
"bar",
]
I'm not entirely sure this is an intended usage of Cargo workspaces, but I had this setup in a project (until I changed it to work around this issue1). Running cargo bundle
within bar/
results in the following error message:
error: Failed to copy binary from "/private/tmp/foo/bar/target/debug/bar" Caused by: "/private/tmp/foo/bar/target/debug/bar" does not exist
It seems to be the case that the parent foo/target/
directory is not detected in the way it should be, and foo/bar/target/
is being used instead.
1Edit: to clarify, the workaround I used was to change the structure of the project so that it looks like so:
baz
├── bar
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── Cargo.toml
└── foo
├── Cargo.toml
└── src
└── main.rs
...where the contents of baz/Cargo.toml
are:
[workspace]
members = [
"foo",
"bar",
]
I'm facing same issue. had to cd into app dir and ran CARGO_TARGET_DIR=. cargo bundle
maybe support -p tag?