Skip to content

Commit 6018bf9

Browse files
committed
windows-compile-vs.ps1: fixed obscenely slow downloads & unzipping
1 parent d7bf500 commit 6018bf9

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

windows-compile-vs.ps1

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$ErrorActionPreference="Stop"
2+
$ProgressPreference="SilentlyContinue"
23

34
$PHP_VERSIONS=@("8.2.25", "8.3.13")
45

@@ -238,6 +239,18 @@ function download-file {
238239
return $cached_path
239240
}
240241

242+
function unzip-file {
243+
param ([string] $file, [string] $destination)
244+
245+
#expand-archive doesn't respect script-local ProgressPreference
246+
#https://github.com/PowerShell/Microsoft.PowerShell.Archive/issues/77
247+
$oldProgressPref = $global:ProgressPreference
248+
$global:ProgressPreference = "SilentlyContinue"
249+
Expand-Archive -Path $file -DestinationPath $destination >> $log_file 2>&1
250+
$global:ProgressPreference = $oldProgressPref
251+
}
252+
253+
241254
function append-file-utf8 {
242255
param ([string] $line, [string] $file)
243256

@@ -250,7 +263,7 @@ function download-sdk {
250263
write-download
251264
$file = download-file "https://github.com/php/php-sdk-binary-tools/archive/refs/tags/php-sdk-$PHP_SDK_VER.zip" "php-sdk"
252265
write-extracting
253-
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
266+
unzip-file $file $pwd
254267
Move-Item "php-sdk-binary-tools-php-sdk-$PHP_SDK_VER" $SOURCES_PATH
255268
write-done
256269
}
@@ -286,7 +299,7 @@ function build-yaml {
286299
write-download
287300
$file = download-file "https://github.com/yaml/libyaml/archive/$LIBYAML_VER.zip" "yaml"
288301
write-extracting
289-
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
302+
unzip-file $file $pwd
290303
Move-Item "libyaml-$LIBYAML_VER" libyaml >> $log_file 2>&1
291304
Push-Location libyaml
292305

@@ -310,7 +323,7 @@ function build-pthreads4w {
310323
write-download
311324
$file = download-file "https://github.com/pmmp/DependencyMirror/releases/download/mirror/pthreads4w-code-v$PTHREAD_W32_VER.zip" "pthreads4w"
312325
write-extracting
313-
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
326+
unzip-file $file $pwd
314327
Move-Item "pthreads4w-code-*" pthreads4w >> $log_file 2>&1
315328
Push-Location pthreads4w
316329

@@ -334,7 +347,7 @@ function build-leveldb {
334347
write-download
335348
$file = download-file "https://github.com/pmmp/leveldb/archive/$LEVELDB_MCPE_VER.zip"
336349
write-extracting
337-
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
350+
unzip-file $file $pwd
338351
Move-Item leveldb-* leveldb >> $log_file 2>&1
339352
Push-Location leveldb
340353

@@ -362,7 +375,7 @@ function build-libdeflate {
362375
write-download
363376
$file = download-file "https://github.com/ebiggers/libdeflate/archive/$LIBDEFLATE_VER.zip"
364377
write-extracting
365-
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
378+
unzip-file $file $pwd
366379
Move-Item libdeflate-* libdeflate >> $log_file 2>&1
367380
Push-Location libdeflate
368381

@@ -390,7 +403,7 @@ function download-php {
390403

391404
$file = download-file "https://github.com/php/php-src/archive/$PHP_GIT_REV.zip" "php"
392405
write-extracting
393-
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
406+
unzip-file $file $pwd
394407
Move-Item "php-src-$PHP_GIT_REV" php-src >> $log_file 2>&1
395408
write-done
396409
}
@@ -402,7 +415,7 @@ function get-extension-zip {
402415
write-download
403416
$file = download-file $url "php-ext-$name"
404417
write-extracting
405-
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
418+
unzip-file $file $pwd
406419
write-done
407420
}
408421

0 commit comments

Comments
 (0)