diff --git a/src/ue4docker/dockerfiles/ue4-build-prerequisites/windows/install-prerequisites.ps1 b/src/ue4docker/dockerfiles/ue4-build-prerequisites/windows/install-prerequisites.ps1 index 3bee52d6..b4479331 100644 --- a/src/ue4docker/dockerfiles/ue4-build-prerequisites/windows/install-prerequisites.ps1 +++ b/src/ue4docker/dockerfiles/ue4-build-prerequisites/windows/install-prerequisites.ps1 @@ -1,5 +1,18 @@ $ErrorActionPreference = "stop" +function RunProcessChecked +{ + param ([string] $Cmd, [string[]] $Argv) + + Write-Output "Executing comand: $Cmd $Argv" + + $process = Start-Process -NoNewWindow -PassThru -Wait -FilePath $Cmd -ArgumentList $Argv + if ($process.ExitCode -ne 0) + { + throw "Exit code: $($process.ExitCode)" + } +} + # TODO: Why `Update-SessionEnvironment` doesn't Just Work without this? # Taken from https://stackoverflow.com/a/46760714 # Make `Update-SessionEnvironment` available right away, by defining the $env:ChocolateyInstall @@ -8,25 +21,27 @@ $env:ChocolateyInstall = Convert-Path "$( (Get-Command choco).Path )\..\.." Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" # Install the chocolatey packages we need -choco install --no-progress -y git --params "'/GitOnlyOnPath /NoAutoCrlf /WindowsTerminal /NoShellIntegration /NoCredentialManager'" +RunProcessChecked "choco" @("install", "--no-progress", "-y", "git", "--params", @' +"'/GitOnlyOnPath /NoAutoCrlf /WindowsTerminal /NoShellIntegration /NoCredentialManager'`" +'@) # pdbcopy.exe from Windows SDK is needed for creating an Installed Build of the Engine -choco install --no-progress -y choco-cleaner python vcredist-all windows-sdk-10-version-1809-windbg +RunProcessChecked "choco" @("install", "--no-progress", "-y", "choco-cleaner", "python", "vcredist-all", "windows-sdk-10-version-1809-windbg") # Reload our environment variables from the registry so the `git` command works Update-SessionEnvironment # Forcibly disable the git credential manager -git config --system credential.helper "" +RunProcessChecked "git" @("config", "--system", "--unset", "credential.helper") # Gather the required DirectX runtime files, since Windows Server Core does not include them Invoke-WebRequest -Uri "https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe" -OutFile "$env:TEMP\directx_redist.exe" -Start-Process -FilePath "$env:TEMP\directx_redist.exe" -ArgumentList "/Q", "/T:$env:TEMP" -Wait -expand "$env:TEMP\APR2007_xinput_x64.cab" -F:xinput1_3.dll C:\Windows\System32\ -expand "$env:TEMP\Jun2010_D3DCompiler_43_x64.cab" -F:D3DCompiler_43.dll C:\Windows\System32\ -expand "$env:TEMP\Feb2010_X3DAudio_x64.cab" -F:X3DAudio1_7.dll C:\Windows\System32\ -expand "$env:TEMP\Jun2010_XAudio_x64.cab" -F:XAPOFX1_5.dll C:\Windows\System32\ -expand "$env:TEMP\Jun2010_XAudio_x64.cab" -F:XAudio2_7.dll C:\Windows\System32\ +RunProcessChecked "$env:TEMP\directx_redist.exe" @("/Q", "/T:$env:TEMP") +RunProcessChecked "expand" @("$env:TEMP\APR2007_xinput_x64.cab", "-F:xinput1_3.dll", "C:\Windows\System32\") +RunProcessChecked "expand" @("$env:TEMP\Jun2010_D3DCompiler_43_x64.cab", "-F:D3DCompiler_43.dll", "C:\Windows\System32\") +RunProcessChecked "expand" @("$env:TEMP\Feb2010_X3DAudio_x64.cab", "-F:X3DAudio1_7.dll", "C:\Windows\System32\") +RunProcessChecked "expand" @("$env:TEMP\Jun2010_XAudio_x64.cab", "-F:XAPOFX1_5.dll", "C:\Windows\System32\") +RunProcessChecked "expand" @("$env:TEMP\Jun2010_XAudio_x64.cab", "-F:XAudio2_7.dll", "C:\Windows\System32\") # Retrieve the DirectX shader compiler files needed for DirectX Raytracing (DXR) Invoke-WebRequest -Uri "https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.6.2104/dxc_2021_04-20.zip" -OutFile "$env:TEMP\dxc.zip" @@ -97,7 +112,7 @@ $vs_args = @( ) # Install the Visual Studio Build Tools workloads and components we need -Start-Process -FilePath "$env:TEMP\vs_buildtools.exe" -ArgumentList $vs_args -Wait +RunProcessChecked "$env:TEMP\vs_buildtools.exe" $vs_args # NOTE: Install the .Net 4.5 Framework Pack via NuGet as it is no longer available via Visual Studio, but still needed # NOTE: some programs even in UE5, for example https://github.com/EpicGames/UnrealEngine/blob/5.0.1-release/Engine/Source/Programs/UnrealSwarm/SwarmCoordinator/SwarmCoordinator.csproj#L26 @@ -110,7 +125,7 @@ Remove-Item -LiteralPath "$env:TEMP" -Recurse -Force New-Item -Type directory -Path "$env:TEMP" # This shaves off ~300MB as of 2021-08-31 -choco-cleaner +RunProcessChecked "choco-cleaner" @("--dummy") # Something that gets installed in ue4-build-prerequisites creates a bogus NuGet config file # Just remove it, so a proper one will be generated on next NuGet run