2017-10-26 21:15:56 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Builds and (optionally) runs tests for GitHub for Visual Studio
|
|
|
|
.DESCRIPTION
|
|
|
|
Build GHfVS
|
|
|
|
.PARAMETER Clean
|
|
|
|
When true, all untracked (and ignored) files will be removed from the work
|
|
|
|
tree and all submodules. Defaults to false.
|
|
|
|
.PARAMETER Config
|
|
|
|
Debug or Release
|
|
|
|
.PARAMETER RunTests
|
|
|
|
Runs the tests (defauls to false)
|
|
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
|
|
|
|
|
|
Param(
|
|
|
|
[switch]
|
|
|
|
$UpdateSubmodules = $false
|
|
|
|
,
|
|
|
|
[switch]
|
|
|
|
$Clean = $false
|
|
|
|
,
|
|
|
|
[ValidateSet('Debug', 'Release')]
|
|
|
|
[string]
|
|
|
|
$Config = "Release"
|
|
|
|
,
|
2017-10-26 22:09:01 +03:00
|
|
|
[switch]
|
2017-10-28 17:10:17 +03:00
|
|
|
$Deploy = $false
|
|
|
|
,
|
|
|
|
[switch]
|
2017-10-31 05:09:45 +03:00
|
|
|
$AppVeyor = $false
|
|
|
|
,
|
|
|
|
[switch]
|
|
|
|
$SkipVersionBump = $false
|
|
|
|
,
|
|
|
|
[switch]
|
2017-10-27 14:33:06 +03:00
|
|
|
$Trace = $false
|
2017-10-26 21:15:56 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
Set-StrictMode -Version Latest
|
2017-10-27 14:33:06 +03:00
|
|
|
if ($Trace) {
|
|
|
|
Set-PSDebug -Trace 1
|
|
|
|
}
|
2017-10-26 21:15:56 +03:00
|
|
|
|
2017-10-31 05:09:45 +03:00
|
|
|
. $PSScriptRoot\modules.ps1 | out-null
|
|
|
|
$env:PATH = "$scriptsDirectory;$scriptsDirectory\Modules;$env:PATH"
|
2017-10-26 21:15:56 +03:00
|
|
|
|
2017-10-31 05:09:45 +03:00
|
|
|
Import-Module $scriptsDirectory\Modules\Debugging.psm1
|
|
|
|
Vsix | out-null
|
|
|
|
WiX | out-null
|
2017-10-26 21:15:56 +03:00
|
|
|
|
|
|
|
Push-Location $rootDirectory
|
|
|
|
|
|
|
|
if ($UpdateSubmodules) {
|
|
|
|
Update-Submodules
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($Clean) {
|
|
|
|
Clean-WorkingTree
|
|
|
|
}
|
|
|
|
|
2017-10-31 06:09:26 +03:00
|
|
|
$fullBuild = Test-Path env:GHFVS_KEY
|
|
|
|
$publishable = $fullBuild -and $AppVeyor -and ($env:APPVEYOR_PULL_REQUEST_NUMBER -or $env:APPVEYOR_REPO_BRANCH -eq "master")
|
|
|
|
if ($publishable) { #forcing a deploy flag for CI
|
|
|
|
$Deploy = $true
|
2017-10-31 05:09:45 +03:00
|
|
|
}
|
|
|
|
|
2017-10-31 06:09:26 +03:00
|
|
|
if ($publishable -or ($Deploy -and $Config -eq "Release" -and !$SkipVersionBump)) {
|
|
|
|
Write-Output "Bumping the version"
|
|
|
|
Bump-Version -BumpBuild
|
2017-10-31 05:09:45 +03:00
|
|
|
}
|
|
|
|
|
2017-10-31 06:00:05 +03:00
|
|
|
if ($publishable) {
|
|
|
|
Write-Output "Building and packaging GitHub for Visual Studio"
|
|
|
|
} else {
|
|
|
|
Write-Output "Building GitHub for Visual Studio"
|
|
|
|
}
|
2017-10-26 21:15:56 +03:00
|
|
|
|
2017-10-31 05:09:45 +03:00
|
|
|
Build-Solution GitHubVs.sln "Build" $config $Deploy
|
2017-10-26 21:15:56 +03:00
|
|
|
|
|
|
|
Pop-Location
|