Can cargo download the index w/o an actual crate being build?

Hi there,

I'm exploring options for a proper build-pipeline setup. One of the time consuming tasks is to download the index the very first time, while updates run rather fast. Is there way to run an index download after a bare rust installation to allow "caching" this setup in the build pipeline and thus only updates of the index is executed when building an actual crate as part of the pipeline?

The only workaround I could think of would be to provide a simple "hello world" crate as a pre-step to get the initial index while building this crate but this feels more like workaround/hack rather proper pipeline setup and "cache" preparation.

Any hints are much appreciated.

cargo install 'crate-that-does-not-exist' might work.

1 Like

cargo install libc may be safer. It has no binaries to install, so it won't do anything, but at least nobody can register the name.

I've also used cargo search whatever for this. It happens to download the index, although technically it shouldn't need to.