Kaynağa Gözat

Port "MicroBuild v2: Update finalize_build.ps1 to take parameters and look in the correct file for test summaries." to release/1.1

Doug Ilijev 9 yıl önce
ebeveyn
işleme
a2a47c077b

+ 18 - 2
Build/scripts/finalize_build.ps1

@@ -9,12 +9,28 @@
 # to clean up and produce metadata about the build.
 
 param (
+    [Parameter(Mandatory=$True)]
+    [ValidateSet("x86", "x64", "arm")]
+    [string]$arch,
+
+    [Parameter(Mandatory=$True)]
+    [ValidateSet("debug", "release", "test", "codecoverage")]
+    [string]$flavor,
+
+    [ValidateSet("default", "codecoverage", "pogo")]
+    [string]$subtype = "default",
+
     $corePathSegment = "" # e.g. "core"
 )
 
 $sourcesDir = $Env:BUILD_SOURCESDIRECTORY
 $coreSourcesDir = Join-Path $sourcesDir $corePathSegment
 
+$OuterScriptRoot = $PSScriptRoot
+. "$PSScriptRoot\pre_post_util.ps1"
+
+$buildName = ConstructBuildName -arch $arch -flavor $flavor -subtype $subtype
+
 #
 # Clean up the sentinel which previously marked this build flavor as incomplete.
 #
@@ -51,8 +67,8 @@ if (Test-Path $testlogsSourcePath) {
 # Create build status JSON file for this flavor.
 #
 
-$buildErrFile = Join-Path $buildLogsDropPath "build.${Env:BuildName}.err"
-$testSummaryFile = Join-Path $testLogsDropPath "summary.${Env:BuildName}.log"
+$buildErrFile = Join-Path $buildLogsDropPath "build.${buildName}.err"
+$testSummaryFile = Join-Path $testLogsDropPath "summary.${arch}${flavor}.log"
 
 # if build.*.err contains any text then there were build errors
 $BuildSucceeded = $true

+ 3 - 2
Build/scripts/post_build.ps1

@@ -61,8 +61,10 @@ if ($arch -eq "*") {
     $OuterScriptRoot = $PSScriptRoot
     . "$PSScriptRoot\pre_post_util.ps1"
 
+    $buildName = ConstructBuildName -arch $arch -flavor $flavor -subtype $subtype
+
     if (($logFile -eq "") -and (Test-Path Env:\TF_BUILD_BINARIESDIRECTORY)) {
-        $logFile = "${Env:TF_BUILD_BINARIESDIRECTORY}\logs\post_build.${Env:BuildName}.log"
+        $logFile = "${Env:TF_BUILD_BINARIESDIRECTORY}\logs\post_build.${buildName}.log"
         if (Test-Path -Path $logFile) {
             Remove-Item $logFile -Force
         }
@@ -78,7 +80,6 @@ if ($arch -eq "*") {
     WriteMessage "BVT Command  : $bvtcmdpath"
     WriteMessage ""
 
-    $buildName = ConstructBuildName -arch $arch -flavor $flavor -subtype $subtype
     $srcsrvcmd = ("{0} {1} {2} {3}\bin\{4}\*.pdb" -f $srcsrvcmdpath, $repo, $srcpath, $binpath, $buildName)
     $prefastlog = ("{0}\logs\PrefastCheck.{1}.log" -f $binpath, $buildName)
     $prefastcmd = "$PSScriptRoot\check_prefast_error.ps1 -directory $objpath -logFile $prefastlog"

+ 2 - 0
Build/scripts/run_build.ps1

@@ -81,3 +81,5 @@ if ($subtype -eq "codecoverage") {
 
 $buildCommand = "& `"$msbuildExe`" $targets $defaultParams $loggingParams $subtypeParams"
 ExecuteCommand "$buildCommand"
+
+exit $global:lastexitcode