Skip to content

Commit b366ebd

Browse files
committed
Add licensing check for Rust code
If we add new rust dependencies we should now be alerted when a new license type is added.
1 parent 5365728 commit b366ebd

File tree

17 files changed

+113
-1
lines changed

17 files changed

+113
-1
lines changed

.github/workflows/rust.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,22 @@ jobs:
5353
- name: Typo Check
5454
uses: crate-ci/typos@v1.29.4
5555
with:
56-
files: ./rust
56+
files: ./rust
57+
58+
# Check licensing and produce a list of licenses
59+
licensing:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Install cargo-about
64+
uses: baptiste0928/cargo-install@v3
65+
with:
66+
crate: cargo-about
67+
version: "0.6.6"
68+
- name: Run license check
69+
run: cargo about generate about.hbs > license.html
70+
- name: Archive license file
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: license
74+
path: 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 **rust** projects used in binaryninja-api.</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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
accepted = [
2+
"Apache-2.0",
3+
"MIT",
4+
"Unicode-DFS-2016",
5+
"Unicode-3.0",
6+
"ISC",
7+
"BSD-3-Clause",
8+
"BSL-1.0",
9+
"LicenseRef-scancode-google-patent-license-fuchsia"
10+
]

arch/msp430/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "arch_msp430"
33
version = "0.1.0"
44
authors = ["jrozner"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
binaryninja.workspace = true

arch/riscv/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "arch_riscv"
33
version = "0.1.0"
44
authors = ["Ryan Snyder <ryan.snyder.or@gmail.com>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
binaryninja.workspace = true

arch/riscv/disasm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "riscv-dis"
33
version = "0.1.0"
44
authors = ["Ryan Snyder <ryan.snyder.or@gmail.com>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
byteorder = "1"

plugins/dwarf/dwarf_export/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "dwarf_export"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["cdylib"]

plugins/dwarf/dwarf_import/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "dwarf_import"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["cdylib"]

plugins/dwarf/dwarfdump/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "dwarfdump"
33
version = "0.1.0"
44
authors = ["Kyle Martin <kyle@vector35.com>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[lib]
89
crate-type = ["cdylib"]

plugins/dwarf/shared/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "dwarfreader"
33
version = "0.1.0"
44
authors = ["Kyle Martin <kyle@vector35.com>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
binaryninja.workspace = true

0 commit comments

Comments
 (0)