Include list of third-party licenses in the C++ docs

This isn't very pretty, but I think it does the job.

cc #6634
This commit is contained in:
Simon Hausmann 2024-12-16 10:52:50 +01:00 committed by Simon Hausmann
parent f025ecf703
commit a7f965c941
5 changed files with 86 additions and 28 deletions

27
about.toml Normal file
View file

@ -0,0 +1,27 @@
# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
accepted = [
"MIT",
"Apache-2.0",
"MPL-2.0",
"Zlib",
"BSD-2-Clause",
"BSD-3-Clause",
"CC0-1.0",
"BSL-1.0",
"ISC",
"Unicode-DFS-2016",
"Unicode-3.0",
"OpenSSL",
"WTFPL",
"GPL-3.0", # That's only for Slint
]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
"x86_64-apple-darwin",
]
ignore-build-dependencies = true
ignore-dev-dependencies = true
filter-noassertion = true

View file

@ -47,6 +47,13 @@ Slint C++ documentation
genindex genindex
.. toctree::
:maxdepth: 0
:hidden:
:caption: Third-Party Licenses
thirdparty.md
.. image:: https://github.com/slint-ui/slint/workflows/CI/badge.svg .. image:: https://github.com/slint-ui/slint/workflows/CI/badge.svg
:target: https://github.com/slint-ui/slint/actions :target: https://github.com/slint-ui/slint/actions
:alt: GitHub CI Build Status :alt: GitHub CI Build Status

View file

@ -0,0 +1,29 @@
# Third Party Licenses
This page lists the licenses of the dependencies used by Slint.
## Overview of licenses
{{#each overview}}
- [{{name}}](#{{id}}) ({{count}})
{{/each}}
## All License Text
{{#each licenses}}
### <a id="{{id}}"></a> {{name}}
#### Used by:
{{#each used_by}}
- [{{crate.name}} {{crate.version}}]({{#if crate.repository}} {{crate.repository}} {{else}}
https://crates.io/crates/{{crate.name}} {{/if}})
{{/each}}
#### License Text
```
{{text}}
```
{{/each}}

View file

@ -70,31 +70,4 @@ cat > about.hbs <<EOT
<main></body></html> <main></body></html>
EOT EOT
cat > about.toml << EOT cargo about generate -c `dirname $0`/../about.toml about.hbs -o $target_path/index.html
accepted = [
"MIT",
"Apache-2.0",
"MPL-2.0",
"Zlib",
"BSD-2-Clause",
"BSD-3-Clause",
"CC0-1.0",
"BSL-1.0",
"ISC",
"Unicode-DFS-2016",
"Unicode-3.0",
"OpenSSL",
"WTFPL",
"GPL-3.0", # That's only for Slint
]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
"x86_64-apple-darwin",
]
ignore-build-dependencies = true
ignore-dev-dependencies = true
filter-noassertion = true
EOT
cargo about generate about.hbs -o $target_path/index.html

View file

@ -107,6 +107,28 @@ pub fn generate(show_warnings: bool, experimental: bool) -> Result<(), Box<dyn s
let pip_env = vec![(OsString::from("PIPENV_PIPFILE"), docs_source_dir.join("docs/Pipfile"))]; let pip_env = vec![(OsString::from("PIPENV_PIPFILE"), docs_source_dir.join("docs/Pipfile"))];
println!("Generating third-party license list with cargo-about");
let cargo_about_output = super::run_command(
"cargo",
&[
"about",
"generate",
"--manifest-path",
"api/cpp/Cargo.toml",
"api/cpp/docs/thirdparty.hbs",
"-o",
docs_build_dir.join("thirdparty.md").to_str().unwrap(),
],
pip_env.clone(),
)?;
println!(
"{}\n{}",
String::from_utf8_lossy(&cargo_about_output.stdout),
String::from_utf8_lossy(&cargo_about_output.stderr)
);
println!("Running pipenv install"); println!("Running pipenv install");
super::run_command("pipenv", &["install"], pip_env.clone()) super::run_command("pipenv", &["install"], pip_env.clone())