Skip to content

Commit 3af5a75

Browse files
authored
chore(license): create and check license file using cargo-about (#493)
1 parent 4e4e32f commit 3af5a75

File tree

7 files changed

+4160
-1690
lines changed

7 files changed

+4160
-1690
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Check license file
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
pull_request:
6+
7+
jobs:
8+
check-license-file:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- name: Check
14+
run: make update-license-file
15+
- name: Check diff
16+
run: |
17+
git add .
18+
git diff --cached --exit-code

CREDITS

Lines changed: 0 additions & 1684 deletions
This file was deleted.

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1+
# Checks same as CI
12
.PHONY: ci
2-
ci: # Checks same as CI
3-
@make test-ci; \
4-
make check; \
5-
make fmt-check; \
6-
make spell-check
3+
ci: test-ci check fmt-check detect-unused-dependencies update-license-file spell-check
74

85
.PHONY: run
96
run:
@@ -36,6 +33,12 @@ tool-detect-unused-dependencies:
3633
cargo install cargo-machete; \
3734
fi
3835

36+
.PHONY: tool-update-license-file
37+
tool-update-license-file:
38+
@if ! which cargo-about > /dev/null; then \
39+
cargo install --locked cargo-about; \
40+
fi
41+
3942
.PHONY: test-ci # for CI
4043
test-ci:
4144
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo test
@@ -78,6 +81,10 @@ spell-check: tool-spell-check
7881
detect-unused-dependencies: tool-detect-unused-dependencies
7982
cargo machete
8083

84+
.PHONY: update-license-file
85+
update-license-file: tool-update-license-file
86+
cargo about generate about.hbs > license.html
87+
8188
DEBUG_EXECUTABLE = ./target/debug/fzf-make
8289
TEST_DIR = ./test_data
8390
.PHONY: run-in-test-data

_typos.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
ratatui = "ratatui"
33

44
[files]
5-
extend-exclude = ["doc/README-*.md"]
5+
extend-exclude = ["license.html"]

about.hbs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<html>
2+
3+
<head>
4+
<style>
5+
@media (prefers-color-scheme: dark) {
6+
body {
7+
background: #333;
8+
color: white;
9+
}
10+
a {
11+
color: skyblue;
12+
}
13+
}
14+
.container {
15+
font-family: sans-serif;
16+
max-width: 800px;
17+
margin: 0 auto;
18+
}
19+
.intro {
20+
text-align: center;
21+
}
22+
.licenses-list {
23+
list-style-type: none;
24+
margin: 0;
25+
padding: 0;
26+
}
27+
.license-used-by {
28+
margin-top: -10px;
29+
}
30+
.license-text {
31+
max-height: 200px;
32+
overflow-y: scroll;
33+
white-space: pre-wrap;
34+
}
35+
</style>
36+
</head>
37+
38+
<body>
39+
<main class="container">
40+
<div class="intro">
41+
<h1>Third Party Licenses</h1>
42+
<p>This page lists the licenses of the projects used in fzf-make.</p>
43+
</div>
44+
45+
<h2>Overview of licenses:</h2>
46+
<ul class="licenses-overview">
47+
{{#each overview}}
48+
<li><a href="#{{id}}">{{name}}</a> ({{count}})</li>
49+
{{/each}}
50+
</ul>
51+
52+
<h2>All license text:</h2>
53+
<ul class="licenses-list">
54+
{{#each licenses}}
55+
<li class="license">
56+
<h3 id="{{id}}">{{name}}</h3>
57+
<h4>Used by:</h4>
58+
<ul class="license-used-by">
59+
{{#each used_by}}
60+
<li><a href="{{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}}">{{crate.name}} {{crate.version}}</a></li>
61+
{{/each}}
62+
</ul>
63+
<pre class="license-text">{{text}}</pre>
64+
</li>
65+
{{/each}}
66+
</ul>
67+
</main>
68+
</body>
69+
70+
</html>

about.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
accepted = [
2+
"MIT",
3+
"ISC",
4+
"Apache-2.0",
5+
"MPL-2.0",
6+
"BSD-2-Clause",
7+
"BSD-3-Clause",
8+
"Unicode-DFS-2016",
9+
"OpenSSL",
10+
]
11+
workarounds = ["ring"]

0 commit comments

Comments
 (0)