a year ago
Hi there,
I have an idea for improving monorepo support
Currently you can enter a root directory, however by using this only the root path gets cloned and for a monorepo the code will break because shared packages aren't included. So to address this issue, the root directory feature needs to be updated as follows:
Clone the full repo
Run build/install commands from the root directory (working directory)
For my company, we use a monorepo with shared packages and we use Rust for some tools. Right now we run cargo run -p {project}
for every service and yes this works but it could be improved.
I hope everything is clear, if there are some questions. Feel free to ask!
Have a nice day!
10 Replies
a year ago
Clone the full repo
Run build/install commands from the root directory (working directory)
may I ask what's preventing you from not setting a root directory and then doing the above?
a year ago
Hi brody, the problem right now is that when using Root Directory it only clones the path specified and not the full repo.
Here is an example repo:
/crates
/helpers
/[project] (uses helpers
crate, specified in Cargo.toml
)
If you specify the root directory as /crates/[project]
, the root directory gets cloned but the helpers
crate not.
Here is the error in the build log:
0.312 error: failed to parse manifest at /app/Cargo.toml
0.312
0.312 Caused by:
0.312 error inheriting helpers
from workspace root manifest's workspace.dependencies.helpers
0.312
0.312 Caused by:
0.312 failed to find a workspace root
a year ago
Well it's not well formatted but /helpers
and /[project]
are in the /crates
directory
a year ago
why can't you omit setting the root directory, and then run all the applicable commands?
a year ago
Because you have to always define the project name like cargo run -p {project}
or cargo build -p {project}
and it would be much easier if the root directory will be set as the working directory so you just need to run cargo run
or build
a year ago
while I don't think doing that is all too difficult, you can easily achieve such things with a Dockerfile
a year ago
This is how you could do it but wouldn't it make more sense to have the root directory replace the working directory and clone the full repo?
a year ago
I believe the current behaviour makes sense, for complete control you would definitely want to utilise a Dockerfile
a year ago
How exactly would you structure the Dockerfile? I've added a Dockerfile to each crate but again it's saying: error inheriting
helpersfrom workspace root manifest's workspace.dependencies.helpers
.
a year ago
I'm not a rust developer so I unfortunately wouldn't be of any use with that specific issue