Revert unity call

This commit is contained in:
Andrew Kahr 2023-10-21 23:10:29 -07:00
parent ed6252cf90
commit 41cf9f3915
2 changed files with 57 additions and 48 deletions

View File

@ -131,44 +131,43 @@ 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) | ForEach-Object { $_.ToString() }
$_, $customParametersArray = Invoke-Expression('Write-Output -- "" ' + $Env:CUSTOM_PARAMETERS)
$argList = @("-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,
"-androidExportType", $Env:ANDROID_EXPORT_TYPE,
"-androidSymbolType", $Env:ANDROID_SYMBOL_TYPE,
"-logfile", "-", "./build.log",
"-silent-crashes"
) + $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
$process = Start-Process -FilePath "C:\Program Files\Unity\Hub\Editor\$Env:UNITY_VERSION\Editor\Unity.exe" `
-ArgumentList $argList `
-NoNewWindow `
-PassThru
# Catch exit code
$Env:BUILD_EXIT_CODE=$LastExitCode
# This ensures that the Unity Editor properly exits as it can hang on Windows
while (!$process.StandardOutput.EndOfStream) {
if ($process.HasExited) {
# Display results
if ($process.ExitCode -eq 0)
if ($Env:BUILD_EXIT_CODE -eq 0)
{
Write-Output "Build Succeeded!"
} else
{
Write-Output "$('Build failed, with exit code ')$($process.ExitCode)$('"')"
Write-Output "$('Build failed, with exit code ')$($Env:BUILD_EXIT_CODE)$('"')"
}
# TODO: Determine if we need to set permissions on any files
#
# Results
#
Write-Output ""
Write-Output "###########################"
Write-Output "# Build output #"
@ -177,9 +176,3 @@ while (!$process.StandardOutput.EndOfStream) {
Get-ChildItem $Env:BUILD_PATH_FULL
Write-Output ""
exit $process.ExitCode;
}
Start-Sleep -Seconds 1
}

View File

@ -1,21 +1,37 @@
Get-Process
# Import any necessary registry keys, ie: location of windows 10 sdk
# No guarantee that there will be any necessary registry keys, ie: tvOS
Get-ChildItem -Path c:\regkeys -File | ForEach-Object {reg import $_.fullname}
Start-Sleep 3
Get-Process
# Register the Visual Studio installation so Unity can find it
regsvr32 C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll
Start-Sleep 3
Get-Process
# Setup Git Credentials
& "c:\steps\set_gitcredential.ps1"
Start-Sleep 3
Get-Process
# Activate Unity
& "c:\steps\activate.ps1"
Start-Sleep 3
Get-Process
# Build the project
& "c:\steps\build.ps1"
Start-Sleep 3
Get-Process
# Free the seat for the activated license
& "c:\steps\return_license.ps1"
Start-Sleep 3
Get-Process
# Kill the regsvr process
Get-Process -Name regsvr32 | ForEach-Object { Stop-Process -Id $_.Id -Force }
Start-Sleep 3
Get-Process