Commit 7ede6b53 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Use 7-Zip to unzip SDK, if available. (#8721)

Windows' built-in unzippers are painfully slow. It drives me mad!

Unzip SDK with 7-Zip: ~10s
Unzip SDK with Windows: ~90s
parent 5d29737a
...@@ -44,10 +44,14 @@ Import-Module BitsTransfer ...@@ -44,10 +44,14 @@ Import-Module BitsTransfer
Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip
Write-Host "Unzipping Dart SDK..." Write-Host "Unzipping Dart SDK..."
if (Get-Command Expand-Archive -errorAction SilentlyContinue) { If (Get-Command 7z -errorAction SilentlyContinue) {
# Expand-Archive requires PowerShell 5 or newer # The built-in unzippers are painfully slow. Use 7-Zip, if available.
& 7z x $dartSdkZip -o"$cachePath" -bd | Out-Null
} ElseIf (Get-Command Expand-Archive -errorAction SilentlyContinue) {
# Use PowerShell's built-in unzipper, if available (requires PowerShell 5+).
Expand-Archive $dartSdkZip -DestinationPath $cachePath Expand-Archive $dartSdkZip -DestinationPath $cachePath
} else { } Else {
# As last resort: fall back to the Windows GUI.
$shell = New-Object -com shell.application $shell = New-Object -com shell.application
$zip = $shell.NameSpace($dartSdkZip) $zip = $shell.NameSpace($dartSdkZip)
foreach($item in $zip.items()) { foreach($item in $zip.items()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment