Crates.io | license-fetcher |
lib.rs | license-fetcher |
version | 0.5.0 |
source | src |
created_at | 2024-09-16 18:43:44.393002 |
updated_at | 2024-10-27 13:39:01.816787 |
description | Fetch licenses of dependencies at build time and embed them into your program. |
homepage | |
repository | https://github.com/WyvernIXTL/license-fetcher |
max_upload_size | |
id | 1376737 |
size | 83,119 |
Fetch licenses!
Fast!
Do it in the build step!
Crates that are compiled with your program are fetched via cargo metadata
.
License texts are read from the .cargo/registry/src
folder.
The data is then serialized and compressed.
[!WARNING] Include this library as build dependency and as normal dependeny!
cargo add --build --features build license-fetcher
cargo add license-fetcher
This library requires you to execute it for fetching licenses in a build script.
Creat a file called build.rs
in the root of your project and add following contents:
use license_fetcher::build_script::generate_package_list_with_licenses;
fn main() {
generate_package_list_with_licenses().write();
println!("cargo::rerun-if-changed=build.rs");
println!("cargo::rerun-if-changed=Cargo.lock");
println!("cargo::rerun-if-changed=Cargo.toml");
}
Add following content to your main.rs
:
use license_fetcher::get_package_list_macro;
fn main() {
let packages = get_package_list_macro!();
println!("{}", packages);
}
license-retriever
Does not fetch licenses from loacal source files.
Very slow.
Does not compress licenses.
cargo-about
Is not a library to access said data but rather a command line tool.
Does not fetch licenses from loacal source files.
Display trait included 😉