I am trying to speed up the build when many of my app projects have many of the shared libraries. These apps and libs are not necessary in the same repo.
I would like to achieve the following:
Let's say I have lib1, app1 and app2 cargo.toml based projects.
First, I would like to go and cargo build
lib1. It would save build output in lib1/target
folder.
Next I would like to go and build app1 project, which uses lib1 crate. However, I do not want cargo build
for the app1 to build lib1 again. At very most, I want it to only copy the pre-built result from lib1/target folder to app1/target.
app2 has the same dependency to lib1, and I want the same 'reuse of prebuilt lib1' during building of the app2.
I am aware about cargo workspaces, but it does not allow me to do what I want, because app1 and app2 would be in different workspaces as such.
I am aware that I can publish to a crate registry, however, it stops iterative development when lib1 and app1 needs to be modified simultaneously and many publishing actions there is not a good idea. Although, it could work as a workaround if I could publish lib1 to a local folder registry, if it is even possible.
Could you please point me in the right direction what tools and configs to use to achieve the above?