forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_build.ps1
More file actions
132 lines (98 loc) · 4.48 KB
/
post_build.ps1
File metadata and controls
132 lines (98 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#-------------------------------------------------------------------------------------------------------
# Copyright (C) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
#-------------------------------------------------------------------------------------------------------
# Post-Build Script
#
# Run this script after the build step to consume the artifacts produced by the build,
# run tests, and process and deploy build logs.
#
# There may be more non-script tasks in the build definition following this script.
# Any final tasks that need to be done at the end of the build are contained in the
# Finalize Build Script, which should be invoked at the very end of the build.
param (
[ValidateSet("x86", "x64", "arm", "arm64", "*")]
[string]$arch = "*",
[ValidateSet("debug", "release", "test", "codecoverage", "*")]
[string]$flavor = "*",
[ValidateSet("default", "codecoverage", "pogo")]
[string]$subtype = "default",
[string]$srcpath = "",
[string]$buildRoot = "",
[string]$objpath = "",
[Parameter(Mandatory=$True)]
[string]$srcsrvcmdpath,
[string]$bvtcmdpath = "",
[string]$testparams = "",
[string]$repo = "core",
[string]$logFile = "",
# comma separated list of [arch,flavor,arch2,flavor2,...] to build
[string[]]$pogo = @(),
[string]$pogoscript = "",
#
# Skip flags
#
[switch]$skipTests # or set $Env:SKIP_TESTS before invoking build
)
. $PSScriptRoot\pre_post_util.ps1
$srcpath, $buildRoot, $objpath, $_ = `
ComputePaths `
-arch $arch -flavor $flavor -subtype $subtype -OuterScriptRoot $PSScriptRoot `
-srcpath $srcpath -buildRoot $buildRoot -objpath $objpath -binpath $_
$skipTests = $skipTests -or (Test-Path Env:\SKIP_TESTS)
$global:exitcode = 0
if ($arch -eq "*") {
foreach ($arch in ("x86", "x64", "arm", "arm64")) {
ExecuteCommand "$PSScriptRoot\post_build.ps1 -arch $arch -flavor $flavor -srcpath ""$srcpath"" -buildRoot ""$buildRoot"" -objpath ""$objpath"" -srcsrvcmdpath ""$srcsrvcmdpath"" -bvtcmdpath ""$bvtcmdpath"" -repo ""$repo""" -logFile ""$logFile""
}
} elseif ($flavor -eq "*") {
foreach ($flavor in ("debug", "test", "release")) {
ExecuteCommand "$PSScriptRoot\post_build.ps1 -arch $arch -flavor $flavor -srcpath ""$srcpath"" -buildRoot ""$buildRoot"" -objpath ""$objpath"" -srcsrvcmdpath ""$srcsrvcmdpath"" -bvtcmdpath ""$bvtcmdpath"" -repo ""$repo""" -logFile ""$logFile""
}
} else {
$buildName = ConstructBuildName -arch $arch -flavor $flavor -subtype $subtype
if (($logFile -eq "") -and (Test-Path $buildRoot)) {
$logFile = "${buildRoot}\logs\post_build.${buildName}.log"
if (Test-Path -Path $logFile) {
Remove-Item $logFile -Force
}
}
WriteMessage "======================================================================================"
WriteMessage "Post build script for $arch $flavor"
WriteMessage "======================================================================================"
$bvtcmdpath = UseValueOrDefault $bvtcmdpath "" (Resolve-Path "$PSScriptRoot\..\..\test\runcitests.cmd")
WriteCommonArguments
WriteMessage "BVT Command : $bvtcmdpath"
WriteMessage ""
$srcsrvcmd = ("{0} {1} {2} {3}\bin\{4}\*.pdb" -f $srcsrvcmdpath, $repo, $srcpath, $buildRoot, $buildName)
$prefastlog = ("{0}\logs\PrefastCheck.{1}.log" -f $buildRoot, $buildName)
$prefastcmd = "$PSScriptRoot\check_prefast_error.ps1 -directory $objpath -logFile $prefastlog"
# generate srcsrv
if ((Test-Path $srcsrvcmdpath) -and (Test-Path $srcpath) -and (Test-Path $buildRoot)) {
ExecuteCommand($srcsrvcmd)
}
# do POGO
$doPogo=$False
for ($i=0; $i -lt $pogo.length; $i=$i+2) {
if (($pogo[$i] -eq $arch) -and ($pogo[$i+1] -eq $flavor)) {
$doPogo=$True
}
}
if ($subtype -ne "codecoverage") {
if ($doPogo -and ("$pogoscript" -ne "")) {
WriteMessage "Building pogo for $arch $flavor"
$pogocmd = ("{0} {1} {2}" -f $pogoscript, $arch, $flavor)
ExecuteCommand($pogocmd)
}
# run tests
if (-not $skipTests) {
# marshall environment var for cmd script
$Env:TF_BUILD_BINARIESDIRECTORY = $buildRoot
ExecuteCommand("$bvtcmdpath -$arch$flavor $testparams")
}
}
# check prefast
ExecuteCommand($prefastcmd)
WriteMessage ""
}
exit $global:exitcode