build license-retriever

Retrieves licenses of all Rust dependencies

6 stable releases

1.1.0 Sep 19, 2024
1.0.4 Aug 14, 2024
1.0.2 Aug 1, 2024
1.0.1 Jul 31, 2024

#166 in Build Utils

Download history 267/week @ 2024-07-26 63/week @ 2024-08-02 205/week @ 2024-08-09 35/week @ 2024-08-16 62/week @ 2024-09-13 44/week @ 2024-09-20 13/week @ 2024-09-27 2/week @ 2024-10-04

121 downloads per month

LGPL-3.0-only

18KB
290 lines

license-retriever

Crates.io Version Github Version Crates.io MSRV docs.rs GitHub License

GitHub code size GitHub repo size GitHub last commit (branch) GitHub commits since latest release (branch) GitHub Release Date Libraries.io dependency status for GitHub repo

Crates.io Downloads (recent) Crates.io Total Downloads

Retrieves licenses of all Rust dependencies. Originally written for stencil2 but is now separated into its own project.

How

Licenses are retrieved by searching in the following order:

  • Folder that Cargo.toml is in
  • Crate cache in ~/.cargo
  • GitHub repository
  • Text from spdx with identifier in Cargo.toml

Usage

Cargo

cargo add license-retriever
cargo add --build license-retriever

build.rs

use license_retriever::{Config, LicenseRetriever};

fn main() {
    let config = Config {
        // options...
        ..Config::default()
    };
    LicenseRetriever::from_config(&config).unwrap().save_in_out_dir("LICENSE-3RD-PARTY").unwrap();
}

main.rs

use license_retriever;

fn main() {
    let licenses = license_retriever::license_retriever_data!("LICENSE-3RD-PARTY").unwrap();
    println!("{}", licenses);
}

Dependencies

~13MB
~308K SLoC