From 03222ccf2c6e249fda5327877c576aad36cabe2c Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 31 Dec 2024 09:55:45 +0000 Subject: [PATCH 1/4] docs: format LICENSE and fix typo --- .github/workflows/bump-n-release.yml | 2 +- LICENSE | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bump-n-release.yml b/.github/workflows/bump-n-release.yml index dfbcbf8a..ef8ff8ad 100644 --- a/.github/workflows/bump-n-release.yml +++ b/.github/workflows/bump-n-release.yml @@ -40,7 +40,7 @@ jobs: - run: yarn global add @napi-rs/cli - uses: cargo-bins/cargo-binstall@main - run: cargo binstall -y git-cliff - - name: Bump ${{ inputs.component }} verion + - name: Bump ${{ inputs.component }} version env: GITHUB_TOKEN: ${{ secrets.BUMP_N_RELEASE }} GH_TOKEN: ${{ secrets.BUMP_N_RELEASE }} diff --git a/LICENSE b/LICENSE index 6c80e74e..b9c4642f 100644 --- a/LICENSE +++ b/LICENSE @@ -2,8 +2,20 @@ MIT License Copyright (c) 2024 2bndy5 -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: +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: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -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. +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. From 18f2985fd97e377586cf8e4bcac9a58a084c65d2 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 31 Dec 2024 10:04:20 +0000 Subject: [PATCH 2/4] docs: move third-party license to a singal file --- README.md | 52 +----------------------------------- docs/THIRD-PARTY-LICENSES.md | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 51 deletions(-) create mode 100644 docs/THIRD-PARTY-LICENSES.md diff --git a/README.md b/README.md index 91840d4e..16eb7fed 100644 --- a/README.md +++ b/README.md @@ -174,54 +174,4 @@ To provide feedback (requesting a feature or reporting a bug) please post to The scripts and documentation in this project are released under the [MIT]. -Dependencies (that are redistributed by us in binary form) have the following -license agreements: - -- [clap](https://crates.io/crates/clap): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [git2](https://crates.io/crates/git2): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - - The following are conditionally included in binaries (using the `openssl-vendored` feature on a - case-by-case basis) because it is a dependency of git2: - - - [openssl](https://crates.io/crates/openssl): Licensed under [Apache 2.0][Apache2] - - [openssl-probe](https://crates.io/crates/openssl-probe): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - -- [lenient_semver](https://crates.io/crates/lenient_semver): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [log](https://crates.io/crates/log): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [regex](https://crates.io/crates/regex): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [reqwest](https://crates.io/crates/reqwest): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [semver](https://crates.io/crates/semver): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [serde](https://crates.io/crates/serde): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [serde-xml-rs](https://crates.io/crates/serde-xml-rs): Licensed under [MIT]. -- [serde_json](https://crates.io/crates/serde_json): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [which](https://crates.io/crates/which): Licensed under [MIT]. -- [tokio](https://crates.io/crates/tokio): Licensed under [MIT]. -- [futures](https://crates.io/crates/futures): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [chrono](https://crates.io/crates/chrono): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [colored](https://crates.io/crates/colored): Licensed under [MPL-2.0] - -The python binding uses - -- [pyo3](https://crates.io/crates/pyo3): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - -The node binding uses - -- [napi](https://crates.io/crates/napi): Licensed under [MIT] -- [napi-derive](https://crates.io/crates/napi-derive): Licensed under [MIT] - -[MIT]: https://choosealicense.com/licenses/mit -[Apache2]: https://choosealicense.com/licenses/apache-2.0/ -[MPL-2.0]: https://choosealicense.com/licenses/mpl-2.0 +Dependencies (that are redistributed by us in binary form) and their licenses, refer to [THIRD-PARTY LICENSES](docs/THIRD-PARTY-LICENSES.md). diff --git a/docs/THIRD-PARTY-LICENSES.md b/docs/THIRD-PARTY-LICENSES.md new file mode 100644 index 00000000..3ade4a52 --- /dev/null +++ b/docs/THIRD-PARTY-LICENSES.md @@ -0,0 +1,48 @@ +- [clap](https://crates.io/crates/clap): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [git2](https://crates.io/crates/git2): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. + + The following are conditionally included in binaries (using the `openssl-vendored` feature on a + case-by-case basis) because it is a dependency of git2: + + - [openssl](https://crates.io/crates/openssl): Licensed under [Apache 2.0][Apache2] + - [openssl-probe](https://crates.io/crates/openssl-probe): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. + +- [lenient_semver](https://crates.io/crates/lenient_semver): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [log](https://crates.io/crates/log): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [regex](https://crates.io/crates/regex): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [reqwest](https://crates.io/crates/reqwest): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [semver](https://crates.io/crates/semver): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [serde](https://crates.io/crates/serde): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [serde-xml-rs](https://crates.io/crates/serde-xml-rs): Licensed under [MIT]. +- [serde_json](https://crates.io/crates/serde_json): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [which](https://crates.io/crates/which): Licensed under [MIT]. +- [tokio](https://crates.io/crates/tokio): Licensed under [MIT]. +- [futures](https://crates.io/crates/futures): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [chrono](https://crates.io/crates/chrono): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. +- [colored](https://crates.io/crates/colored): Licensed under [MPL-2.0] + +The python binding uses + +- [pyo3](https://crates.io/crates/pyo3): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. + +The node binding uses + +- [napi](https://crates.io/crates/napi): Licensed under [MIT] +- [napi-derive](https://crates.io/crates/napi-derive): Licensed under [MIT] + +[MIT]: https://choosealicense.com/licenses/mit +[Apache2]: https://choosealicense.com/licenses/apache-2.0/ +[MPL-2.0]: https://choosealicense.com/licenses/mpl-2.0 From 1009f12f9734d7301b41f2e201778c4ceaabeebf Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Tue, 31 Dec 2024 13:26:41 -0800 Subject: [PATCH 3/4] changes for mkdocs build --- README.md | 7 +++++-- docs/docs/index.md | 1 + .../other-licenses.md} | 12 +++++++----- docs/mkdocs.yml | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) rename docs/{THIRD-PARTY-LICENSES.md => docs/other-licenses.md} (82%) diff --git a/README.md b/README.md index 16eb7fed..476320d1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [step-summary]: https://cpp-linter.github.io/cpp-linter-rs/cli#-w-step-summary [tidy-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-d-tidy-review [format-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-m-format-review +[other-licenses]: https://cpp-linter.github.io/cpp-linter-rs/other-licenses [format-annotations-preview]: docs/docs/images/annotations-clang-format.png [tidy-annotations-preview]: docs/docs/images/annotations-clang-tidy.png @@ -172,6 +173,8 @@ To provide feedback (requesting a feature or reporting a bug) please post to ## License -The scripts and documentation in this project are released under the [MIT]. +The scripts and documentation in this project are released under the [MIT] license. -Dependencies (that are redistributed by us in binary form) and their licenses, refer to [THIRD-PARTY LICENSES](docs/THIRD-PARTY-LICENSES.md). +As for dependencies (that are redistributed by us in binary form) and their licenses, refer to [THIRD-PARTY LICENSES][other-licenses]. + +[MIT]: https://choosealicense.com/licenses/mit diff --git a/docs/docs/index.md b/docs/docs/index.md index 627e8a7e..e13f7edf 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -5,6 +5,7 @@ [step-summary]: cli.md#-w-step-summary [tidy-review]: cli.md#-d-tidy-review [format-review]: cli.md#-m-format-review +[other-licenses]: other-licenses.md [format-annotations-preview]: images/annotations-clang-format.png [tidy-annotations-preview]: images/annotations-clang-tidy.png diff --git a/docs/THIRD-PARTY-LICENSES.md b/docs/docs/other-licenses.md similarity index 82% rename from docs/THIRD-PARTY-LICENSES.md rename to docs/docs/other-licenses.md index 3ade4a52..52631ef9 100644 --- a/docs/THIRD-PARTY-LICENSES.md +++ b/docs/docs/other-licenses.md @@ -1,14 +1,16 @@ +# Third-party Licenses + - [clap](https://crates.io/crates/clap): Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - [git2](https://crates.io/crates/git2): Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - The following are conditionally included in binaries (using the `openssl-vendored` feature on a - case-by-case basis) because it is a dependency of git2: + The following are conditionally included in binaries (using the `openssl-vendored` feature on a + case-by-case basis) because it is a dependency of git2: - - [openssl](https://crates.io/crates/openssl): Licensed under [Apache 2.0][Apache2] - - [openssl-probe](https://crates.io/crates/openssl-probe): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. + - [openssl](https://crates.io/crates/openssl): Licensed under [Apache 2.0][Apache2] + - [openssl-probe](https://crates.io/crates/openssl-probe): + Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - [lenient_semver](https://crates.io/crates/lenient_semver): Dual-licensed under [Apache 2.0][Apache2] or [MIT]. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index a968d563..498cd4cb 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -12,6 +12,7 @@ nav: - python.md - node.md - changelog.md + - other-licenses.md theme: name: material From 3eba10d8d02f2eb618aa92da0eee8656746f16ce Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Tue, 31 Dec 2024 15:36:23 -0800 Subject: [PATCH 4/4] generate license list from `cargo tree` --- docs/docs/other-licenses.md | 51 ++------------------------- docs/license_gen.py | 70 +++++++++++++++++++++++++++++++++++++ docs/mkdocs.yml | 1 + 3 files changed, 74 insertions(+), 48 deletions(-) create mode 100644 docs/license_gen.py diff --git a/docs/docs/other-licenses.md b/docs/docs/other-licenses.md index 52631ef9..af04be4a 100644 --- a/docs/docs/other-licenses.md +++ b/docs/docs/other-licenses.md @@ -1,50 +1,5 @@ # Third-party Licenses -- [clap](https://crates.io/crates/clap): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [git2](https://crates.io/crates/git2): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - - The following are conditionally included in binaries (using the `openssl-vendored` feature on a - case-by-case basis) because it is a dependency of git2: - - - [openssl](https://crates.io/crates/openssl): Licensed under [Apache 2.0][Apache2] - - [openssl-probe](https://crates.io/crates/openssl-probe): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - -- [lenient_semver](https://crates.io/crates/lenient_semver): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [log](https://crates.io/crates/log): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [regex](https://crates.io/crates/regex): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [reqwest](https://crates.io/crates/reqwest): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [semver](https://crates.io/crates/semver): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [serde](https://crates.io/crates/serde): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [serde-xml-rs](https://crates.io/crates/serde-xml-rs): Licensed under [MIT]. -- [serde_json](https://crates.io/crates/serde_json): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [which](https://crates.io/crates/which): Licensed under [MIT]. -- [tokio](https://crates.io/crates/tokio): Licensed under [MIT]. -- [futures](https://crates.io/crates/futures): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [chrono](https://crates.io/crates/chrono): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. -- [colored](https://crates.io/crates/colored): Licensed under [MPL-2.0] - -The python binding uses - -- [pyo3](https://crates.io/crates/pyo3): - Dual-licensed under [Apache 2.0][Apache2] or [MIT]. - -The node binding uses - -- [napi](https://crates.io/crates/napi): Licensed under [MIT] -- [napi-derive](https://crates.io/crates/napi-derive): Licensed under [MIT] - -[MIT]: https://choosealicense.com/licenses/mit -[Apache2]: https://choosealicense.com/licenses/apache-2.0/ -[MPL-2.0]: https://choosealicense.com/licenses/mpl-2.0 +This page is generated when mkdocs builds. +All content here is overwritten when building the docs. +For changes to this document, please refer to [license_gen.py](../license_gen.py). diff --git a/docs/license_gen.py b/docs/license_gen.py new file mode 100644 index 00000000..2df5110c --- /dev/null +++ b/docs/license_gen.py @@ -0,0 +1,70 @@ +import mkdocs_gen_files +from subprocess import run + +FILENAME = "other-licenses.md" + +INTRO = """# Third-party Licenses + +[MIT]: https://choosealicense.com/licenses/mit +[Apache-2.0]: https://choosealicense.com/licenses/apache-2.0/ +[MPL-2.0]: https://choosealicense.com/licenses/mpl-2.0 +""" + +OPTIONAL_DEPS = """## Optional dependencies + +The following are conditionally included in binaries (using the `openssl-vendored` +feature on a case-by-case basis) because it is a dependency of +[git2](https://crates.io/crates/git2): + +- [openssl](https://crates.io/crates/openssl): Licensed under [Apache-2.0]. +- [openssl-probe](https://crates.io/crates/openssl-probe): + Dual-licensed under [Apache-2.0] or [MIT]. +""" + +BINDING_DEPS = """## Bindings' dependencies + +The python binding uses + +- [pyo3](https://crates.io/crates/pyo3): + Dual-licensed under [Apache-2.0] or [MIT]. + +The node binding uses + +- [napi](https://crates.io/crates/napi): Licensed under [MIT] +- [napi-derive](https://crates.io/crates/napi-derive): Licensed under [MIT] +""" + +with mkdocs_gen_files.open(FILENAME, "w") as io_doc: + print(INTRO, file=io_doc) + output = run( + [ + "cargo", + "tree", + "-f", + r"[{p}]({r}): Licensed under {l}", + "-e", + "normal", + "-p", + "cpp-linter", + "--depth", + "1", + ], + capture_output=True, + check=True, + ) + doc = "\n".join( + [ + "- " + + line[3:] + .replace(" MIT", " [MIT]") + .replace(" Apache-2.0", " [Apache-2.0]") + .replace(" MPL-2.0", " [MPL-2.0]") + for line in output.stdout.decode(encoding="utf-8").splitlines()[1:] + ] + ) + # print(doc) + print(doc, file=io_doc) + print(f"\n{OPTIONAL_DEPS}\n", file=io_doc) + print(f"\n{BINDING_DEPS}\n", file=io_doc) + +mkdocs_gen_files.set_edit_path(FILENAME, "license-gen.py") diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 498cd4cb..48cbb107 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -79,6 +79,7 @@ plugins: - gen-files: scripts: - gen_cli_doc.py + - license_gen.py markdown_extensions: - pymdownx.superfences