Skip to content

Commit 23c30d9

Browse files
shenxianpeng2bndy5
andauthoredDec 31, 2024
docs: reorganize LICENSE info (#89)
* docs: format LICENSE and fix typo * docs: move third-party licenses to a single file in docs * changes for mkdocs build * generate license list from `cargo tree` --------- Co-authored-by: Brendan <2bndy5@gmail.com>
1 parent 0687d8e commit 23c30d9

File tree

7 files changed

+98
-55
lines changed

7 files changed

+98
-55
lines changed
 

‎.github/workflows/bump-n-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- run: yarn global add @napi-rs/cli
4141
- uses: cargo-bins/cargo-binstall@main
4242
- run: cargo binstall -y git-cliff
43-
- name: Bump ${{ inputs.component }} verion
43+
- name: Bump ${{ inputs.component }} version
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.BUMP_N_RELEASE }}
4646
GH_TOKEN: ${{ secrets.BUMP_N_RELEASE }}

‎LICENSE

+15-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@ MIT License
22

33
Copyright (c) 2024 2bndy5
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
611

7-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
814

9-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md

+4-51
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[step-summary]: https://cpp-linter.github.io/cpp-linter-rs/cli#-w-step-summary
66
[tidy-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-d-tidy-review
77
[format-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-m-format-review
8+
[other-licenses]: https://cpp-linter.github.io/cpp-linter-rs/other-licenses
89

910
[format-annotations-preview]: docs/docs/images/annotations-clang-format.png
1011
[tidy-annotations-preview]: docs/docs/images/annotations-clang-tidy.png
@@ -172,56 +173,8 @@ To provide feedback (requesting a feature or reporting a bug) please post to
172173

173174
## License
174175

175-
The scripts and documentation in this project are released under the [MIT].
176-
177-
Dependencies (that are redistributed by us in binary form) have the following
178-
license agreements:
179-
180-
- [clap](https://crates.io/crates/clap):
181-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
182-
- [git2](https://crates.io/crates/git2):
183-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
184-
185-
The following are conditionally included in binaries (using the `openssl-vendored` feature on a
186-
case-by-case basis) because it is a dependency of git2:
187-
188-
- [openssl](https://crates.io/crates/openssl): Licensed under [Apache 2.0][Apache2]
189-
- [openssl-probe](https://crates.io/crates/openssl-probe):
190-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
191-
192-
- [lenient_semver](https://crates.io/crates/lenient_semver):
193-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
194-
- [log](https://crates.io/crates/log):
195-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
196-
- [regex](https://crates.io/crates/regex):
197-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
198-
- [reqwest](https://crates.io/crates/reqwest):
199-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
200-
- [semver](https://crates.io/crates/semver):
201-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
202-
- [serde](https://crates.io/crates/serde):
203-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
204-
- [serde-xml-rs](https://crates.io/crates/serde-xml-rs): Licensed under [MIT].
205-
- [serde_json](https://crates.io/crates/serde_json):
206-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
207-
- [which](https://crates.io/crates/which): Licensed under [MIT].
208-
- [tokio](https://crates.io/crates/tokio): Licensed under [MIT].
209-
- [futures](https://crates.io/crates/futures):
210-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
211-
- [chrono](https://crates.io/crates/chrono):
212-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
213-
- [colored](https://crates.io/crates/colored): Licensed under [MPL-2.0]
214-
215-
The python binding uses
216-
217-
- [pyo3](https://crates.io/crates/pyo3):
218-
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
219-
220-
The node binding uses
221-
222-
- [napi](https://crates.io/crates/napi): Licensed under [MIT]
223-
- [napi-derive](https://crates.io/crates/napi-derive): Licensed under [MIT]
176+
The scripts and documentation in this project are released under the [MIT] license.
177+
178+
As for dependencies (that are redistributed by us in binary form) and their licenses, refer to [THIRD-PARTY LICENSES][other-licenses].
224179

225180
[MIT]: https://choosealicense.com/licenses/mit
226-
[Apache2]: https://choosealicense.com/licenses/apache-2.0/
227-
[MPL-2.0]: https://choosealicense.com/licenses/mpl-2.0

‎docs/docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[step-summary]: cli.md#-w-step-summary
66
[tidy-review]: cli.md#-d-tidy-review
77
[format-review]: cli.md#-m-format-review
8+
[other-licenses]: other-licenses.md
89

910
[format-annotations-preview]: images/annotations-clang-format.png
1011
[tidy-annotations-preview]: images/annotations-clang-tidy.png

‎docs/docs/other-licenses.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Third-party Licenses
2+
3+
This page is generated when mkdocs builds.
4+
All content here is overwritten when building the docs.
5+
For changes to this document, please refer to [license_gen.py](../license_gen.py).

‎docs/license_gen.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import mkdocs_gen_files
2+
from subprocess import run
3+
4+
FILENAME = "other-licenses.md"
5+
6+
INTRO = """# Third-party Licenses
7+
8+
[MIT]: https://choosealicense.com/licenses/mit
9+
[Apache-2.0]: https://choosealicense.com/licenses/apache-2.0/
10+
[MPL-2.0]: https://choosealicense.com/licenses/mpl-2.0
11+
"""
12+
13+
OPTIONAL_DEPS = """## Optional dependencies
14+
15+
The following are conditionally included in binaries (using the `openssl-vendored`
16+
feature on a case-by-case basis) because it is a dependency of
17+
[git2](https://crates.io/crates/git2):
18+
19+
- [openssl](https://crates.io/crates/openssl): Licensed under [Apache-2.0].
20+
- [openssl-probe](https://crates.io/crates/openssl-probe):
21+
Dual-licensed under [Apache-2.0] or [MIT].
22+
"""
23+
24+
BINDING_DEPS = """## Bindings' dependencies
25+
26+
The python binding uses
27+
28+
- [pyo3](https://crates.io/crates/pyo3):
29+
Dual-licensed under [Apache-2.0] or [MIT].
30+
31+
The node binding uses
32+
33+
- [napi](https://crates.io/crates/napi): Licensed under [MIT]
34+
- [napi-derive](https://crates.io/crates/napi-derive): Licensed under [MIT]
35+
"""
36+
37+
with mkdocs_gen_files.open(FILENAME, "w") as io_doc:
38+
print(INTRO, file=io_doc)
39+
output = run(
40+
[
41+
"cargo",
42+
"tree",
43+
"-f",
44+
r"[{p}]({r}): Licensed under {l}",
45+
"-e",
46+
"normal",
47+
"-p",
48+
"cpp-linter",
49+
"--depth",
50+
"1",
51+
],
52+
capture_output=True,
53+
check=True,
54+
)
55+
doc = "\n".join(
56+
[
57+
"- "
58+
+ line[3:]
59+
.replace(" MIT", " [MIT]")
60+
.replace(" Apache-2.0", " [Apache-2.0]")
61+
.replace(" MPL-2.0", " [MPL-2.0]")
62+
for line in output.stdout.decode(encoding="utf-8").splitlines()[1:]
63+
]
64+
)
65+
# print(doc)
66+
print(doc, file=io_doc)
67+
print(f"\n{OPTIONAL_DEPS}\n", file=io_doc)
68+
print(f"\n{BINDING_DEPS}\n", file=io_doc)
69+
70+
mkdocs_gen_files.set_edit_path(FILENAME, "license-gen.py")

‎docs/mkdocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ nav:
1212
- python.md
1313
- node.md
1414
- changelog.md
15+
- other-licenses.md
1516

1617
theme:
1718
name: material
@@ -78,6 +79,7 @@ plugins:
7879
- gen-files:
7980
scripts:
8081
- gen_cli_doc.py
82+
- license_gen.py
8183

8284
markdown_extensions:
8385
- pymdownx.superfences

0 commit comments

Comments
 (0)