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

Workspace not correctly detected if workspace is also a project #60

Open
maddiemort opened this issue Jun 2, 2018 · 2 comments
Open

Comments

@maddiemort
Copy link

maddiemort commented Jun 2, 2018

#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",
]
@kkharji
Copy link

kkharji commented Apr 13, 2022

I'm facing same issue. had to cd into app dir and ran CARGO_TARGET_DIR=. cargo bundle

@kkharji
Copy link

kkharji commented Apr 13, 2022

maybe support -p tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants