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

Interaction with Rust workspaces #17

Open
palfrey opened this issue Mar 11, 2018 · 6 comments
Open

Interaction with Rust workspaces #17

palfrey opened this issue Mar 11, 2018 · 6 comments

Comments

@palfrey
Copy link

palfrey commented Mar 11, 2018

I've got a project (https://github.com/palfrey/potboiler) I'm testing out using cargo-raze to build, but it uses Cargo workspaces to separate sub-projects and that doesn't seem to interact well with cargo-raze. I've added a top-level WORKSPACE and the generated BUILD for a Remote genmode only seems to contain the dependencies from one of the sub-folder Cargo.toml's. Experimentation seems to indicate it's whichever one is listed first in the [workspace] "members" key.

Any thoughts on how to get this to read from all of them?

@mfarrugi
Copy link
Collaborator

The current use-case is geared towards having 1 Cargo.toml act as a bridge between a Bazel Workspace and Cargo. The immediate solution is to collate your Cargo.toml`s and use BUILD files instead (or in addition).

There is some thought to alternatives in #12

@photex
Copy link

photex commented Aug 1, 2018

It isn't possible to collate all Cargo.tomls in my use-case because I have several crates that generate libraries. Using a cargo workspace is currently the only way for this to work if you want to avoid duplicated target directories with redundant crate compilation.

@mfarrugi
Copy link
Collaborator

mfarrugi commented Aug 1, 2018

When I say collate them, I meant their dependencies, the raze toml is just telling cargo vendor what to download and raze what to generate build files for. At some point you'll replace all other Cargo.toml with BUILD files.

This should be functionally identical to a cargo workspace, though it may be more difficult to explicitly use multiple versions of an external crate.

@photex
Copy link

photex commented Aug 1, 2018

My problem partly seemed to be that the root workspace Cargo.toml had sway over the Cargo.toml in the raze package. I'm required to include it in the workspace manifest since it's a subdirectory. This pulls in the workspace lock file which also incorrectly wants to include my crates from the repo as vendored dependencies.

@ali5h
Copy link

ali5h commented May 24, 2020

i also think cargo-raze should support rust workspaces, this way a project is buildable with both cargo and bazel. It seems like raze already creates a fake workspace project to fetch the metadata.

@palfrey
Copy link
Author

palfrey commented Feb 28, 2021

Several years later I've come back to this one, and palfrey/potboiler#32 adds Bazel support (mostly using cargo-raze with a couple of hacks for issues - #287 and #389 mainly) to the workspace-using project I wanted to get working originally.

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

4 participants