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
91
dist/platforms/windows/build.ps1
vendored
91
dist/platforms/windows/build.ps1
vendored
@ -132,47 +132,58 @@ Write-Output ""
|
|||||||
# If $Env:CUSTOM_PARAMETERS contains spaces and is passed directly on the command line to Unity, powershell will wrap it
|
# 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.
|
# 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)
|
$_, $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 `
|
# Remove null items as that will fail the Start-Process call
|
||||||
-projectPath $Env:UNITY_PROJECT_PATH `
|
$unityArgs = $unityArgs | Where-Object { $_ -ne $null }
|
||||||
-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
|
|
||||||
|
|
||||||
# Catch exit code
|
$process = Start-Process -FilePath "C:\Program Files\Unity\Hub\Editor\$Env:UNITY_VERSION\Editor\Unity.exe" `
|
||||||
$Env:BUILD_EXIT_CODE=$LastExitCode
|
-ArgumentList $unityArgs `
|
||||||
|
-NoNewWindow `
|
||||||
|
-PassThru
|
||||||
|
|
||||||
# Display results
|
while (!$process.HasExited) {
|
||||||
if ($Env:BUILD_EXIT_CODE -eq 0)
|
if ($process.HasExited) {
|
||||||
{
|
|
||||||
Write-Output "Build Succeeded!"
|
# Display results
|
||||||
} else
|
if ($process.ExitCode -eq 0)
|
||||||
{
|
{
|
||||||
Write-Output "$('Build failed, with exit code ')$($Env:BUILD_EXIT_CODE)$('"')"
|
Write-Output "Build Succeeded!"
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Write-Output "$('Build failed, with exit code ')$($process.ExitCode)$('"')"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output "# Build output #"
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output ""
|
||||||
|
|
||||||
|
Get-ChildItem $Env:BUILD_PATH_FULL
|
||||||
|
Write-Output ""
|
||||||
|
|
||||||
|
exit $process.ExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-Sleep -Seconds 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: Determine if we need to set permissions on any files
|
|
||||||
|
|
||||||
#
|
|
||||||
# Results
|
|
||||||
#
|
|
||||||
|
|
||||||
Write-Output ""
|
|
||||||
Write-Output "###########################"
|
|
||||||
Write-Output "# Build output #"
|
|
||||||
Write-Output "###########################"
|
|
||||||
Write-Output ""
|
|
||||||
|
|
||||||
Get-ChildItem $Env:BUILD_PATH_FULL
|
|
||||||
Write-Output ""
|
|
||||||
|
Loading…
Reference in New Issue
Block a user