Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fail windows bundle when cargo about fails (#48056)

Conrad Irwina6ab1f1eb746
diff --git a/script/bundle-windows.ps1 b/script/bundle-windows.ps1
index f4b83785f99..53527e1b8f9 100644
--- a/script/bundle-windows.ps1
+++ b/script/bundle-windows.ps1
@@ -96,10 +96,7 @@ function PrepareForBundle {
}
function GenerateLicenses {
- $oldErrorActionPreference = $ErrorActionPreference
- $ErrorActionPreference = 'Continue'
. $PSScriptRoot/generate-licenses.ps1
- $ErrorActionPreference = $oldErrorActionPreference
}
function BuildZedAndItsFriends {
diff --git a/script/generate-licenses.ps1 b/script/generate-licenses.ps1
index 80cd249a465..ae1c470eaef 100644
--- a/script/generate-licenses.ps1
+++ b/script/generate-licenses.ps1
@@ -1,3 +1,6 @@
+$ErrorActionPreference = 'Stop'
+$PSNativeCommandUseErrorActionPreference = $true
+
$CARGO_ABOUT_VERSION="0.8.2"
$outputFile=$args[0] ? $args[0] : "$(Get-Location)/assets/licenses.md"
$templateFile="script/licenses/template.md.hbs"
@@ -12,12 +15,21 @@ New-Item -Path "$outputFile" -ItemType File -Value "" -Force
"\n# ###### CODE LICENSES ######\n"
) | Add-Content -Path $outputFile
-$versionOutput = cargo about --version
-if (-not ($versionOutput -match "cargo-about $CARGO_ABOUT_VERSION")) {
+$needsInstall = $false
+try {
+ $versionOutput = cargo about --version
+ if (-not ($versionOutput -match "cargo-about $CARGO_ABOUT_VERSION")) {
+ $needsInstall = $true
+ } else {
+ Write-Host "cargo-about@$CARGO_ABOUT_VERSION is already installed"
+ }
+} catch {
+ $needsInstall = $true
+}
+
+if ($needsInstall) {
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"