From c0d0301feb38c28444d7ff7cd1ccb0fcbf64a66b Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Wed, 7 Oct 2020 12:53:23 +0100 Subject: [PATCH] Support zipping packaged variants if requested --- ue4-package.ps1 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ue4-package.ps1 b/ue4-package.ps1 index 296f72b..0e8b63c 100644 --- a/ue4-package.ps1 +++ b/ue4-package.ps1 @@ -240,8 +240,10 @@ try { Write-Output "Building variant: $($var.Name)" if ($dryrun) { + Write-Output "" Write-Output "Would have run:" Write-Output "> $runUAT $($argList -join " ")" + Write-Output "" } else { $proc = Start-Process $runUAT $argList -Wait -PassThru -NoNewWindow @@ -250,6 +252,33 @@ try { } } + + if ($var.Zip) { + if ($dryrun) { + Write-Output "Would have compressed $outdir to $(Join-Path $config.ZipDir "$($config.Target)_$($versionNumber)_$($var.Name).zip")" + } else { + # We zip all subfolders of the out dir separately + # Since there may be multiple build dirs in the case of server & client builds + # E.g. WindowsNoEditor vs WindowsServer + # BUT we omit the folder name in the zip if there's only one, for brevity + $subdirs = @(Get-ChildItem $outdir) + $multipleBuilds = ($subdirs.Count > 1) + $subdirs | ForEach-Object { + $zipsrc = "$($_.FullName)\*" # excludes folder name, compress contents + $subdirSuffix = "" + if ($multipleBuilds) { + # Only include "WindowsNoEditor" etc part if there's a need to disambiguate + $subdirSuffix = "_$($_.BaseName)" + } + $zipdst = Join-Path $config.ZipDir "$($config.Target)_$($versionNumber)_$($var.Name)$subdirSuffix.zip" + + New-Item -ItemType Directory -Path $config.ZipDir -Force > $null + Write-Output "Compressing to $zipdst" + Compress-Archive -Path $zipsrc -DestinationPath $zipdst + } + + } + } } }