parent
af71e15ea0
commit
cd024b8870
2 changed files with 52 additions and 0 deletions
|
@ -56,6 +56,13 @@ function PrepareForBundle {
|
||||||
New-Item -Path "$innoDir\tools" -ItemType Directory -Force
|
New-Item -Path "$innoDir\tools" -ItemType Directory -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GenerateLicenses {
|
||||||
|
$oldErrorActionPreference = $ErrorActionPreference
|
||||||
|
$ErrorActionPreference = 'Continue'
|
||||||
|
. $PSScriptRoot/generate-licenses.ps1
|
||||||
|
$ErrorActionPreference = $oldErrorActionPreference
|
||||||
|
}
|
||||||
|
|
||||||
function BuildZedAndItsFriends {
|
function BuildZedAndItsFriends {
|
||||||
Write-Output "Building Zed and its friends, for channel: $channel"
|
Write-Output "Building Zed and its friends, for channel: $channel"
|
||||||
# Build zed.exe, cli.exe and auto_update_helper.exe
|
# Build zed.exe, cli.exe and auto_update_helper.exe
|
||||||
|
@ -238,6 +245,7 @@ $innoDir = "$env:ZED_WORKSPACE\inno"
|
||||||
|
|
||||||
CheckEnvironmentVariables
|
CheckEnvironmentVariables
|
||||||
PrepareForBundle
|
PrepareForBundle
|
||||||
|
GenerateLicenses
|
||||||
BuildZedAndItsFriends
|
BuildZedAndItsFriends
|
||||||
MakeAppx
|
MakeAppx
|
||||||
SignZedAndItsFriends
|
SignZedAndItsFriends
|
||||||
|
|
44
script/generate-licenses.ps1
Normal file
44
script/generate-licenses.ps1
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
$CARGO_ABOUT_VERSION="0.7"
|
||||||
|
$outputFile=$args[0] ? $args[0] : "$(Get-Location)/assets/licenses.md"
|
||||||
|
$templateFile="script/licenses/template.md.hbs"
|
||||||
|
|
||||||
|
New-Item -Path "$outputFile" -ItemType File -Value "" -Force
|
||||||
|
|
||||||
|
@(
|
||||||
|
"# ###### THEME LICENSES ######\n"
|
||||||
|
Get-Content assets/themes/LICENSES
|
||||||
|
"\n# ###### ICON LICENSES ######\n"
|
||||||
|
Get-Content assets/icons/LICENSES
|
||||||
|
"\n# ###### CODE LICENSES ######\n"
|
||||||
|
) | Add-Content -Path $outputFile
|
||||||
|
|
||||||
|
$versionOutput = cargo about --version
|
||||||
|
if (-not ($versionOutput -match "cargo-about $CARGO_ABOUT_VERSION")) {
|
||||||
|
Write-Host "Installing cargo-about@^$CARGO_ABOUT_VERSION..."
|
||||||
|
cargo install "cargo-about@^$CARGO_ABOUT_VERSION"
|
||||||
|
} else {
|
||||||
|
Write-Host "cargo-about@^$CARGO_ABOUT_VERSION" is already installed
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Generating cargo licenses"
|
||||||
|
|
||||||
|
$failFlag = $env:ALLOW_MISSING_LICENSES ? "--fail" : ""
|
||||||
|
$args = @('about', 'generate', $failFlag, '-c', 'script/licenses/zed-licenses.toml', $templateFile, '-o', $outputFile) | Where-Object { $_ }
|
||||||
|
cargo @args
|
||||||
|
|
||||||
|
Write-Host "Applying replacements"
|
||||||
|
$replacements = @{
|
||||||
|
'"' = '"'
|
||||||
|
''' = "'"
|
||||||
|
'=' = '='
|
||||||
|
'`' = '`'
|
||||||
|
'<' = '<'
|
||||||
|
'>' = '>'
|
||||||
|
}
|
||||||
|
$content = Get-Content $outputFile
|
||||||
|
foreach ($find in $replacements.keys) {
|
||||||
|
$content = $content -replace $find, $replacements[$find]
|
||||||
|
}
|
||||||
|
$content | Set-Content $outputFile
|
||||||
|
|
||||||
|
Write-Host "generate-licenses completed. See $outputFile"
|
Loading…
Add table
Add a link
Reference in a new issue