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

Does not correctly handle cross-workspace dependencies. #4

Open
dpc opened this issue Oct 26, 2020 · 8 comments
Open

Does not correctly handle cross-workspace dependencies. #4

dpc opened this issue Oct 26, 2020 · 8 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@dpc
Copy link

dpc commented Oct 26, 2020

I know, I have a most complicated build that ever existed... :D

For complicated reasons, that I can't get into RN my project structure is more or less:

root
  client
  client-lib-x
  api
  server

The client and server are a different workspace. But they both include the api as path = "../api".

So I'm running cargo-chef inside both server and client, but then cargo chef cook gets totally confused, and says:

Caused by:
  Unable to update /app/app/api 
                                                                                                                     
Caused by:                                                                                                           
  failed to read `/app/app/api/Cargo.toml`  

Even though path ... should be ... Hmmm... /app/api/Cargo.toml . Seems like some path concatenation somewhere where wrong WRT ...

@LukeMathWalker
Copy link
Owner

This is a bit of a tricky one (and a limitation I was aware of unfortunately) - how should it handle out-of-root path dependencies?
How would the stuff we do for in-root path dependencies (creation of dummy lib.rs/main.rs, clean-up of library compilation artifacts) work for those?

@dpc
Copy link
Author

dpc commented Oct 27, 2020

That's exactly what I've been doing before cargo-chef. I copied all toml and lock files, added stub main.rs/lib.rs in each project and it worked just fine. All the dependencies got built.

Part of the reason I'm interested in converting to cargo-chef because it was quite a lot of steps in the Dockerfile and rather confusing for anyone who was not experienced Rustacean.

@LukeMathWalker
Copy link
Owner

To make it possible with cargo-chef we need to remove the assumption that the command is being run from the root of a cargo project/workspace.
It's certainly possible, I just need to work our the ergonomics of it. Can you put up a minimum repo with dummy files that mirrors the structure of what you are working on? It'll make it easier for me to test.

@dpc
Copy link
Author

dpc commented Oct 27, 2020

I'm running these commands from the root the workspace. The external dependencies are not part of the workspace and are side by side with it. I'll try to minimize my setup and sent something along your way.

@LukeMathWalker LukeMathWalker added the triage in progress Working with the issue opener to get a minimum reproducible example. label Oct 28, 2020
@LukeMathWalker LukeMathWalker added good first issue Good for newcomers help wanted Extra attention is needed and removed triage in progress Working with the issue opener to get a minimum reproducible example. labels Dec 4, 2020
@oeed
Copy link

oeed commented Mar 15, 2021

Following my similar issue #51, I (probably naively) suspect that recursively collecting all dependencies from path dependencies, but omitting the path dependencies themselves, might solve this?

Is the issue of being run from the root one of where to find/copy the files once in Docker?

@LukeMathWalker
Copy link
Owner

@oeed - I haven't had time to work on this, but I am convinced it's definitely possible to support it.
This issue just needs a dedicated developer willing to open a PR for it.

@markdingram
Copy link
Contributor

I started the ball rolling in #169 - it is working against a simple local test - if it looks promising to eventual merge I'll add an integration test next.

In the meantime I'll kick the tyres on this in CI to see if it holds up against a more realistic setup.

markdingram pushed a commit to markdingram/cargo-chef that referenced this issue Apr 20, 2023
…rent Workspace)

Restrictions:

- if external Packages are part of a separate Cargo Workspace then at least one must link to that Workspace via the Cargo 'package.workspace' key
- external Workspaces are recommended to use wildcard globs for members, to avoid errors when not all children are included by cargo-chef

Fixes LukeMathWalker#4
markdingram pushed a commit to markdingram/cargo-chef that referenced this issue Apr 20, 2023
…rent Workspace)

Restrictions:

- if external Packages are part of a separate Cargo Workspace then at least one must link to that Workspace via the Cargo 'package.workspace' key
- external Workspaces are recommended to use wildcard globs for members, to avoid errors when not all children are included by cargo-chef

Fixes LukeMathWalker#4
markdingram pushed a commit to markdingram/cargo-chef that referenced this issue Apr 20, 2023
…rent Workspace)

Restrictions:

- if external Packages are part of a separate Cargo Workspace then at least one must link to that Workspace via the Cargo 'package.workspace' key
- external Workspaces are recommended to use wildcard globs for members, to avoid errors when not all children are included by cargo-chef

Fixes LukeMathWalker#4
@markdingram
Copy link
Contributor

Wrote up a workaround to this issue in https://github.com/markdingram/cargo-chef-multi-workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants