-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.ps1
34 lines (28 loc) · 1.16 KB
/
build.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
[CmdletBinding()]
param(
[ValidateSet("x64", "x86")][String[]]$Platforms = @("x64", "x86"),
[ValidateSet("Debug", "Release")][String[]]$Flavors = @("Release"),
[Switch]$KeepPDB
)
$msbuildPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1
Set-Alias -name msbuild -Value $msbuildPath
$Platforms | ForEach-Object {
$platform = $_
$Flavors | ForEach-Object {
$config = $_
Write-Progress -Activity "Building" -Status ($platform + "," + $config)
msbuild -noLogo -m -verbosity:detailed -restore -target:Rebuild -property:Configuration=$config -property:Platform=$platform -clp:"ErrorsOnly;NoSummary" fileid.sln
Write-Progress -Activity "Building" -Status ($platform + "," + $config) -Completed
if ($LASTEXITCODE) {
exit $LASTEXITCODE
} else {
Write-Host "Build Successful: $platform, $config"
}
}
}
if ($KeepPDB) {
Get-ChildItem -Path .\Bin -Recurse -Exclude @("*.exe", "*.pdb") -File | Remove-Item
} else {
#Clean up other artifacts
Get-ChildItem -Path .\Bin -Recurse -Exclude @("*.exe") -File | Remove-Item
}