diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2018-03-19 13:04:11 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-04-29 13:21:05 +0000 |
commit | 8d04f876e73ae16a6381ba45bbe51377ad23a60f (patch) | |
tree | 0a110da096be94d181b30f9def9fbf0d8c4e6c4e /coin/provisioning/common/windows/helpers.ps1 | |
parent | e3699c5a6fe299e94510a34d2af80e5526461f86 (diff) |
windows provisioning: Do not use Windows builtin way of extracting zips
The builtin way of Windows for handling zip files is much slower than
using 7zip. A small benchmark (not representative, just extracting the
android ndk) showed 11 minutes using Extract-Zip vs 2,5 minutes using
Extract-7Zip on my machine.
Change-Id: I5198aabb5b75860ead687581fc5e368eb75e48ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'coin/provisioning/common/windows/helpers.ps1')
-rw-r--r-- | coin/provisioning/common/windows/helpers.ps1 | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1 index 45779c04..a2535b25 100644 --- a/coin/provisioning/common/windows/helpers.ps1 +++ b/coin/provisioning/common/windows/helpers.ps1 @@ -38,7 +38,8 @@ function Extract-7Zip { Param ( [string]$Source, - [string]$Destination + [string]$Destination, + [string]$Filter ) Write-Host "Extracting '$Source' to '$Destination'..." @@ -54,47 +55,10 @@ function Extract-7Zip $zipExe = "7z.exe" } - Run-Executable "$zipExe" "x -y `"-o$Destination`" `"$Source`"" -} - -function Extract-Zip -{ - Param ( - [string]$Source, - [string]$Destination - ) - Write-Host "Extracting '$Source' to '$Destination'..." - - New-Item -ItemType Directory -Force -Path $Destination - $shell = new-object -com shell.application - $zipfile = $shell.Namespace($Source) - $destinationFolder = $shell.Namespace($Destination) - $destinationFolder.CopyHere($zipfile.Items(), 16) -} - -function Extract-Dev-Folders-From-Zip -{ - Param ( - [string]$package, - [string]$zipDir, - [string]$installPath - ) - - $shell = new-object -com shell.application - - Write-Host "Extracting contents of $package" - foreach ($subDir in "lib", "include", "bin", "share") { - $zip = $shell.Namespace($package + "\" + $zipDir + "\" + $subDir) - if ($zip) { - Write-Host "Extracting $subDir from zip archive" - } else { - Write-Host "$subDir is missing from zip archive - skipping" - continue - } - $destDir = $installPath + "\" + $subdir - New-Item $destDir -type directory - $destinationFolder = $shell.Namespace($destDir) - $destinationFolder.CopyHere($zip.Items(), 16) + if ([string]::IsNullOrEmpty($Filter)) { + Run-Executable "$zipExe" "x -y `"-o$Destination`" `"$Source`"" + } else { + Run-Executable "$zipExe" "x -y -aoa `"-o$Destination`" `"$Source`" $Filter" } } |