Skip to content

Commit 36024f5

Browse files
committed
Modifying build definition to reduce external dependencies in CI
Removing dependency on VC140TOOLS Changing oauth token behavior Moving more postbuild orchestration to finalize_build Adding srcsrv nuget dependency
1 parent 2017ecf commit 36024f5

File tree

4 files changed

+26
-33
lines changed

4 files changed

+26
-33
lines changed

Build/NuGet/packages.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
4-
</packages>
4+
<package id="SrcSrv" version="0.1.0" targetFramework="native" developmentDependency="true" />
5+
</packages>

Build/scripts/check_prefast_error.ps1

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@ if (Test-Path -Path $logFile) {
1919
Remove-Item $logFile -Force
2020
}
2121

22-
# load rules
23-
$rulefilter = @{};
24-
25-
if ($env:VS140COMNTOOLS -ne "") {
26-
[xml]$ruleset = Get-Content "$env:VS140COMNTOOLS\..\..\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset"
27-
foreach ($r in $ruleset.RuleSet.Rules.Rule) {
28-
$rulefilter[$r.Id] = $r.Action;
29-
}
30-
} else {
31-
WriteMessage "WARNING: No ruleset found. No filter applied."
32-
}
33-
3422
# load all prefast results
3523
$files = Get-ChildItem -recurse ("{0}\vc.nativecodeanalysis.all.xml" -f $directory)
3624

@@ -40,10 +28,8 @@ foreach ($file in $files) {
4028
$filecount++;
4129
[xml]$x = Get-Content $file
4230
foreach ($d in $x.DEFECTS.DEFECT) {
43-
if ($rulefilter.Count -eq 0 -or $rulefilter[("C{0}" -f $d.DEFECTCODE)] -eq "Warning") {
44-
WriteErrorMessage ("{0}{1}({2}): warning C{3}: {4}" -f $d.SFA.FILEPATH, $d.SFA.FILENAME, $d.SFA.LINE, $d.DEFECTCODE, $d.DESCRIPTION)
45-
$count++;
46-
}
31+
WriteErrorMessage ("{0}{1}({2}): warning C{3}: {4}" -f $d.SFA.FILEPATH, $d.SFA.FILENAME, $d.SFA.LINE, $d.DEFECTCODE, $d.DESCRIPTION)
32+
$count++;
4733
}
4834
}
4935

Build/scripts/finalize_build.ps1

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ param (
2020
[ValidateSet("default", "codecoverage", "pogo")]
2121
[string]$subtype = "default",
2222

23-
$corePathSegment = "" # e.g. "core"
23+
$corePathSegment = "", # e.g. "core"
24+
25+
[string]$destinationBase = $Env:DropPath
2426
)
2527

2628
. $PSScriptRoot\pre_post_util.ps1
@@ -33,19 +35,14 @@ $coreSourcesDir = Join-Path $sourcesDir $corePathSegment
3335

3436
$buildName = ConstructBuildName -arch $arch -flavor $flavor -subtype $subtype
3537

36-
#
37-
# Clean up the sentinel which previously marked this build flavor as incomplete.
38-
#
39-
40-
Remove-Item -Path $Env:FlavorBuildIncompleteFile -Force
41-
4238
#
4339
# Copy all logs to DropPath
4440
#
4541

46-
$buildlogsDropPath = Join-Path $Env:DropPath "buildlogs"
47-
$logsDropPath = Join-Path $Env:DropPath "logs"
48-
$testlogsDropPath = Join-Path $Env:DropPath "testlogs"
42+
$logBase = Join-Path $destinationBase "logs"
43+
$buildlogsDropPath = Join-Path $logBase "buildlogs"
44+
$logsDropPath = Join-Path $logBase "logs"
45+
$testlogsDropPath = Join-Path $logBase "testlogs"
4946

5047
New-Item -Force -ItemType Directory -Path $buildlogsDropPath
5148
New-Item -Force -ItemType Directory -Path $logsDropPath
@@ -91,7 +88,7 @@ if ((-not $BuildSucceeded) -or (-not $TestsPassed)) {
9188
$Status = "failed"
9289
}
9390

94-
$buildFlavorJsonFile = Join-Path $Env:DropPath "${Env:BuildName}.json"
91+
$buildFlavorJsonFile = Join-Path $logBase "${Env:BuildName}.json"
9592
$buildFlavorJson = New-Object System.Object
9693

9794
$buildFlavorJson | Add-Member -type NoteProperty -name buildName -value $Env:BuildName
@@ -122,13 +119,23 @@ Copy-Item -Verbose -Force $buildFlavorJsonFile $metadataDir
122119
Get-ChildItem -Path (Join-Path $sourcesDir "Build") "*.nuspec" `
123120
| ForEach-Object { Copy-Item -Verbose -Force $_.FullName $metadataDir }
124121

122+
#
123+
# Copy binaries directory
124+
#
125+
126+
$BinFolder = Join-Path $Env:BinariesDirectory "bin\${Env:BuildName}"
127+
$BinDropPath = Join-Path $destinationBase "bin"
128+
Write-Output "Copying `"$BinFolder`" to `"$BinDropPath`"..."
129+
Copy-Item -Verbose $BinFolder $BinDropPath -Recurse -Force -Exclude "*_ttdlog*"
130+
125131
#
126132
# Copy POGO directory if present for this build
127133
#
128134

129135
$PogoFolder = Join-Path $Env:BinariesDirectory "bin\${Env:BuildType}_pogo"
130136
if (Test-Path $PogoFolder) {
131-
$BinDropPath = Join-Path $Env:DropPath "bin"
132-
Write-Output "Copying `"$PogoFolder`" to `"$BinDropPath`"..."
133-
Copy-Item -Verbose $PogoFolder $BinDropPath -Recurse -Force
137+
$PogoBinDropPath = Join-Path $destinationBase "bin_pogo"
138+
Write-Output "Copying `"$PogoFolder`" to `"$PogoBinDropPath`"..."
139+
Write-Output "##vso[task.setvariable variable=VSO_POGOPresent;]true"
140+
Copy-Item -Verbose $PogoFolder $PogoBinDropPath -Recurse -Force
134141
}

Build/scripts/pre_post_util.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ function GetBuildInfo($oauth, $commitHash) {
3232

3333
# Get the pushId and push date time to use that for build number and build date time
3434
$uri = ("{0}/commits/{1}?api-version=1.0" -f $remote, $commitHash)
35-
$oauthToken = Get-Content $oauth
36-
$header = @{ Authorization=("Basic {0}" -f $oauthToken) }
35+
$header = @{ Authorization=("Bearer {0}" -f $oauth) }
3736
$info = Invoke-RestMethod -Headers $header -Uri $uri -Method GET
3837

3938
return $info

0 commit comments

Comments
 (0)