Skip to content
πŸ“œ Cargo plugin to generate list of all licenses for a crate πŸ¦€
Rust HTML
Branch: master
Clone or download
Jake-Shadle Add target filtering (#41)
* Use krates
* Update dependencies
* Disallow unknown fields
* Fill out targets and ignore- values
* Update CHANGELOG
* Add cargo release support
* Update README
Latest commit d5a79ce Jan 22, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github [ci] Switch to use cargo-deny GitHub action (#26) Dec 14, 2019
media Readme improvements (#6) Dec 5, 2019
resources
src
.gitignore Start fleshing out Nov 1, 2019
.mergify.yml Initial commit Nov 1, 2019
CHANGELOG.md Add target filtering (#41) Jan 22, 2020
CODE_OF_CONDUCT.md Initial commit Nov 1, 2019
CONTRIBUTING.md Initial commit Nov 1, 2019
Cargo.lock Add target filtering (#41) Jan 22, 2020
Cargo.toml Add target filtering (#41) Jan 22, 2020
LICENSE-APACHE
LICENSE-MIT Initial commit Nov 1, 2019
README.md Add target filtering (#41) Jan 22, 2020
about.hbs Cleanup HTML template (#15) Dec 8, 2019
about.toml Add target filtering (#41) Jan 22, 2020
deny.toml Add target filtering (#41) Jan 22, 2020
release.toml Add target filtering (#41) Jan 22, 2020
spdx_cache.bin.zstd Update spdx and askalono Nov 7, 2019

README.md

πŸ“œ cargo-about

Build Status Crates.io Docs Contributor Covenant Embark

Cargo plugin for generating a listing of all of the crates used by a root crate, and the terms under which they are licensed.

Getting started:

Installing

cargo install cargo-about

Generate license information for your own project

# Generates `about.toml` and `about.hbs` in your cargo project
cargo about init
# Generate the license information with
cargo about generate about.hbs > license.html

about.toml

[accepted]

Priority list of all the accepted licenses for a project. cargo-about will try to satisfy the licenses in the order that they are declared in this list.

accepted = [
    "Apache-2.0",
    "MIT",
]

[targets]

A list of targets that are actually building for. Crates which are only included via cfg() expressions that don't match one or more of the listed targets will be ignored.

targets = [
    "x86_64-unknown-linux-gnu",
    "x86_64-unknown-linux-musl",
    "x86_64-pc-windows-msvc",
    "x86_64-apple-darwin",
]

ignore-build-dependencies

If true, all crates that are only used as build dependencies will be ignored.

ignore-build-dependencies = true

ignore-dev-dependencies

If true, all crates that are only used as dev dependencies will be ignored.

ignore-dev-dependencies = true

[[DEPENDENCY.additional]]

  • root Name of the root folder
  • license Name of the license. Has to be parsable from SPDX, see https://spdx.org/licenses/
  • license-file The path to the license file where the license is specified
  • license-start The starting line number of the license in the specified license file
  • license-end The ending line number of the license in the specified license file
# Example
[[physx-sys.additional]]
root = "PhysX"
license = "BSD-3-Clause"
license-file = "PhysX/README.md"
license-start = 3
license-end = 28

[[DEPENDENCY.ignore]]

Sometimes libraries include licenses for example code that you don't want to use.

  • license Name of the license that you want to ingore. Has to be parsable from SPDX, see https://spdx.org/licenses/
  • license-file The path to the license file where the license is specified
[[imgui-sys.ignore]]
license = "Zlib"
license-file = "third-party/cimgui/imgui/examples/libs/glfw/COPYING.txt"

about.hbs

See handlebars

Variables

  • overview A list of LicenseSet
  • licenses A list of License

Types

LicenseSet

  • count The number of times the license is used
  • name The name of the license
  • id The id of the license

License

  • name The full name of the license
  • id The SPDX identifier
  • text The license text
  • source_path The path of the license
  • used_by A list of UsedBy

UsedBy

  • crate Metadata for a cargo package
  • path Optional path of the dependency that is being used by the license

Example

<ul class="licenses-overview">
    {{#each overview}}
    <li><a href="#{{id}}">{{name}}</a> ({{count}})</li>
    {{/each}}
</ul>

Preview of the default about.hbs

license You can view the full license here

FAQ

Unable to satisfy the following licenses

[ERROR] Crate 'aho-corasick': Unable to satisfy [Unlicense OR MIT], with the following accepted licenses [Apache-2.0]

In this case you are missing either MIT or Unlicense as an accepted license in your about.toml

Contributing

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started.

License

Licensed under either of

at your option.

Contribution

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

You can’t perform that action at this time.