Combine both license generations into one file
This commit is contained in:
parent
c44acaefff
commit
3a1d533c01
5 changed files with 31 additions and 51 deletions
|
@ -339,11 +339,7 @@ pub fn menus() -> Vec<Menu<'static>> {
|
||||||
},
|
},
|
||||||
MenuItem::Action {
|
MenuItem::Action {
|
||||||
name: "View Dependency Licenses",
|
name: "View Dependency Licenses",
|
||||||
action: Box::new(crate::OpenSoftwareLicenses),
|
action: Box::new(crate::OpenLicenses),
|
||||||
},
|
|
||||||
MenuItem::Action {
|
|
||||||
name: "View Theme Licenses",
|
|
||||||
action: Box::new(crate::OpenThemeLicenses),
|
|
||||||
},
|
},
|
||||||
MenuItem::Separator,
|
MenuItem::Separator,
|
||||||
MenuItem::Action {
|
MenuItem::Action {
|
||||||
|
|
|
@ -57,8 +57,7 @@ actions!(
|
||||||
DebugElements,
|
DebugElements,
|
||||||
OpenSettings,
|
OpenSettings,
|
||||||
OpenLog,
|
OpenLog,
|
||||||
OpenSoftwareLicenses,
|
OpenLicenses,
|
||||||
OpenThemeLicenses,
|
|
||||||
OpenTelemetryLog,
|
OpenTelemetryLog,
|
||||||
OpenKeymap,
|
OpenKeymap,
|
||||||
OpenDefaultSettings,
|
OpenDefaultSettings,
|
||||||
|
@ -180,32 +179,17 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||||
});
|
});
|
||||||
cx.add_action({
|
cx.add_action({
|
||||||
let app_state = app_state.clone();
|
let app_state = app_state.clone();
|
||||||
move |workspace: &mut Workspace,
|
move |workspace: &mut Workspace, _: &OpenLicenses, cx: &mut ViewContext<Workspace>| {
|
||||||
_: &OpenSoftwareLicenses,
|
|
||||||
cx: &mut ViewContext<Workspace>| {
|
|
||||||
open_bundled_file(
|
open_bundled_file(
|
||||||
workspace,
|
workspace,
|
||||||
app_state.clone(),
|
app_state.clone(),
|
||||||
"software_licenses.md",
|
"licenses.md",
|
||||||
"Open Source License Attribution",
|
"Open Source License Attribution",
|
||||||
"Markdown",
|
"Markdown",
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cx.add_action({
|
|
||||||
let app_state = app_state.clone();
|
|
||||||
move |workspace: &mut Workspace, _: &OpenThemeLicenses, cx: &mut ViewContext<Workspace>| {
|
|
||||||
open_bundled_file(
|
|
||||||
workspace,
|
|
||||||
app_state.clone(),
|
|
||||||
"theme_licenses.md",
|
|
||||||
"Theme License Attribution",
|
|
||||||
"Markdown",
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
cx.add_action({
|
cx.add_action({
|
||||||
let app_state = app_state.clone();
|
let app_state = app_state.clone();
|
||||||
move |workspace: &mut Workspace, _: &OpenTelemetryLog, cx: &mut ViewContext<Workspace>| {
|
move |workspace: &mut Workspace, _: &OpenTelemetryLog, cx: &mut ViewContext<Workspace>| {
|
||||||
|
|
|
@ -2,20 +2,27 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
OUTPUT_FILE=$(pwd)/assets/licenses.md
|
||||||
|
|
||||||
|
> $OUTPUT_FILE
|
||||||
|
|
||||||
|
echo -e "# ###### THEME LICENSES ######\n" >> $OUTPUT_FILE
|
||||||
|
|
||||||
|
echo "Generating theme licenses"
|
||||||
|
cd styles
|
||||||
|
npm run --silent build-licenses >> $OUTPUT_FILE
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo -e "# ###### CODE LICENSES ######\n" >> $OUTPUT_FILE
|
||||||
|
|
||||||
[[ "$(cargo about --version)" == "cargo-about 0.5.2" ]] || cargo install cargo-about --locked --git https://github.com/zed-industries/cargo-about --branch error-code-on-warn
|
[[ "$(cargo about --version)" == "cargo-about 0.5.2" ]] || cargo install cargo-about --locked --git https://github.com/zed-industries/cargo-about --branch error-code-on-warn
|
||||||
|
|
||||||
echo "Generating cargo licenses"
|
echo "Generating cargo licenses"
|
||||||
cargo about generate --fail-on-missing-license -o assets/software_licenses.md -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md
|
cargo about generate --fail-on-missing-license -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md >> $OUTPUT_FILE
|
||||||
|
|
||||||
# cargo about automatically html-escapes all output, so we need to undo it here:
|
sed -i '' 's/"/"/g' $OUTPUT_FILE
|
||||||
sed -i '' 's/"/"/g' assets/software_licenses.md
|
sed -i '' 's/'/'\''/g' $OUTPUT_FILE # The ` '\'' ` thing ends the string, appends a single quote, and re-opens the string
|
||||||
sed -i '' 's/'/'\''/g' assets/software_licenses.md # `'\''` ends the string, appends a single quote, and re-opens the string
|
sed -i '' 's/=/=/g' $OUTPUT_FILE
|
||||||
sed -i '' 's/=/=/g' assets/software_licenses.md
|
sed -i '' 's/`/`/g' $OUTPUT_FILE
|
||||||
sed -i '' 's/`/`/g' assets/software_licenses.md
|
sed -i '' 's/</</g' $OUTPUT_FILE
|
||||||
sed -i '' 's/</</g' assets/software_licenses.md
|
sed -i '' 's/>/>/g' $OUTPUT_FILE
|
||||||
sed -i '' 's/>/>/g' assets/software_licenses.md
|
|
||||||
|
|
||||||
# Now make theme licenses
|
|
||||||
echo "Generating theme licenses"
|
|
||||||
cd styles
|
|
||||||
npm run build-licenses
|
|
|
@ -1,20 +1,15 @@
|
||||||
# Third Party Licenses
|
|
||||||
|
|
||||||
This page lists the licenses of the projects used in Zed.
|
|
||||||
|
|
||||||
## Overview of licenses:
|
## Overview of licenses:
|
||||||
|
|
||||||
{{#each overview}}
|
{{#each overview}}
|
||||||
* {{name}} ({{count}})
|
* {{name}} ({{count}})
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
## All license texts:
|
### All license texts:
|
||||||
|
|
||||||
{{#each licenses}}
|
{{#each licenses}}
|
||||||
|
|
||||||
### {{name}}
|
#### {{name}}
|
||||||
|
|
||||||
#### Used by:
|
##### Used by:
|
||||||
|
|
||||||
{{#each used_by}}
|
{{#each used_by}}
|
||||||
* [{{crate.name}} {{crate.version}}]({{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}})
|
* [{{crate.name}} {{crate.version}}]({{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}})
|
||||||
|
@ -23,5 +18,4 @@ This page lists the licenses of the projects used in Zed.
|
||||||
{{text}}
|
{{text}}
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
{{/each}}
|
{{/each}}
|
|
@ -6,7 +6,7 @@ import {
|
||||||
import { Meta } from "./themes/common/colorScheme";
|
import { Meta } from "./themes/common/colorScheme";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
const license_file = `${__dirname}/../../assets/theme_licenses.md`
|
|
||||||
const accepted_licenses_file = `${__dirname}/../../script/licenses/zed-licenses.toml`
|
const accepted_licenses_file = `${__dirname}/../../script/licenses/zed-licenses.toml`
|
||||||
|
|
||||||
// Use the cargo-about configuration file as the source of truth for supported licenses.
|
// Use the cargo-about configuration file as the source of truth for supported licenses.
|
||||||
|
@ -62,14 +62,13 @@ function getLicenseText(schemeMeta: Meta[], callback: (meta: Meta, license_text:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeLicense(schemeMeta: Meta, text: String, stream: fs.WriteStream) {
|
function writeLicense(schemeMeta: Meta, text: String) {
|
||||||
stream.write(`# [${schemeMeta.name}](${schemeMeta.url})\n\n${text}\n******************************************************************************** \n`)
|
process.stdout.write(`## [${schemeMeta.name}](${schemeMeta.url})\n\n${text}\n********************************************************************************\n\n`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const accepted_licenses = parseAcceptedToml(accepted_licenses_file);
|
const accepted_licenses = parseAcceptedToml(accepted_licenses_file);
|
||||||
checkLicenses(schemeMeta, accepted_licenses)
|
checkLicenses(schemeMeta, accepted_licenses)
|
||||||
|
|
||||||
const stream = fs.createWriteStream(license_file);
|
|
||||||
getLicenseText(schemeMeta, (meta, text) => {
|
getLicenseText(schemeMeta, (meta, text) => {
|
||||||
writeLicense(meta, text, stream)
|
writeLicense(meta, text)
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue