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-31 06:27:28 +03:00
|
|
|
$Package = $false
|
2017-10-28 17:10:17 +03:00
|
|
|
,
|
|
|
|
[switch]
|
2017-10-31 05:09:45 +03:00
|
|
|
$AppVeyor = $false
|
|
|
|
,
|
|
|
|
[switch]
|
2017-10-31 06:27:28 +03:00
|
|
|
$BumpVersion = $false
|
2017-10-31 05:09:45 +03:00
|
|
|
,
|
2017-11-01 03:27:04 +03:00
|
|
|
[int]
|
|
|
|
$BuildNumber = -1
|
|
|
|
,
|
2017-10-31 05:09:45 +03:00
|
|
|
[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
|
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
|
2017-10-31 06:27:28 +03:00
|
|
|
$Package = $true
|
|
|
|
$BumpVersion = $true
|
2017-10-31 05:09:45 +03:00
|
|
|
}
|
|
|
|
|
2017-10-31 06:27:28 +03:00
|
|
|
if ($BumpVersion) {
|
2017-10-31 06:09:26 +03:00
|
|
|
Write-Output "Bumping the version"
|
2017-11-01 03:27:04 +03:00
|
|
|
Bump-Version -BumpBuild -BuildNumber:$BuildNumber
|
2017-10-31 05:09:45 +03:00
|
|
|
}
|
|
|
|
|
2017-10-31 06:27:28 +03:00
|
|
|
if ($Package) {
|
2017-10-31 06:00:05 +03:00
|
|
|
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 06:27:28 +03:00
|
|
|
Build-Solution GitHubVs.sln "Build" $config -Deploy:$Package
|
2017-10-26 21:15:56 +03:00
|
|
|
|
|
|
|
Pop-Location
|