Skip to content

Commit

Permalink
Add licenses for used crates
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden committed Feb 12, 2024
1 parent bd7d673 commit bd070f0
Show file tree
Hide file tree
Showing 6 changed files with 2,673 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
- name: Fetch the repository code
uses: actions/checkout@v4

- name: Deny banned crates and licenses
uses: EmbarkStudios/cargo-deny-action@v1

- name: Build Docker image
run: docker build . -t tinty

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ publish: publish_dry
@echo "---------------"
cargo publish

publish_dry: test_docker
publish_dry: setup_tests
@echo "-------------------"
@echo "Running publish_dry"
@echo "-------------------"
@echo "Generating license file"
cargo about generate about.hbs > license.html
@if [ -n "$(git status --porcelain)" ]; then \
echo "There are changes." && exit 1; \
fi
@echo "Publish dry run"
cargo publish --dry-run

test_docker: setup_tests
Expand All @@ -36,4 +39,4 @@ build:
@echo "Running build"
@echo "-------------"
cargo build --release

cargo deny check
70 changes: 70 additions & 0 deletions about.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<html>

<head>
<style>
@media (prefers-color-scheme: dark) {
body {
background: #333;
color: white;
}
a {
color: skyblue;
}
}
.container {
font-family: sans-serif;
max-width: 800px;
margin: 0 auto;
}
.intro {
text-align: center;
}
.licenses-list {
list-style-type: none;
margin: 0;
padding: 0;
}
.license-used-by {
margin-top: -10px;
}
.license-text {
max-height: 200px;
overflow-y: scroll;
white-space: pre-wrap;
}
</style>
</head>

<body>
<main class="container">
<div class="intro">
<h1>Third Party Licenses</h1>
<p>This page lists the licenses of the projects used in cargo-about.</p>
</div>

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

<h2>All license text:</h2>
<ul class="licenses-list">
{{#each licenses}}
<li class="license">
<h3 id="{{id}}">{{name}}</h3>
<h4>Used by:</h4>
<ul class="license-used-by">
{{#each used_by}}
<li><a href="{{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}}">{{crate.name}} {{crate.version}}</a></li>
{{/each}}
</ul>
<pre class="license-text">{{text}}</pre>
</li>
{{/each}}
</ul>
</main>
</body>

</html>
19 changes: 19 additions & 0 deletions about.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
accepted = [
"Apache-2.0",
"MIT",
]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-apple-darwin",
]
ignore-build-dependencies = false
ignore-dev-dependencies = false
ignore-transitive-dependencies = false
filter-noassertion = true

[option-ext]
accepted = ["MPL-2.0"]

[unicode-ident]
accepted = ["Unicode-DFS-2016"]
52 changes: 52 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
targets = [
{ triple = "x86_64-unknown-linux-gnu" },
{ triple = "aarch64-unknown-linux-gnu" },
{ triple = "x86_64-unknown-linux-musl" },
{ triple = "aarch64-apple-darwin" },
{ triple = "x86_64-apple-darwin" },
]
all-features = false
no-default-features = false
feature-depth = 1

[advisories]
vulnerability = "deny"
unmaintained = "deny"
notice = "deny"
unsound = "deny"

[licenses]
unlicensed = "deny"
allow-osi-fsf-free = "neither"
copyleft = "deny"
# We want really high confidence when inferring licenses from text
confidence-threshold = 0.93
allow = [
"Apache-2.0",
"MIT",
]
exceptions = [
{ allow = [
"Unicode-DFS-2016",
], name = "unicode-ident" },
{ allow = [
"MPL-2.0",
], name = "option-ext" },
]

[bans]
multiple-versions = "deny"
wildcards = "deny"
deny = [
{ name = "openssl" },
{ name = "openssl-sys" },
{ name = "libssh2-sys" },

# No reason to use these
{ name = "cmake" },
{ name = "windows" },
]

[sources]
unknown-registry = "deny"
unknown-git = "deny"
Loading

0 comments on commit bd070f0

Please sign in to comment.