#cargo-subcommand #subcommand #vendor #io #local #source #directory

app cargo-vendor

A Cargo subcommand to vendor all crates.io dependencies onto the local filesystem

22 releases

Uses old Rust 2015

0.1.23 Feb 2, 2019
0.1.22 Dec 7, 2018
0.1.21 Nov 1, 2018
0.1.15 May 18, 2018
0.1.0 Aug 24, 2015

#123 in #subcommand

Download history 142/week @ 2024-07-19 122/week @ 2024-07-26 85/week @ 2024-08-02 93/week @ 2024-08-09 89/week @ 2024-08-16 127/week @ 2024-08-23 119/week @ 2024-08-30 154/week @ 2024-09-06 123/week @ 2024-09-13 118/week @ 2024-09-20 91/week @ 2024-09-27 93/week @ 2024-10-04 111/week @ 2024-10-11 113/week @ 2024-10-18 106/week @ 2024-10-25 134/week @ 2024-11-01

489 downloads per month

MIT/Apache

26KB
492 lines

cargo-vendor

Build Status Build status

This is a Cargo subcommand which vendors all crates.io dependencies into a local directory using Cargo's support for source replacement.

Installation

Currently this can be installed with:

$ cargo install cargo-vendor

You can also install precompiled binaries that are assembled on the CI for this crate.

Example Usage

Simply run cargo vendor inside of any Cargo project:

$ cargo vendor
add this to your .cargo/config for this project:

    [source.crates-io]
    replace-with = 'vendored-sources'

    [source.vendored-sources]
    directory = '/home/alex/code/cargo-vendor/vendor'

This will populate the vendor directory which contains the source of all crates.io dependencies. When configured, Cargo will then use this directory instead of looking at crates.io.

Also note that the output of cargo vendor that should be configuration is all on stdout (as opposed to stderr where other messages go), so you can also do:

$ cargo vendor > .cargo/config

to vendor and initialize your config in the same step!

Flag --no-merge-sources

If the vendored Cargo project makes use of [replace] sections it can happen that the vendoring operation fails, e.g. with an error like this:

found duplicate version of package `libc v0.2.43` vendored from two sources:
...

The flag --no-merge-sources should be able to solve that. Make sure to grab the .cargo/config file directly from standard output since the config gets more complicated and unpredictable.

Example:

$ cargo vendor --no-merge-sources > .cargo/config

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in cargo-vendor by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~49MB
~1M SLoC