How to package the tool chain and dependencies?

I want to introduce rust into our current project at work. What people concern is the build infrastructure. They want to have the toolchain checked into a storage (for example perforce), as well as prebuilt dependencies. And only use the version controlled tool chain and prebuilt binaries to build, so that the same build can be reproduced on different machines.

How can I do that with rust? Can I extract a tool chain and put it into a folder and ask cargo to use it? Can I put all decencies into a folder and only install them from the folder? (On our CI/CD nodes, we probably don't have internet.)

If you're using Linux, you could try the tarballs at Other Installation Methods - Rust Forge . Mac and Windows use installers instead of tarballs.

Yes, you can use cargo vendor which will vendor all deps into a directory and tell you how to configure cargo to only look for deps in that directory. You can then commit this directory into your source repo.

If you're using Windows or Mac I'd be curious how your team pulled off using Visual C++ or XCode this way.

1 Like