cargo-vendor

This is a proof-of-concept Cargo subcommand which is used to vendor all crates.io dependencies into a local directory.

Leveraging file:// URLs, this subcommand will construct a custom registry index which only contains the necessary packages, cache all necessary crate files, and then place everything in a structure that Cargo expects.

Installation

Currently this can be installed with:

$ git clone https://github.com/alexcrichton/cargo-vendor $ cd cargo-vendor $ cargo build --release

Then move the binary target/release/cargo-vendor into your PATH or add target/release to your PATH.

Example Usage

First, cd into a Cargo project's root directory, then run the following command:

`` $ cargo vendor Create a.cargo/config` with this entry to use the vendor cache:

[registry]
index = "file:///home/foo/code/bar/vendor/index"

$ cargo build Updating registry file:///home/foo/code/bar/vendor/index Downloading rustc-serialize v0.3.16 (registry file:///home/foo/code/bar/vendor/index) Compiling rustc-serialize v0.3.16 (registry file:///home/foo/code/bar/vendor/index) Compiling ... ```

This will populate the vendor directory (generating an error it if it already exists) with the index for the "custom registry" as well as a copy of all the crates needed. The configuration printed can be placed in any .cargo/config to point your project at that index, and then all future builds will use that index.

Drawbacks