@@ -428,6 +428,12 @@ function BuildSetup()
428428 # Set innosetup path
429429 $innobuild = " ${env: ProgramFiles(x86)} \Inno Setup 5\ISCC.exe"
430430
431+ if (! (Test-Path $innobuild ))
432+ {
433+ Write-Host " `t [SKIPPED] (Inno Setup not installed)" - ForegroundColor Yellow
434+ return ;
435+ }
436+
431437 # Execute the Inno setup
432438 if ($global :debug_enabled )
433439 {
@@ -456,6 +462,12 @@ function BuildSdkZip()
456462 # Set 7-Zip executable path
457463 $7zip = " ${env: ProgramFiles} \7-Zip\7z.exe"
458464
465+ if (! (Test-Path $7zip ))
466+ {
467+ Write-Host " `t [SKIPPED] (7-Zip not installed)" - ForegroundColor Yellow
468+ return ;
469+ }
470+
459471 # Execute the Inno setup
460472 if ($global :debug_enabled )
461473 {
@@ -498,6 +510,12 @@ function BuildZip()
498510 # Set 7-Zip path
499511 $7zip = " ${env: ProgramFiles} \7-Zip\7z.exe"
500512
513+ if (! (Test-Path $7zip ))
514+ {
515+ Write-Host " `t [SKIPPED] (7-Zip not installed)" - ForegroundColor Yellow
516+ return ;
517+ }
518+
501519 # Execute 7-Zip
502520 if ($global :debug_enabled )
503521 {
@@ -533,6 +551,12 @@ function BuildSourceZip()
533551 # Set git executable path
534552 $git = " ${env: ProgramFiles} \Git\cmd\git.exe"
535553
554+ if (! (Test-Path $git ))
555+ {
556+ Write-Host " `t [SKIPPED] (Git not installed)" - ForegroundColor Yellow
557+ return ;
558+ }
559+
536560 & $git " --git-dir=.git" ,
537561 " --work-tree=.\" ,
538562 " archive" ,
@@ -555,15 +579,25 @@ function GenerateHashes()
555579 # Create Arraylist
556580 $array = $ ();
557581
558- # Append the result of Get-FileHash to the Arraylist
559- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-setup.exe" - Algorithm SHA1 - OutVariable + array | Out-Null
560- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-setup.exe" - Algorithm SHA256 - OutVariable + array | Out-Null
561- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-sdk.zip" - Algorithm SHA1 - OutVariable + array | Out-Null
562- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-sdk.zip" - Algorithm SHA256 - OutVariable + array | Out-Null
563- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-bin.zip" - Algorithm SHA1 - OutVariable + array | Out-Null
564- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-bin.zip" - Algorithm SHA256 - OutVariable + array | Out-Null
565- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-src.zip" - Algorithm SHA1 - OutVariable + array | Out-Null
566- Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \processhacker-nightly-src.zip" - Algorithm SHA256 - OutVariable + array | Out-Null
582+ $file_names =
583+ " processhacker-nightly-setup.exe" ,
584+ " processhacker-nightly-sdk.zip" ,
585+ " processhacker-nightly-bin.zip" ,
586+ " processhacker-nightly-src.zip" ;
587+
588+ foreach ($file in $file_names )
589+ {
590+ if (! (Test-Path " ${env: BUILD_OUTPUT_FOLDER} \$file " ))
591+ {
592+ if ($global :debug_enabled )
593+ {
594+ Write-Host " `t (SKIPPED: $file )" - NoNewline - ForegroundColor Yellow
595+ }
596+ continue ;
597+ }
598+
599+ Get-FileHash " ${env: BUILD_OUTPUT_FOLDER} \$file " - Algorithm SHA256 - OutVariable + array | Out-Null
600+ }
567601
568602 # Convert the Arraylist to a string
569603 $data = $array | Out-String
0 commit comments