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,55 +131,48 @@ 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) | ForEach-Object { $_.ToString() } $_, $customParametersArray = Invoke-Expression('Write-Output -- "" ' + $Env:CUSTOM_PARAMETERS)
$argList = @("-quit", & "C:\Program Files\Unity\Hub\Editor\$Env:UNITY_VERSION\Editor\Unity.exe" -quit -batchmode -nographics `
"-batchmode", -projectPath $Env:UNITY_PROJECT_PATH `
"-nographics", -executeMethod $Env:BUILD_METHOD `
"-projectPath", $Env:UNITY_PROJECT_PATH, -buildTarget $Env:BUILD_TARGET `
"-executeMethod", $Env:BUILD_METHOD, -customBuildTarget $Env:BUILD_TARGET `
"-buildTarget", $Env:BUILD_TARGET, -customBuildPath $Env:CUSTOM_BUILD_PATH `
"-customBuildTarget", $Env:BUILD_TARGET, -buildVersion $Env:VERSION `
"-customBuildPath", $Env:CUSTOM_BUILD_PATH, -androidVersionCode $Env:ANDROID_VERSION_CODE `
"-buildVersion", $Env:VERSION, -androidKeystorePass $Env:ANDROID_KEYSTORE_PASS `
"-androidVersionCode", $Env:ANDROID_VERSION_CODE, -androidKeyaliasName $Env:ANDROID_KEYALIAS_NAME `
"-androidKeystorePass", $Env:ANDROID_KEYSTORE_PASS, -androidKeyaliasPass $Env:ANDROID_KEYALIAS_PASS `
"-androidKeyaliasName", $Env:ANDROID_KEYALIAS_NAME, -androidTargetSdkVersion $Env:ANDROID_TARGET_SDK_VERSION `
"-androidKeyaliasPass", $Env:ANDROID_KEYALIAS_PASS, -androidExportType $Env:ANDROID_EXPORT_TYPE `
"-androidExportType", $Env:ANDROID_EXPORT_TYPE, -androidSymbolType $Env:ANDROID_SYMBOL_TYPE `
"-androidSymbolType", $Env:ANDROID_SYMBOL_TYPE, $customParametersArray `
"-logfile", "-", "./build.log", -logfile | Out-Host
"-silent-crashes"
) + $customParametersArray
$process = Start-Process -FilePath "C:\Program Files\Unity\Hub\Editor\$Env:UNITY_VERSION\Editor\Unity.exe" ` # Catch exit code
-ArgumentList $argList ` $Env:BUILD_EXIT_CODE=$LastExitCode
-NoNewWindow `
-PassThru
# This ensures that the Unity Editor properly exits as it can hang on Windows # Display results
while (!$process.StandardOutput.EndOfStream) { if ($Env:BUILD_EXIT_CODE -eq 0)
if ($process.HasExited) { {
# Display results Write-Output "Build Succeeded!"
if ($process.ExitCode -eq 0) } else
{ {
Write-Output "Build Succeeded!" Write-Output "$('Build failed, with exit code ')$($Env:BUILD_EXIT_CODE)$('"')"
} 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 ""

View File

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