cargo-sideload-0.3.0 is not a library.
cargo supports alternative registries but does not support authenticated downloads.
cargo-sideload lets your specify a registry, then reads your Cargo.lock file to determine
which dependencies use the specified registry. It then downloads the .crate files for those
dependencies using a user-specified authentication method, and stores them in your local cargo
cache as if they were downloaded directly with cargo.
The next time you run a cargo command, it will find the cached .crate files and use those
instead of attempting to download them.
cargo-sideload is a workaround until cargo supports authenticated downloads natively.
Installation
cargo install cargo-sideload
First run
- Add your alternate registry to
~/.cargo/config.toml. - Add
registry = "[registry-name]"to any dependencies that use the registry. - Run
cargo updateto populate yourCargo.lockfile. - Run
cargo sideload --registry=[registry-name]in your crate's root.- Set
CARGO_SIDELOAD_HEADERSin your shell or use the--headersargument if your download endpoint requires authentication or other headers. Format:[Header-Name]: [Header Value].
- Set
- Your crates are now in the local cargo cache.
cargowill use the local copies rather than attempt to download them.
Subsequent runs
- If alternate registry dependencies have changed
- Run
cargo update -p [crate-names]to update yourCargo.lockfile. - Run
cargo sideload --registry=[registry-name]to download updated dependencies.
- Run
- If alternate registry dependences have not changed, you don't have to do anything.
Options
--forcewill forcecargo sideloadto download a new copy of the specified.cratefiles. Previous copies of the.cratefile for that crate will be deleted.
Remaining Work
- Validate crate file (e.g. ensure it's not just a 404 page)
- Write tests.
- Automatically run
cargo updatefor registry dependencies that are inCargo.tomlbut notCargo.lock. - Deal with corrupt
.cratefiles. - Improve error handling.
- Improve console output.