@@ -27,19 +27,17 @@ if (-not $unityEditor) {
2727}
2828Write-Verbose $unityEditor ;
2929
30- function RunUnityTask
31- {
30+ function RunUnityTask {
3231 param ([string ]$taskName , [string ]$methodToExecute )
33- Write-Output " Starting runing Unity task: $ ( $taskName ) "
32+ Write-Output " Starting running Unity task: $ ( $taskName ) "
3433 $logFile = New-Item - Path " Logs\Unity.$ ( $taskName ) .$ ( $Version ) .log" - ItemType File - Force
3534
3635 $ProjectLocation = Resolve-Path " $ ( Get-Location ) \..\"
3736 Write-Output $ProjectLocation
3837 $proc = Start-Process - FilePath " $unityEditor " - ArgumentList " -projectPath $ProjectLocation -batchmode -executeMethod $ ( $methodToExecute ) -logFile $ ( $logFile.FullName ) -nographics -quit" - PassThru
3938 $ljob = Start-Job - ScriptBlock { param ($log ) Get-Content " $log " - Wait } - ArgumentList $logFile.FullName
4039
41- while (-not $proc.HasExited -and $ljob.HasMoreData )
42- {
40+ while (-not $proc.HasExited -and $ljob.HasMoreData ) {
4341 Receive-Job $ljob
4442 Start-Sleep - Milliseconds 200
4543 }
@@ -49,16 +47,14 @@ function RunUnityTask
4947
5048 Remove-Job $ljob
5149 Stop-Process $proc
52- if ($proc.ExitCode -ge 1 )
53- {
50+ if ($proc.ExitCode -ge 1 ) {
5451 Write-Error " Failed to execute Unity Task '$ ( $taskName ) ', see log '$ ( $logFile ) ' for more information."
5552 exit ($proc.ExitCode )
5653 }
5754}
5855
5956$OriginalPath = Get-Location
60- try
61- {
57+ try {
6258 Set-Location (Split-Path $MyInvocation.MyCommand.Path )
6359 Set-Location " ..\\..\\"
6460 New-Item - ItemType Directory " NuGet" - ErrorAction SilentlyContinue
7066 # ## Build all the needed flavors for MRTK
7167 Write-Output " ============ Building InEditor WindowsStandalone32 ============ "
7268 dotnet msbuild .\BuildSource.proj - target:BuildStandaloneEditor > " Logs\Build.InEditor.WindowsStandalone32.$ ( $Version ) .log"
73- if ($lastexitcode -ge 1 )
74- {
75- Write-Error " Building InEditor WindowsStandalone32 Failed! See log file for more information $ ( Get-Location ) \Logs\Build.InEditor.WindowsStandalone32.$ ( $Version ) .log" ;
69+ if ($lastexitcode -ge 1 ) {
70+ Write-Error " Building InEditor WindowsStandalone32 Failed! See log file for more information $ ( Get-Location ) \Logs\Build.InEditor.WindowsStandalone32.$ ( $Version ) .log" ;
7671 exit ($lastexitcode )
7772 }
7873 Write-Output " ============ Building InEditor WSA ============ "
7974 dotnet msbuild .\BuildSource.proj - target:BuildWSAEditor > " Logs\Build.InEditor.WSA.$ ( $Version ) .log"
80- if ($lastexitcode -ge 1 )
81- {
82- Write-Error " Building InEditor WSA Failed! See log file for more information $ ( Get-Location ) \Logs\Build.InEditor.WSA.$ ( $Version ) .log" ;
75+ if ($lastexitcode -ge 1 ) {
76+ Write-Error " Building InEditor WSA Failed! See log file for more information $ ( Get-Location ) \Logs\Build.InEditor.WSA.$ ( $Version ) .log" ;
8377 exit ($lastexitcode )
8478 }
8579 Write-Output " ============ Building Player WindowsStandalone32 ============ "
8680 dotnet msbuild .\BuildSource.proj - target:BuildStandalonePlayer > " Logs\Build.Player.WindowsStandalone32.$ ( $Version ) .log"
87- if ($lastexitcode -ge 1 )
88- {
81+ if ($lastexitcode -ge 1 ) {
8982 Write-Error " Building Player WindowsStandalone32 Failed! See log file for more information $ ( Get-Location ) \Logs\Build.Player.WindowsStandalone32.$ ( $Version ) .log" ;
9083 exit ($lastexitcode )
9184 }
9285 Write-Output " ============ Building Player Android ============ "
9386 dotnet msbuild .\BuildSource.proj - target:BuildAndroidPlayer > " Logs\Build.Player.Android.$ ( $Version ) .log"
94- if ($lastexitcode -ge 1 )
95- {
87+ if ($lastexitcode -ge 1 ) {
9688 Write-Error " Building Player Android Failed! See log file for more information $ ( Get-Location ) \Logs\Build.Player.Android.$ ( $Version ) .log" ;
9789 exit ($lastexitcode )
9890 }
9991 Write-Output " ============ Building Player iOS ============ "
10092 dotnet msbuild .\BuildSource.proj - target:BuildIOSPlayer > " Logs\Build.Player.iOS.$ ( $Version ) .log"
101- if ($lastexitcode -ge 1 )
102- {
93+ if ($lastexitcode -ge 1 ) {
10394 Write-Error " Building Player iOS Failed! See log file for more information $ ( Get-Location ) \Logs\Build.Player.iOS.$ ( $Version ) .log" ;
10495 exit ($lastexitcode )
10596 }
10697 Write-Output " ============ Building Player WSA ============ "
10798 dotnet msbuild .\BuildSource.proj - target:BuildWSAPlayer > " Logs\Build.Player.WSA.$ ( $Version ) .log"
108- if ($lastexitcode -ge 1 )
109- {
99+ if ($lastexitcode -ge 1 ) {
110100 Write-Error " Building Player WSA Failed! See log file for more information $ ( Get-Location ) \Logs\Build.Player.WSA.$ ( $Version ) .log" ;
111101 exit ($lastexitcode )
112102 }
113103
114-
115104 # ## Run Asset regargetting:
116105 RunUnityTask - taskName " AssetRetargeting" - methodToExecute " Microsoft.MixedReality.Toolkit.MSBuild.AssetScriptReferenceRetargeter.RetargetAssets"
117106
125114
126115 # Check if NuGet.exe is in the environment PATH, if not go ahead and install it to this directory
127116 where.exe nuget > $null 2> $null
128- if ($lastexitcode -ne 0 ){
117+ if ($lastexitcode -ne 0 ) {
129118 Write-Host " Could not find NuGet.exe in the path. Downloading it now from: https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
130119 Invoke-WebRequest - Uri " https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" - OutFile " .\nuget.exe"
131120 }
155144 nuget pack $_.FullName - OutputDirectory $OutputDirectory - Properties $props - Exclude * .nuspec.meta - Version $Version
156145
157146 # If the package is already installed to the machine global cache delete it, otherwise the next restore will no-op
158- if ([System.IO.Directory ]::Exists($finalInstallPath ))
159- {
147+ if ([System.IO.Directory ]::Exists($finalInstallPath )) {
160148 Remove-Item - Recurse - Force $finalInstallPath
161149 }
162150
166154 dotnet build " $restoreProjectPath " - p:RestorePackageFeed= " $ ( convert-path $OutputDirectory ) " - p:RestorePackageId= $packageId - p:RestorePackageVersion= $Version
167155 }
168156}
169- finally
170- {
157+ finally {
171158 Set-Location $OriginalPath
172159}
0 commit comments