finalize_build.ps1 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #-------------------------------------------------------------------------------------------------------
  2. # Copyright (C) Microsoft. All rights reserved.
  3. # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. #-------------------------------------------------------------------------------------------------------
  5. #
  6. # Clean up the sentinel which previously marked the build as incomplete.
  7. #
  8. Remove-Item -Path ${Env:FlavorBuildIncompleteFile} -Force
  9. #
  10. # Create build status JSON file for this flavor.
  11. #
  12. $FullOutputPath = Join-Path $Env:DROP_ROOT $Env:OutputPath
  13. $BuildLogsPath = Join-Path $FullOutputPath "buildlogs"
  14. $buildFlavorErrFile = Join-Path $BuildLogsPath "build_${Env:BuildPlatform}${Env:BuildConfiguration}.err"
  15. # If build_{}{}.err contains any text then there were build errors and we record that the build failed.
  16. $BuildFailed = $false
  17. if (Test-Path $buildFlavorErrFile) {
  18. $BuildFailed = (Get-Item $buildFlavorErrFile).length -gt 0
  19. }
  20. $status = "passed"
  21. if ($BuildFailed) {
  22. $status = "failed"
  23. }
  24. $buildFlavorJsonFile = Join-Path $FullOutputPath "${Env:FlavorName}.json"
  25. $buildFlavorJson = New-Object System.Object
  26. $buildFlavorJson | Add-Member -type NoteProperty -name status -value $status
  27. $buildFlavorJson | Add-Member -type NoteProperty -name arch -value $Env:BuildPlatform
  28. $buildFlavorJson | Add-Member -type NoteProperty -name flavor -value $Env:BuildConfiguration
  29. $buildFlavorJson | ConvertTo-Json | Write-Output
  30. $buildFlavorJson | ConvertTo-Json | Out-File $buildFlavorJsonFile -Encoding ascii