mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
Attempt to fix windows exit hang
This commit is contained in:
parent
41cf9f3915
commit
53f6978295
63
dist/platforms/windows/build.ps1
vendored
63
dist/platforms/windows/build.ps1
vendored
@ -132,42 +132,47 @@ Write-Output ""
|
||||
# If $Env:CUSTOM_PARAMETERS contains spaces and is passed directly on the command line to Unity, powershell will wrap it
|
||||
# in double quotes. To avoid this, parse $Env:CUSTOM_PARAMETERS into an array, while respecting any quotations within the string.
|
||||
$_, $customParametersArray = Invoke-Expression('Write-Output -- "" ' + $Env:CUSTOM_PARAMETERS)
|
||||
$unityArgs = @(
|
||||
"-quit",
|
||||
"-batchmode",
|
||||
"-nographics",
|
||||
"-silent-crashes",
|
||||
"-projectPath", $Env:UNITY_PROJECT_PATH,
|
||||
"-executeMethod", $Env:BUILD_METHOD,
|
||||
"-buildTarget", $Env:BUILD_TARGET,
|
||||
"-customBuildTarget", $Env:BUILD_TARGET,
|
||||
"-customBuildPath", $Env:CUSTOM_BUILD_PATH,
|
||||
"-buildVersion", $Env:VERSION,
|
||||
"-androidVersionCode", $Env:ANDROID_VERSION_CODE,
|
||||
"-androidKeystorePass", $Env:ANDROID_KEYSTORE_PASS,
|
||||
"-androidKeyaliasName", $Env:ANDROID_KEYALIAS_NAME,
|
||||
"-androidKeyaliasPass", $Env:ANDROID_KEYALIAS_PASS,
|
||||
"-androidTargetSdkVersion", $Env:ANDROID_TARGET_SDK_VERSION,
|
||||
"-androidExportType", $Env:ANDROID_EXPORT_TYPE,
|
||||
"-androidSymbolType", $Env:ANDROID_SYMBOL_TYPE,
|
||||
"-logfile", "-"
|
||||
) + $customParametersArray
|
||||
|
||||
& "C:\Program Files\Unity\Hub\Editor\$Env:UNITY_VERSION\Editor\Unity.exe" -quit -batchmode -nographics `
|
||||
-projectPath $Env:UNITY_PROJECT_PATH `
|
||||
-executeMethod $Env:BUILD_METHOD `
|
||||
-buildTarget $Env:BUILD_TARGET `
|
||||
-customBuildTarget $Env:BUILD_TARGET `
|
||||
-customBuildPath $Env:CUSTOM_BUILD_PATH `
|
||||
-buildVersion $Env:VERSION `
|
||||
-androidVersionCode $Env:ANDROID_VERSION_CODE `
|
||||
-androidKeystorePass $Env:ANDROID_KEYSTORE_PASS `
|
||||
-androidKeyaliasName $Env:ANDROID_KEYALIAS_NAME `
|
||||
-androidKeyaliasPass $Env:ANDROID_KEYALIAS_PASS `
|
||||
-androidTargetSdkVersion $Env:ANDROID_TARGET_SDK_VERSION `
|
||||
-androidExportType $Env:ANDROID_EXPORT_TYPE `
|
||||
-androidSymbolType $Env:ANDROID_SYMBOL_TYPE `
|
||||
$customParametersArray `
|
||||
-logfile | Out-Host
|
||||
# Remove null items as that will fail the Start-Process call
|
||||
$unityArgs = $unityArgs | Where-Object { $_ -ne $null }
|
||||
|
||||
# Catch exit code
|
||||
$Env:BUILD_EXIT_CODE=$LastExitCode
|
||||
$process = Start-Process -FilePath "C:\Program Files\Unity\Hub\Editor\$Env:UNITY_VERSION\Editor\Unity.exe" `
|
||||
-ArgumentList $unityArgs `
|
||||
-NoNewWindow `
|
||||
-PassThru
|
||||
|
||||
while (!$process.HasExited) {
|
||||
if ($process.HasExited) {
|
||||
|
||||
# Display results
|
||||
if ($Env:BUILD_EXIT_CODE -eq 0)
|
||||
if ($process.ExitCode -eq 0)
|
||||
{
|
||||
Write-Output "Build Succeeded!"
|
||||
} else
|
||||
{
|
||||
Write-Output "$('Build failed, with exit code ')$($Env:BUILD_EXIT_CODE)$('"')"
|
||||
Write-Output "$('Build failed, with exit code ')$($process.ExitCode)$('"')"
|
||||
}
|
||||
|
||||
# TODO: Determine if we need to set permissions on any files
|
||||
|
||||
#
|
||||
# Results
|
||||
#
|
||||
|
||||
Write-Output ""
|
||||
Write-Output "###########################"
|
||||
Write-Output "# Build output #"
|
||||
@ -176,3 +181,9 @@ Write-Output ""
|
||||
|
||||
Get-ChildItem $Env:BUILD_PATH_FULL
|
||||
Write-Output ""
|
||||
|
||||
exit $process.ExitCode
|
||||
}
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user