Application extensions: cyclic crate dependencies

Hi,

I have cli tool (let’s name it app) that needs external extensions (e.g. ext). ext shall reside in a dedicated crate because of license stuff. The problem is that in app there is some code that shall be shared between the extensions and the application itself. Let’s call this shared. If I refactor app to build a lib and a bin, cargo complains about cyclic dependencies because app depends on ext and ext depends on app:

.
├── app
└── ext

This can be solved by having three crates: app, ext and shared:

.
├── app
├── ext
└── shared

app depends on ext and shared
ext depends on shared.

I would like to keep app and shared in one repository, so I made shared a sub crate (don’t know if that is the correct term) of app - means the shared crate lives in a subdir of app. This works fine when I use pathes in the Cargo.toml but I could’t figure out how to address shared via ssh.

.
├── app
│   └── shared
└── ext

I experimented with cargo workspaces but here again I have the addressing issue because I cannot address lib inside the workspace from ext (only via the path attribute on the dependency).

.
├── ext
└── ws
    ├── app
    └── shared

Is there any other solution for this problem?

Hi @flxo, have you found the solution? I also meet the same problem.

You will probably have better luck starting a new thread.