This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
BuildVSTestHost.ps1
89 lines (71 loc) · 2.81 KB
/
BuildVSTestHost.ps1
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
param([string] $options, [switch] $sign, [switch] $mocksign, [switch] $rebuild)
if ($rebuild) {
$buildtarget = "Rebuild"
} else {
$buildtarget = "Build"
}
if (-not (get-command msbuild -EA 0)) {
Write-Error "Visual Studio build tools are required."
exit 1
}
$projectDir = Split-Path -parent $MyInvocation.MyCommand.Definition
if (-not $outdir) {
$outdir = "$projectDir"
}
Write-Output "Writing output MSIs to $outdir"
pushd (Join-Path $projectDir Installer)
..\Build\nuget.exe restore packages.config -PackagesDirectory (Join-Path $projectDir packages)
popd
$originalbuildtarget = $buildtarget
if ($sign -or $mocksign) {
$buildtarget = "BuildVSTestHost"
}
msbuild $projectDir\Installer\Installer.wixproj `
/fl /flp:logfile="$projectDir\VSTestHost.build.log" `
/v:m `
/nologo `
/t:$buildtarget `
/p:VSTestHostTarget=$originalbuildtarget `
/p:Configuration=Release `
$options
if (-not $?) {
Throw "Build failed"
}
if ($sign -or $mocksign) {
Write-Output "Submitting signing job"
if ($sign) {
Import-Module -force $projectDir\Build\BuildReleaseHelpers.psm1
} else {
Import-Module -force $projectDir\Build\BuildReleaseMockHelpers.psm1
}
$approvers = "smortaz", "dinov", "stevdo", "pminaev", "gilbertw", "huvalo", "crwilcox"
$approvers = @($approvers | Where-Object {$_ -ne $env:USERNAME})
$dllfiles = @(Get-ChildItem "$projectDir\BuildOutput\Release*\raw\Microsoft.VisualStudioTools.VSTestHost.*.dll" | %{ @{path=$_.FullName; name=$_.Name} })
$destdir = "$projectDir\BuildOutput\SignedBinaries"
$dlljob = begin_sign_files $dllfiles $destdir $approvers "VS Test Host" "https://github.com/Microsoft/VisualStudio-TestHost" `
"VS Test Host" "Visual Studio; test" "authenticode;strongname"
end_sign_files $dlljob
Write-Output "Rebuilding MSI with signed binaries"
msbuild $projectDir\Installer\Installer.wixproj `
/fl /flp:logfile="$projectDir\VSTestHost.build_signed.log" `
/v:m `
/nologo `
/t:$originalbuildtarget `
/p:VSTestHostSignedBinariesPath=$destdir `
/p:Configuration=Release
if (-not $?) {
Throw "Rebuild failed"
}
Write-Output "Submitting MSI signing job"
$msifiles = @(@{path="$projectDir\BuildOutput\Release*\release\VSTestHost.msi"; name="VSTestHost.msi"})
$msijob = begin_sign_files $msifiles $outdir $approvers "VS Test Host Installer" "https://github.com/Microsoft/VisualStudio-TestHost" `
"VS Test Host" "Visual Studio; test" "msi"
end_sign_files $msijob
} else {
Copy-Item "$projectDir\BuildOutput\Release*\release\VSTestHost.msi" $outdir
}
Write-Output ""
Write-Output " *"
Write-Output " * Final MSI is at $(gci $outdir\*.msi)"
Write-Output " *"
Write-Output ""