Merge pull request #2442 from github/fixes/2039-port-build-to-azure-pipelines

Port build system to Azure Pipelines
This commit is contained in:
Jamie Cansdale 2019-11-12 23:42:24 +00:00 коммит произвёл GitHub
Родитель 762d6cfc6e 8f40041382
Коммит c4add32a08
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
49 изменённых файлов: 207 добавлений и 1436 удалений

3
.gitmodules поставляемый
Просмотреть файл

@ -10,9 +10,6 @@
[submodule "submodules/akavache"]
path = submodules/akavache
url = https://github.com/editor-tools/Akavache
[submodule "script"]
path = script
url = git@github.com:github/VisualStudioBuildScripts
[submodule "submodules/octokit.graphql.net"]
path = submodules/octokit.graphql.net
url = https://github.com/octokit/octokit.graphql.net

Просмотреть файл

@ -5,4 +5,10 @@
<Copyright>Copyright © GitHub, Inc. 2014-2018</Copyright>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning">
<Version>3.0.26</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>

Просмотреть файл

@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{72036B62-2
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
README.md = README.md
version.json = version.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitHub.UI", "src\GitHub.UI\GitHub.UI.csproj", "{346384DD-2445-4A28-AF22-B45F3957BD89}"
@ -31,33 +32,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Submodules", "Submodules",
test\UnitTests\Args.cs = test\UnitTests\Args.cs
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{8E1F1B4E-AEA2-4AB1-8F73-423A903550A1}"
ProjectSection(SolutionItems) = preProject
scripts\Modules\BuildUtils.psm1 = scripts\Modules\BuildUtils.psm1
scripts\Modules\Debugging.psm1 = scripts\Modules\Debugging.psm1
scripts\modules\Versioning.ps1 = scripts\modules\Versioning.ps1
scripts\modules\Vsix.ps1 = scripts\modules\Vsix.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{7B6C5F8D-14B3-443D-B044-0E209AE12BDF}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
appveyor.yml = appveyor.yml
scripts\build.ps1 = scripts\build.ps1
scripts\Bump-Version.ps1 = scripts\Bump-Version.ps1
scripts\common.ps1 = scripts\common.ps1
scripts\Get-CheckedOutBranch.ps1 = scripts\Get-CheckedOutBranch.ps1
scripts\Get-HeadSha1.ps1 = scripts\Get-HeadSha1.ps1
scripts\modules.ps1 = scripts\modules.ps1
nuget.config = nuget.config
scripts\Require-CleanWorkTree.ps1 = scripts\Require-CleanWorkTree.ps1
scripts\Run-CodeCoverage.ps1 = scripts\Run-CodeCoverage.ps1
scripts\Run-NUnit.ps1 = scripts\Run-NUnit.ps1
scripts\Run-Tests.ps1 = scripts\Run-Tests.ps1
scripts\Run-XUnit.ps1 = scripts\Run-XUnit.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{8A7DA2E7-262B-4581-807A-1C45CE79CDFD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitHub.Exports", "src\GitHub.Exports\GitHub.Exports.csproj", "{9AEA02DB-02B5-409C-B0CA-115D05331A6B}"
@ -519,7 +493,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8E1F1B4E-AEA2-4AB1-8F73-423A903550A1} = {7B6C5F8D-14B3-443D-B044-0E209AE12BDF}
{1E7F7253-A6AF-43C4-A955-37BEDDA01AC0} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB8}
{08DD4305-7787-4823-A53F-4D0F725A07F3} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AC0}
{674B69B8-0780-4D54-AE2B-C15821FA51CB} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AC0}

Двоичные данные
Key.snk Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -1,25 +1,13 @@
# GitHub Extension for Visual Studio
## Notices
### If you are having issues with the installer, please read
If you need to upgrade, downgrade, or uninstall the extension, and are having problems doing so, refer to this issue: https://github.com/github/VisualStudio/issues/1394 which details common problems and solutions when using the installer.
### The location of the submodules has changed as of 31-01-2017
If you have an existing clone, make sure to run `git submodule sync` to update your local clone with the new locations for the submodules.
## About
The GitHub Extension for Visual Studio provides GitHub integration in Visual Studio 2015 and newer.
Most of the extension UI lives in the Team Explorer pane, which is available from the View menu.
Official builds of this extension are available at [the official website](https://visualstudio.github.com).
Official builds of this extension are available at the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=GitHub.GitHubExtensionforVisualStudio).
[![Build status](https://ci.appveyor.com/api/projects/status/dl8is5iqwt9qf3t7/branch/master?svg=true)](https://ci.appveyor.com/project/github-windows/visualstudio/branch/master)
[![Build Status](https://github-editor-tools.visualstudio.com/VisualStudio/_apis/build/status/github.VisualStudio?branchName=master)](https://github-editor-tools.visualstudio.com/VisualStudio/_build/latest?definitionId=4&branchName=master)
[![codecov](https://codecov.io/gh/GitHub/VisualStudio/branch/master/graph/badge.svg)](https://codecov.io/gh/GitHub/VisualStudio)
[![Build Status](https://github-editor-tools.visualstudio.com/VisualStudio/_apis/build/status/github.VisualStudio?branchName=master)](https://github-editor-tools.visualstudio.com/VisualStudio/_build/latest?definitionId=10&branchName=master)
[![Follow GitHub for Visual Studio](https://img.shields.io/twitter/follow/GitHubVS.svg?style=social "Follow GitHubVS")](https://twitter.com/githubvs?ref_src=twsrc%5Etfw) [![Join the chat at https://gitter.im/github/VisualStudio](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/github/VisualStudio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@ -28,57 +16,29 @@ Visit the [documentation](https://github.com/github/VisualStudio/tree/master/doc
## Build requirements
* Visual Studio 2017 (15.7.4)+
* Visual Studio SDK
* The built VSIX will work with Visual Studio 2015 or newer
* Visual Studio 2019
* `.NET desktop development` workload
* `.NET Core cross platform development` workload
* `Visual Studio extension development` workload
The built VSIX will work with Visual Studio 2015 or newer
## Build
Clone the repository and its submodules in a git GUI client or via the command line:
Clone the repository and its submodules.
```txt
git clone https://github.com/github/VisualStudio
cd VisualStudio
git submodule init
git submodule deinit script
git submodule update
```
Open the `GitHubVS.sln` solution with Visual Studio 2017+.
To be able to use the GitHub API, you'll need to:
- [Register a new developer application](https://github.com/settings/developers) in your profile.
- Open [src/GitHub.Api/ApiClientConfiguration_User.cs](src/GitHub.Api/ApiClientConfiguration_User.cs) and fill out the clientId/clientSecret fields for your application. **Note this has recently changed location, so you may need to re-do this**
- [Register a new developer application](https://github.com/settings/developers) in your profile
- Create an environment variable `GitHubVS_ClientID` with your `Client ID`
- Create an environment variable `GitHubVS_ClientSecret` with your `Client Secret`
Build using Visual Studio 2017 or:
Execute `build.cmd`
```txt
build.cmd
```
## Visual Studio Build
Install in live (non-Experimental) instances of Visual Studio 2015 and 2017:
Build `GitHubVS.sln` using Visual Studio 2019.
```txt
install.cmd
```
Note, the script will only install in one instance of Visual Studio 2017 (Enterprise, Professional or Community).
## Build Flavors
The following can be executed via `cmd.exe`.
To build and install a `Debug` configuration VSIX:
```txt
build.cmd Debug
install.cmd Debug
```
To build and install a `Release` configuration VSIX:
```txt
build.cmd Release
install.cmd Release
```
## Logs
Logs can be viewed at the following location:

Просмотреть файл

@ -1,75 +0,0 @@
os: Visual Studio 2019 Preview
version: '2.10.8.{build}'
skip_tags: true
install:
- choco install --no-progress BCC-MSBuildLog
- choco install --no-progress BCC-Submission
- ps: |
$full_build = Test-Path env:GHFVS_KEY
$forVSInstaller = $env:BUILD_TYPE -eq "vsinstaller"
$forPackage = $env:BUILD_TYPE -eq "package"
$package = $full_build -and ($env:APPVEYOR_PULL_REQUEST_NUMBER -or $forVSInstaller -or $forPackage)
$message = "Building "
if ($package) { $message += "and packaging "}
$message += "version " + $env:APPVEYOR_BUILD_NUMBER + " "
if ($full_build) { $message += "(full build)" } else { $message += "(partial build)" }
if ($forVSInstaller) { $message += " for the VS installer" }
Write-Host $message
git submodule init
git submodule sync
if ($full_build) {
$fileContent = "-----BEGIN RSA PRIVATE KEY-----`n"
$fileContent += $env:GHFVS_KEY.Replace(' ', "`n")
$fileContent += "`n-----END RSA PRIVATE KEY-----`n"
Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent
} else {
git submodule deinit script
}
git submodule update --recursive --force
Write-Host "Completed AppVeyor Install"
build_script:
- ps: scripts\build.ps1 -AppVeyor -Package:$package -BuildNumber:$env:APPVEYOR_BUILD_NUMBER -ForVSInstaller:$forVSInstaller
test:
categories:
except:
- Timings
on_success:
- ps: |
if ($package) {
Write-Host "Signing and packaging"
script\Sign-Package -AppVeyor -ForVSInstaller:$forVSInstaller
}
for:
-
branches:
except:
- /releases/.*-vsinstaller/
environment:
matrix:
- BUILD_TYPE: normal
-
branches:
only:
- /releases/.*-vsinstaller/
environment:
matrix:
- BUILD_TYPE: package
- BUILD_TYPE: vsinstaller
-
branches:
only:
- master
- /releases/(?:(?!-vsinstaller).)*?/
environment:
matrix:
- BUILD_TYPE: package

Просмотреть файл

@ -4,60 +4,118 @@
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
pool:
vmImage: 'VS2017-Win2016'
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
- group: GitHubVS
- name: githubvsSolution
value: 'GitHubVS.sln'
- name: essentialsSolution
value: 'src\GitHub.VisualStudio.16.sln'
- name: buildPlatform
value: 'Any CPU'
- name: buildConfiguration
value: 'Release'
steps:
- task: InstallSSHKey@0
inputs:
hostName: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCx/AxLjr4mhH7XFlbISb65GBxQnVnKh1owmAT1bK/Qt1b4/Z0SL68IvV88DpgLyKbica2giEVfKo/Z4dkO+P8M2bGXrNgazzfO910DlR+e1vt8BSU/Dbvscz0i1lsfKb3PnfSouCkQev6Th0v+hBdgkuackWgaBw22DDLkp9Uf/cAo+QYLz56p5KVctEESRRgGgIIlZyUc8OYDMSU2wQhG9x31mSyJ4ODuOZsi1RgBBHrgUb2QRhLJ9nZWfQgGBRDxGYTKLWiWIQwgSVQ9x1Az/Rei+CbPRvLcVGg+5vHt8lcu+HxEgrY4IsjXdMqosPqxQ+TT6f+G4GQDn8+IQ4wOpTVi84PkOQX3JPE2QSJwWA0AHNe5NTSns6WWYQyzxFJYBN2pLPuMnj9/+ozV3GaeQqn47WHfUH3s5IawNQPTFDxcl4qsmU66Ybfqa4eFIPEvCCp1leQcuXyDHxKLq80x1szN4kn0oyL2W0zbkwTaZG4I5l4Rto0hErUf3qx7FlZjMGEFMdJVskgnRMkKdqngF0FmSYQICpmqqYD8TydUc6jxZVOCvFF5gbqwxV/F2lk10D7FnetUNeWvpcZKbFUX4e5Ff15vibJZp4/5FUbksv+glfbPwk6tGuNj3xPFODP7KG8Y5wtcbknX11XI0vi+iL8TxL0Vk30TpZUMXWYYvQ==
sshKeySecureFile: id_rsa
jobs:
- job: build_and_test
displayName: 'Build/test GitHub for VS and Essentials'
- script: git submodule init && git submodule deinit script && git submodule update
displayName: Submodule init
strategy:
maxParallel: 2
matrix:
VSMarketplace:
ArtifactDirectory: '$(Build.ArtifactStagingDirectory)'
IsProductComponent: false
VSInstaller:
ArtifactDirectory: '$(Build.ArtifactStagingDirectory)\VSInstaller'
IsProductComponent: true
# Can't use the NuGet tasks because of https://github.com/Microsoft/azure-pipelines-tasks/issues/6790
#- task: NuGetToolInstaller@0
#- task: NuGetCommand@2
# inputs:
# restoreSolution: '$(solution)'
# feedsToUse: 'config'
# nugetConfigPath: nuget.config
steps:
- checkout: self
submodules: true
# Instead run nuget manually.
- script: tools\nuget\nuget.exe restore
displayName: NuGet restore
# Can't use the NuGet tasks because of https://github.com/Microsoft/azure-pipelines-tasks/issues/6790
#- task: NuGetToolInstaller@0
#- task: NuGetCommand@2
# inputs:
# restoreSolution: '$(solution)'
# feedsToUse: 'config'
# nugetConfigPath: nuget.config
# Ideally we'd run NerdBank.GitVersioning but that will come later. For now bump the
# version with the azure BuildId
- task: PowerShell@2
inputs:
targetType: filePath
filePath: '$(Build.SourcesDirectory)\scripts\Bump-Version.ps1'
arguments: -BumpBuild -BuildNumber:$(Build.BuildId)
displayName: Bump version
# Instead run nuget manually.
- task: VSBuild@1
inputs:
solution: GitHubVS.sln
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- task: VSTest@2
inputs:
searchFolder: '$(Build.SourcesDirectory)\test'
testAssemblyVer2: '**\bin\**\*Tests.dll'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
diagnosticsEnabled: true
runSettingsFile: '$(Build.SourcesDirectory)\test\test.runsettings'
- script: nbgv cloud
displayName: Set the cloud build number
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.SourcesDirectory)\build\Release\GitHub.VisualStudio.vsix'
artifactName: 'vsix'
- script: tools\nuget\nuget.exe restore $(githubvsSolution)
displayName: NuGet restore $(githubvsSolution)
- script: tools\nuget\nuget.exe restore $(essentialsSolution)
displayName: NuGet restore $(essentialsSolution)
- pwsh: mkdir $(ArtifactDirectory) -Force
displayName: Create VSIX staging directory
- task: MSBuild@1
displayName: GitHub for Visual Studio
inputs:
solution: $(githubvsSolution)
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildVersion: '16.0'
msbuildArguments: >
/p:TargetVsixContainer=$(ArtifactDirectory)\GitHub.VisualStudio.vsix
/p:IsProductComponent=$(IsProductComponent)
/p:DeployExtension=False
/p:GitHubVS_ClientId=$(GitHubVS_ClientId)
/p:GitHubVS_ClientSecret=$(GitHubVS_ClientSecret)
- task: MSBuild@1
displayName: GitHub Essentials
inputs:
solution: $(essentialsSolution)
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildVersion: '16.0'
msbuildArguments: >
/p:TargetVsixContainer=$(ArtifactDirectory)\GitHub.VisualStudio.16.vsix
/p:IsProductComponent=$(IsProductComponent)
/p:DeployExtension=False
- task: DownloadSecureFile@1
name: vsixsigntool_exe
inputs:
secureFile: vsixsigntool.exe
- task: DownloadSecureFile@1
name: certificate_pfx
inputs:
secureFile: certificate.pfx
- script: $(vsixsigntool_exe.secureFilePath) sign /f $(certificate_pfx.secureFilePath) /p "$(certificate_password)" /sha1 c4fdf13659f49e57ac14774fdf45053f499f185f /fd sha256 /tr http://timestamp.digicert.com /td sha256 $(ArtifactDirectory)\GitHub.VisualStudio.vsix
displayName: Sign the GitHub for Visual Studio VSIX
- script: $(vsixsigntool_exe.secureFilePath) sign /f $(certificate_pfx.secureFilePath) /p "$(certificate_password)" /sha1 c4fdf13659f49e57ac14774fdf45053f499f185f /fd sha256 /tr http://timestamp.digicert.com /td sha256 $(ArtifactDirectory)\GitHub.VisualStudio.16.vsix
displayName: Sign the GitHub Essentials VSIX
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: 'vsix'
- task: VSTest@2
inputs:
searchFolder: '$(Build.SourcesDirectory)\test'
testAssemblyVer2: '**\bin\**\*Tests.dll'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
diagnosticsEnabled: true
runSettingsFile: '$(Build.SourcesDirectory)\test\test.runsettings'

Просмотреть файл

@ -1,2 +1,11 @@
@if "%1" == "" echo Please specify Debug or Release && EXIT /B
powershell -ExecutionPolicy Unrestricted scripts\build.ps1 -Package:$true -Config:%1
@echo off
call vars.cmd
rem Build GitHub for Visual Studio
NuGet restore .\GitHubVS.sln
msbuild .\GitHubVS.sln /p:DeployExtension=False
rem Build GitHub Essentials
NuGet restore .\src\GitHub.VisualStudio.16.sln
msbuild .\src\GitHub.VisualStudio.16.sln /p:DeployExtension=False

Просмотреть файл

@ -1 +0,0 @@
powershell.exe .\script\deploy.ps1 -Force -NoChat -NoPush -NoUpload

Просмотреть файл

@ -1,3 +0,0 @@
@if "%1" == "" echo Please specify Debug or Release && EXIT /B
tools\VsixUtil\vsixutil /install "build\%1\GitHub.VisualStudio.vsix"
@echo Installed %1 build of GitHub for Visual Studio

1
script

@ -1 +0,0 @@
Subproject commit 35c263c41ea449a4ba54fabf192e09884640ce16

Просмотреть файл

@ -1,93 +0,0 @@
<#
.SYNOPSIS
Bumps the version number of GitHub for Visual Studio
.DESCRIPTION
By default, just bumps the last component of the version number by one. An
alternate version number can be specified on the command line.
The new version number is committed to the local repository and pushed to
GitHub.
#>
Param(
# It would be nice to use our Validate-Version function here, but we
# can't because this Param definition has to come before any other code in the
# file.
[ValidateScript({ ($_.Major -ge 0) -and ($_.Minor -ge 0) -and ($_.Build -ge 0) })]
[System.Version]
$NewVersion = $null
,
[switch]
$BumpMajor = $false
,
[switch]
$BumpMinor = $false
,
[switch]
$BumpPatch = $false
,
[switch]
$BumpBuild = $false
,
[int]
$BuildNumber = -1
,
[switch]
$Commit = $false
,
[switch]
$Push = $false
,
[switch]
$Force = $false
,
[switch]
$Trace = $false
)
Set-StrictMode -Version Latest
if ($Trace) { Set-PSDebug -Trace 1 }
. $PSScriptRoot\modules.ps1 | out-null
. $scriptsDirectory\Modules\Versioning.ps1 | out-null
. $scriptsDirectory\Modules\Vsix.ps1 | out-null
. $scriptsDirectory\Modules\SolutionInfo.ps1 | out-null
. $scriptsDirectory\Modules\AppVeyor.ps1 | out-null
. $scriptsDirectory\Modules\DirectoryBuildProps.ps1 | out-null
if ($NewVersion -eq $null) {
if (!$BumpMajor -and !$BumpMinor -and !$BumpPatch -and !$BumpBuild){
Die -1 "You need to indicate which part of the version to update via -BumpMajor/-BumpMinor/-BumpPatch/-BumpBuild flags or a custom version via -NewVersion"
}
}
if ($Push -and !$Commit) {
Die 1 "Cannot push a version bump without -Commit"
}
if ($Commit -and !$Force){
Require-CleanWorkTree "bump version"
}
if (!$?) {
exit 1
}
if ($NewVersion -eq $null) {
$currentVersion = Read-Version
$NewVersion = Generate-Version $currentVersion $BumpMajor $BumpMinor $BumpPatch $BumpBuild $BuildNumber
}
Write-Output "Setting version to $NewVersion"
Write-Version $NewVersion
if ($Commit) {
Write-Output "Committing version change"
Commit-Version $NewVersion
if ($Push) {
Write-Output "Pushing version change"
$branch = & $git rev-parse --abbrev-ref HEAD
Push-Changes $branch
}
}

Просмотреть файл

@ -1,31 +0,0 @@
<#
.SYNOPSIS
Returns the name of the working directory's currently checked-out branch
#>
Set-PSDebug -Strict
$scriptsDirectory = Split-Path $MyInvocation.MyCommand.Path
$rootDirectory = Split-Path $scriptsDirectory
. $scriptsDirectory\common.ps1
function Die([string]$message, [object[]]$output) {
if ($output) {
Write-Output $output
$message += ". See output above."
}
Write-Error $message
exit 1
}
$output = & $git symbolic-ref HEAD 2>&1 | %{ "$_" }
if (!$? -or ($LastExitCode -ne 0)) {
Die "Failed to determine current branch" $output
}
if (!($output -match "^refs/heads/(\S+)$")) {
Die "Failed to determine current branch. HEAD is $output" $output
}
$matches[1]

Просмотреть файл

@ -1,57 +0,0 @@
<#
.SYNOPSIS
Ensures the working tree has no uncommitted changes
.PARAMETER Action
The action that requires a clean work tree. This will appear in error messages.
.PARAMETER WarnOnly
When true, warns rather than dies when uncommitted changes are found.
#>
[CmdletBinding()]
Param(
[ValidateNotNullOrEmpty()]
[string]
$Action
,
[switch]
$WarnOnly = $false
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
. $PSScriptRoot\modules.ps1 | out-null
# Based on git-sh-setup.sh:require_clean_work_tree in git.git, but changed not
# to ignore submodules.
Push-Location $rootDirectory
Run-Command -Fatal { & $git rev-parse --verify HEAD | Out-Null }
& $git update-index -q --refresh
& $git diff-files --quiet
$error = ""
if ($LastExitCode -ne 0) {
$error = "You have unstaged changes."
}
& $git diff-index --cached --quiet HEAD --
if ($LastExitCode -ne 0) {
if ($error) {
$error += " Additionally, your index contains uncommitted changes."
} else {
$error = "Your index contains uncommitted changes."
}
}
if ($error) {
if ($WarnOnly) {
Write-Warning "$error Continuing anyway."
} else {
Die 2 ("Cannot $Action" + ": $error")
}
}
Pop-Location

Просмотреть файл

@ -1,83 +0,0 @@
<#
.SYNOPSIS
Runs NUnit
#>
[CmdletBinding()]
Param(
[string]
$Configuration
,
[switch]
$AppVeyor = $false
)
$scriptsDirectory = $PSScriptRoot
$rootDirectory = Split-Path ($scriptsDirectory)
. $scriptsDirectory\modules.ps1 | out-null
$nunitDirectory = Join-Path $rootDirectory packages\NUnit.ConsoleRunner.3.7.0\tools
$nunitConsoleRunner = Join-Path $nunitDirectory nunit3-console.exe
$testAssemblies = @(
"test\GitHub.Api.UnitTests\bin\$Configuration\net461\GitHub.Api.UnitTests.dll",
"test\GitHub.App.UnitTests\bin\$Configuration\net461\GitHub.App.UnitTests.dll",
"test\GitHub.Exports.Reactive.UnitTests\bin\$Configuration\net461\GitHub.Exports.Reactive.UnitTests.dll",
"test\GitHub.Exports.UnitTests\bin\$Configuration\net461\GitHub.Exports.UnitTests.dll",
"test\GitHub.Extensions.UnitTests\bin\$Configuration\net461\GitHub.Extensions.UnitTests.dll",
"test\GitHub.InlineReviews.UnitTests\bin\$Configuration\net461\GitHub.InlineReviews.UnitTests.dll",
"test\GitHub.TeamFoundation.UnitTests\bin\$Configuration\net461\GitHub.TeamFoundation.UnitTests.dll",
"test\GitHub.UI.UnitTests\bin\$Configuration\net461\GitHub.UI.UnitTests.dll",
"test\GitHub.VisualStudio.UnitTests\bin\$Configuration\net461\GitHub.VisualStudio.UnitTests.dll",
"test\MetricsTests\MetricsTests\bin\$Configuration\MetricsTests.dll",
"test\TrackingCollectionTests\bin\$Configuration\net461\TrackingCollectionTests.dll"
)
$opencoverTargetArgs = ($testAssemblies -join " ") + " --where \`"cat!=Timings and cat!=CodeCoverageFlake\`" --inprocess --noresult"
$opencoverDirectory = Join-Path $env:USERPROFILE .nuget\packages\opencover\4.6.519\tools
$opencover = Join-Path $opencoverDirectory OpenCover.Console.exe
$opencoverArgs = @(
"-target:`"$nunitConsoleRunner`"",
"-targetargs:`"$opencoverTargetArgs`"",
"-filter:`"+[GitHub*]* -[GitHub*Unit]GitHub.*.SampleData -[GitHub*UnitTests]*`"",
"-excludebyfile:*.xaml;*.xaml.cs",
"-register:user -output:$rootDirectory\coverage.xml"
) -join " "
$codecovDirectory = Join-Path $env:USERPROFILE .nuget\packages\codecov\1.1.0\tools
$codecov = Join-Path $codecovDirectory codecov.exe
$codecovArgs = "-f $rootDirectory\coverage.xml"
& {
Trap {
Write-Output "OpenCover trapped"
exit 0
}
Write-Output $opencover
Run-Process 600 $opencover $opencoverArgs
if (!$?) {
Write-Output "OpenCover failed"
exit 0
}
}
if($AppVeyor) {
& {
Trap {
Write-Output "Codecov trapped"
exit 0
}
Push-AppveyorArtifact "$rootDirectory\coverage.xml"
Run-Process 300 $codecov $codecovArgs
if (!$?) {
Write-Output "Codecov failed"
exit 0
}
}
}

Просмотреть файл

@ -1,54 +0,0 @@
<#
.SYNOPSIS
Runs NUnit
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]
$BasePathToProject
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]
$Project
,
[int]
$TimeoutDuration
,
[string]
$Configuration
,
[switch]
$AppVeyor = $false
)
$scriptsDirectory = $PSScriptRoot
$rootDirectory = Split-Path ($scriptsDirectory)
. $scriptsDirectory\modules.ps1 | out-null
$dll = "$BasePathToProject\$Project\bin\$Configuration\$Project.dll"
$nunitDirectory = Join-Path $rootDirectory packages\NUnit.ConsoleRunner.3.7.0\tools
$consoleRunner = Join-Path $nunitDirectory nunit3-console.exe
$xml = Join-Path $rootDirectory "nunit-$Project.xml"
& {
Trap {
Write-Output "$Project tests failed"
exit -1
}
$args = @()
if ($AppVeyor) {
$args = $dll, "--where", "cat!=Timings", "--result=$xml;format=AppVeyor"
} else {
$args = $dll, "--where", "cat!=Timings", "--result=$xml"
}
Run-Process -Fatal $TimeoutDuration $consoleRunner $args
if (!$?) {
Die 1 "$Project tests failed"
}
}

Просмотреть файл

@ -1,89 +0,0 @@
<#
.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"
,
[switch]
$Package = $false
,
[switch]
$AppVeyor = $false
,
[switch]
$BumpVersion = $false
,
[int]
$BuildNumber = -1
,
[switch]
$Trace = $false
,
[switch]
$ForVSInstaller = $false
)
Set-StrictMode -Version Latest
if ($Trace) {
Set-PSDebug -Trace 1
}
. $PSScriptRoot\modules.ps1 | out-null
$env:PATH = "$scriptsDirectory;$scriptsDirectory\Modules;$env:PATH"
Import-Module $scriptsDirectory\Modules\Debugging.psm1
Vsix | out-null
Push-Location $rootDirectory
if ($Package -and $BuildNumber -gt -1) {
$BumpVersion = $true
}
if ($UpdateSubmodules) {
Update-Submodules
}
if ($Clean) {
Clean-WorkingTree
}
if ($BumpVersion) {
Write-Output "Bumping the version"
Bump-Version -BumpBuild -BuildNumber:$BuildNumber
}
if ($Package) {
Write-Output "Building and packaging GitHub for Visual Studio"
} else {
Write-Output "Building GitHub for Visual Studio"
}
Build-Solution GitHubVs.sln "Build" $config -Deploy:$Package -ForVSInstaller:$ForVSInstaller -VsixFileName:GitHub.VisualStudio.vsix
Push-Location src
Build-Solution GitHub.VisualStudio.16.sln "Build" $config -Deploy:$Package -ForVSInstaller:$ForVSInstaller -VsixFileName:GitHub.VisualStudio.16.vsix
Pop-Location
Pop-Location

Просмотреть файл

@ -1 +0,0 @@
@echo off

Просмотреть файл

@ -1,66 +0,0 @@
$scriptsDirectory = Split-Path $MyInvocation.MyCommand.Path
$rootDirectory = Split-Path ($scriptsDirectory)
function Die([string]$message, [object[]]$output) {
if ($output) {
Write-Output $output
$message += ". See output above."
}
Throw (New-Object -TypeName ScriptException -ArgumentList $message)
}
if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe") {
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe"
}
else {
Die("No suitable msbuild.exe found.")
}
$git = (Get-Command 'git.exe').Path
if (!$git) {
$git = Join-Path $rootDirectory 'PortableGit\cmd\git.exe'
}
if (!$git) {
throw "Couldn't find installed an git.exe"
}
$nuget = Join-Path $rootDirectory "tools\nuget\nuget.exe"
function Create-TempDirectory {
$path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
New-Item -Type Directory $path
}
function Build-Solution([string]$solution,[string]$target,[string]$configuration, [bool]$ForVSInstaller) {
Run-Command -Fatal { & $nuget restore $solution -NonInteractive -Verbosity detailed }
$flag1 = ""
$flag2 = ""
if ($ForVSInstaller) {
$flag1 = "/p:IsProductComponent=true"
$flag2 = "/p:TargetVsixContainer=$rootDirectory\build\vsinstaller\GitHub.VisualStudio.vsix"
new-item -Path $rootDirectory\build\vsinstaller -ItemType Directory -Force | Out-Null
}
Write-Output "$msbuild $solution /target:$target /property:Configuration=$configuration /p:DeployExtension=false /verbosity:minimal /p:VisualStudioVersion=14.0 $flag1 $flag2"
Run-Command -Fatal { & $msbuild $solution /target:$target /property:Configuration=$configuration /p:DeployExtension=false /verbosity:minimal /p:VisualStudioVersion=14.0 $flag1 $flag2 }
}
function Push-Changes([string]$branch) {
Push-Location $rootDirectory
Write-Output "Pushing $Branch to GitHub..."
Run-Command -Fatal { & $git push origin $branch }
Pop-Location
}
Add-Type -AssemblyName "System.Core"
Add-Type -TypeDefinition @"
public class ScriptException : System.Exception
{
public ScriptException(string message) : base(message)
{
}
}
"@

Просмотреть файл

@ -1,196 +0,0 @@
Add-Type -AssemblyName "System.Core"
Add-Type -TypeDefinition @"
public class ScriptException : System.Exception
{
public int ExitCode { get; private set; }
public ScriptException(string message, int exitCode) : base(message)
{
this.ExitCode = exitCode;
}
}
"@
New-Module -ScriptBlock {
$rootDirectory = Split-Path ($PSScriptRoot)
$scriptsDirectory = Join-Path $rootDirectory "scripts"
$nuget = Join-Path $rootDirectory "tools\nuget\nuget.exe"
Export-ModuleMember -Variable scriptsDirectory,rootDirectory,nuget
}
New-Module -ScriptBlock {
function Die([int]$exitCode, [string]$message, [object[]]$output) {
#$host.SetShouldExit($exitCode)
if ($output) {
Write-Host $output
$message += ". See output above."
}
$hash = @{
Message = $message
ExitCode = $exitCode
Output = $output
}
Throw (New-Object -TypeName ScriptException -ArgumentList $message,$exitCode)
#throw $message
}
function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) {
$output = ""
$exitCode = 0
if ($Quiet) {
$output = & $command 2>&1 | %{ "$_" }
} else {
& $command
}
if (!$? -and $LastExitCode -ne 0) {
$exitCode = $LastExitCode
} elseif ($? -and $LastExitCode -ne 0) {
$exitCode = $LastExitCode
}
if ($exitCode -ne 0) {
if (!$Fatal) {
Write-Host "``$Command`` failed" $output
} else {
Die $exitCode "``$Command`` failed" $output
}
}
$output
}
function Run-Process([int]$Timeout, [string]$Command, [string[]]$Arguments, [switch]$Fatal = $false)
{
$args = ($Arguments | %{ "`"$_`"" })
[object[]] $output = "$Command " + $args
$exitCode = 0
$outputPath = [System.IO.Path]::GetTempFileName()
$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $outputPath $Command ($args | %{ "`"$_`"" })
Wait-Process -InputObject $process -Timeout $Timeout -ErrorAction SilentlyContinue
if ($process.HasExited) {
$output += Get-Content $outputPath
$exitCode = $process.ExitCode
} else {
$output += "Process timed out. Backtrace:"
$output += Get-DotNetStack $process.Id
$exitCode = 9999
}
Stop-Process -InputObject $process
Remove-Item $outputPath
if ($exitCode -ne 0) {
if (!$Fatal) {
Write-Host "``$Command`` failed" $output
} else {
Die $exitCode "``$Command`` failed" $output
}
}
$output
}
function Create-TempDirectory {
$path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
New-Item -Type Directory $path
}
Export-ModuleMember -Function Die,Run-Command,Run-Process,Create-TempDirectory
}
New-Module -ScriptBlock {
function Find-MSBuild() {
if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe") {
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe"
}
else {
Die("No suitable msbuild.exe found.")
}
$msbuild
}
function Build-Solution([string]$solution, [string]$target, [string]$configuration, [switch]$ForVSInstaller = $false, [string]$VsixFileName, [bool]$Deploy = $false) {
$msbuild = Find-MSBuild
Run-Command -Fatal { & $nuget restore $solution -NonInteractive -Verbosity detailed -MSBuildPath (Split-Path -parent $msbuild) }
$flag1 = ""
$flag2 = ""
if ($ForVSInstaller) {
$flag1 = "/p:IsProductComponent=true"
$flag2 = "/p:TargetVsixContainer=$rootDirectory\build\vsinstaller\$VsixFileName"
new-item -Path $rootDirectory\build\vsinstaller -ItemType Directory -Force | Out-Null
} elseif (!$Deploy) {
$configuration += "WithoutVsix"
$flag1 = "/p:Package=Skip"
}
Write-Host "$msbuild $solution /target:$target /property:Configuration=$configuration /p:DeployExtension=false /verbosity:minimal /p:VisualStudioVersion=16.0 /bl:output.binlog $flag1 $flag2"
Run-Command -Fatal { & $msbuild $solution /target:$target /property:Configuration=$configuration /p:DeployExtension=false /verbosity:minimal /p:VisualStudioVersion=16.0 /bl:output.binlog $flag1 $flag2 }
}
Export-ModuleMember -Function Find-MSBuild,Build-Solution
}
New-Module -ScriptBlock {
function Find-Git() {
$git = (Get-Command 'git.exe').Path
if (!$git) {
$git = Join-Path $rootDirectory 'PortableGit\cmd\git.exe'
}
if (!$git) {
Die("Couldn't find installed an git.exe")
}
$git
}
function Push-Changes([string]$branch) {
Push-Location $rootDirectory
Write-Host "Pushing $Branch to GitHub..."
Run-Command -Fatal { & $git push origin $branch }
Pop-Location
}
function Update-Submodules {
Write-Host "Updating submodules..."
Write-Host ""
Run-Command -Fatal { git submodule init }
Run-Command -Fatal { git submodule sync }
Run-Command -Fatal { git submodule update --recursive --force }
}
function Clean-WorkingTree {
Write-Host "Cleaning work tree..."
Write-Host ""
Run-Command -Fatal { git clean -xdf }
Run-Command -Fatal { git submodule foreach git clean -xdf }
}
function Get-HeadSha {
Run-Command -Quiet { & $git rev-parse HEAD }
}
$git = Find-Git
Export-ModuleMember -Function Find-Git,Push-Changes,Update-Submodules,Clean-WorkingTree,Get-HeadSha
}
New-Module -ScriptBlock {
function Write-Manifest([string]$directory) {
Add-Type -Path (Join-Path $rootDirectory build\Release\Newtonsoft.Json.dll)
$manifest = @{
NewestExtension = @{
Version = [string](Read-CurrentVersionVsix 'src\GitHub.VisualStudio.Vsix')
Commit = [string](Get-HeadSha)
}
}
$manifestPath = Join-Path $directory manifest
[Newtonsoft.Json.JsonConvert]::SerializeObject($manifest) | Out-File $manifestPath -Encoding UTF8
}
Export-ModuleMember -Function Write-Manifest
}

Просмотреть файл

@ -1,41 +0,0 @@
Set-StrictMode -Version Latest
New-Module -ScriptBlock {
function Get-AppVeyorPath {
Join-Path $rootDirectory appveyor.yml
}
function Read-VersionAppVeyor {
$file = Get-AppVeyorPath
$currentVersion = Get-Content $file | %{
$regex = "`^version: '(\d+\.\d+\.\d+)\.`{build`}'`$"
if ($_ -match $regex) {
$matches[1]
}
}
[System.Version] $currentVersion
}
function Write-VersionAppVeyor([System.Version]$version) {
$file = Get-AppVeyorPath
$numberOfReplacements = 0
$newContent = Get-Content $file | %{
$newString = $_
$regex = "version: '(\d+\.\d+\.\d+)"
if ($newString -match $regex) {
$numberOfReplacements++
$newString = $newString -replace $regex, "version: '$($version.Major).$($version.Minor).$($version.Build)"
}
$newString
}
if ($numberOfReplacements -ne 1) {
Die 1 "Expected to replace the version number in 1 place in appveyor.yml (version) but actually replaced it in $numberOfReplacements"
}
$newContent | Set-Content $file
}
Export-ModuleMember -Function Get-AppVeyorPath,Read-VersionAppVeyor,Write-VersionAppVeyor
}

Просмотреть файл

@ -1,18 +0,0 @@
Set-StrictMode -Version Latest
function Update-Submodules {
Write-Output "Updating submodules..."
Write-Output ""
Run-Command -Fatal { git submodule init }
Run-Command -Fatal { git submodule sync }
Run-Command -Fatal { git submodule update --recursive --force }
}
function Clean-WorkingTree {
Write-Output "Cleaning work tree..."
Write-Output ""
Run-Command -Fatal { git clean -xdf }
Run-Command -Fatal { git submodule foreach git clean -xdf }
}

Просмотреть файл

@ -1,26 +0,0 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$rootDirectory = Split-Path (Split-Path (Split-Path $MyInvocation.MyCommand.Path))
$cdb = Join-Path $rootDirectory "tools\Debugging Tools for Windows\cdb.exe"
function Get-DotNetStack([int]$ProcessId) {
$commands = @(
".cordll -ve -u -l",
".loadby sos clr",
"!eestack -ee",
".detach",
"q"
)
$Env:_NT_SYMBOL_PATH = "cache*${Env:PROGRAMDATA}\dbg\sym;SRV*http://msdl.microsoft.com/download/symbols;srv*http://windows-symbols.githubapp.com/symbols"
$output = & $cdb -lines -p $ProcessId -c ($commands -join "; ")
if ($LastExitCode -ne 0) {
$output
throw "Error running cdb"
}
$start = ($output | Select-String -List -Pattern "^Thread 0").LineNumber - 1
$end = ($output | Select-String -List -Pattern "^Detached").LineNumber - 2
$output[$start..$end]
}

Просмотреть файл

@ -1,24 +0,0 @@
Set-StrictMode -Version Latest
New-Module -ScriptBlock {
function Get-DirectoryBuildPropsPath {
Join-Path $rootDirectory Directory.Build.Props
}
function Get-DirectoryBuildProps {
$xmlLines = Get-Content (Get-DirectoryBuildPropsPath) -encoding UTF8
[xml] $xmlLines
}
function Write-DirectoryBuildProps([System.Version]$version) {
$document = Get-DirectoryBuildProps
$numberOfReplacements = 0
$document.Project.PropertyGroup.Version = $version.ToString()
$document.Save((Get-DirectoryBuildPropsPath))
}
Export-ModuleMember -Function Write-DirectoryBuildProps
}

Просмотреть файл

@ -1,41 +0,0 @@
Set-StrictMode -Version Latest
New-Module -ScriptBlock {
function Get-SolutionInfoPath {
Join-Path $rootDirectory src\common\SolutionInfo.cs
}
function Read-VersionSolutionInfo {
$file = Get-SolutionInfoPath
$currentVersion = Get-Content $file | %{
$regex = "const string Version = `"(\d+\.\d+\.\d+\.\d+)`";"
if ($_ -match $regex) {
$matches[1]
}
}
[System.Version] $currentVersion
}
function Write-VersionSolutionInfo([System.Version]$version) {
$file = Get-SolutionInfoPath
$numberOfReplacements = 0
$newContent = Get-Content $file | %{
$newString = $_
$regex = "(string Version = `")\d+\.\d+\.\d+\.\d+"
if ($_ -match $regex) {
$numberOfReplacements++
$newString = $newString -replace $regex, "string Version = `"$version"
}
$newString
}
if ($numberOfReplacements -ne 1) {
Die 1 "Expected to replace the version number in 1 place in SolutionInfo.cs (Version) but actually replaced it in $numberOfReplacements"
}
$newContent | Set-Content $file
}
Export-ModuleMember -Function Get-SolutionInfoPath,Read-VersionSolutionInfo,Write-VersionSolutionInfo
}

Просмотреть файл

@ -1,70 +0,0 @@
Set-StrictMode -Version Latest
New-Module -ScriptBlock {
function Validate-Version([System.Version]$version) {
($version.Major -ge 0) -and ($version.Minor -ge 0) -and ($version.Build -ge 0)
}
function Generate-Version([System.Version]$currentVersion,
[bool]$BumpMajor, [bool] $BumpMinor,
[bool]$BumpPatch, [bool] $BumpBuild,
[int]$BuildNumber = -1) {
if (!(Validate-Version $currentVersion)) {
Die 1 "Invalid current version $currentVersion"
}
if ($BumpMajor) {
New-Object -TypeName System.Version -ArgumentList ($currentVersion.Major + 1), $currentVersion.Minor, $currentVersion.Build, 0
} elseif ($BumpMinor) {
New-Object -TypeName System.Version -ArgumentList $currentVersion.Major, ($currentVersion.Minor + 1), $currentVersion.Build, 0
} elseif ($BumpPatch) {
New-Object -TypeName System.Version -ArgumentList $currentVersion.Major, $currentVersion.Minor, ($currentVersion.Build + 1), 0
} elseif ($BumpBuild) {
if ($BuildNumber -ge 0) {
[System.Version] "$($currentVersion.Major).$($currentVersion.Minor).$($currentVersion.Build).$BuildNumber"
} else {
$timestamp = [System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
[System.Version] "$($currentVersion.Major).$($currentVersion.Minor).$($currentVersion.Build).$timestamp"
}
}
else {
$currentVersion
}
}
function Read-Version {
Read-VersionAppVeyor
}
function Write-Version([System.Version]$version) {
Write-VersionVsixManifest $version 'src\GitHub.VisualStudio.Vsix'
Write-VersionVsixManifest $version 'src\GitHub.VisualStudio.16'
Write-VersionSolutionInfo $version
Write-VersionAppVeyor $version
Write-DirectoryBuildProps $version
Push-Location $rootDirectory
New-Item -Type Directory -ErrorAction SilentlyContinue build | out-null
Set-Content build\version $version
Pop-Location
}
function Commit-Version([System.Version]$version) {
Write-Host "Committing version bump..."
Push-Location $rootDirectory
Run-Command -Fatal { & $git commit --message "Bump version to $version" -- }
$output = Start-Process $git "commit --all --message ""Bump version to $version""" -wait -NoNewWindow -ErrorAction Continue -PassThru
if ($output.ExitCode -ne 0) {
Die 1 "Error committing version bump"
}
Pop-Location
}
Export-ModuleMember -Function Validate-Version,Write-Version,Commit-Version,Generate-Version,Read-Version
}

Просмотреть файл

@ -1,35 +0,0 @@
Set-StrictMode -Version Latest
New-Module -ScriptBlock {
function Get-VsixManifestPath([string]$projectPath) {
$gitHubDirectory = Join-Path $rootDirectory $projectPath
Join-Path $gitHubDirectory source.extension.vsixmanifest
}
function Get-VsixManifestXml([string]$projectPath) {
$xmlLines = Get-Content (Get-VsixManifestPath($projectPath))
# If we don't explicitly join the lines with CRLF, comments in the XML will
# end up with LF line-endings, which will make Git spew a warning when we
# try to commit the version bump.
$xmlText = $xmlLines -join [System.Environment]::NewLine
[xml] $xmlText
}
function Read-CurrentVersionVsix([string]$projectPath) {
[System.Version] (Get-VsixManifestXml($projectPath)).PackageManifest.Metadata.Identity.Version
}
function Write-VersionVsixManifest([System.Version]$version,[string]$projectPath) {
$document = Get-VsixManifestXml($projectPath)
$numberOfReplacements = 0
$document.PackageManifest.Metadata.Identity.Version = $version.ToString()
$document.Save((Get-VsixManifestPath($projectPath)))
}
Export-ModuleMember -Function Read-CurrentVersionVsix,Write-VersionVsixManifest
}

Просмотреть файл

@ -1,109 +0,0 @@
<#
.SYNOPSIS
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.
#>
[CmdletBinding()]
Param(
[ValidateSet('Debug', 'Release')]
[string]
$Config = "Release"
,
[int]
$TimeoutDuration = 180
,
[switch]
$Trace = $false
)
Set-StrictMode -Version Latest
if ($Trace) {
Set-PSDebug -Trace 1
}
$env:PATH = "$PSScriptRoot;$env:PATH"
$exitcode = 0
Write-Output "Running Tracking Collection Tests..."
Run-NUnit test TrackingCollectionTests $TimeoutDuration $config
if (!$?) {
$exitcode = 1
}
Write-Output "Running GitHub.Api.UnitTests..."
Run-NUnit test GitHub.Api.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 2
}
Write-Output "Running GitHub.App.UnitTests..."
Run-NUnit test GitHub.App.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 3
}
Write-Output "Running GitHub.Exports.Reactive.UnitTests..."
Run-NUnit test GitHub.Exports.Reactive.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 4
}
Write-Output "Running GitHub.Exports.UnitTests..."
Run-NUnit test GitHub.Exports.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 5
}
Write-Output "Running GitHub.Extensions.UnitTests..."
Run-NUnit test GitHub.Extensions.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 6
}
Write-Output "Running GitHub.Primitives.UnitTests..."
Run-NUnit test GitHub.Primitives.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 7
}
Write-Output "Running GitHub.TeamFoundation.UnitTests..."
Run-NUnit test GitHub.TeamFoundation.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 8
}
Write-Output "Running GitHub.UI.UnitTests..."
Run-NUnit test GitHub.UI.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 9
}
Write-Output "Running GitHub.VisualStudio.UnitTests..."
Run-NUnit test GitHub.VisualStudio.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 10
}
Write-Output "Running GitHub.InlineReviews.UnitTests..."
Run-NUnit test GitHub.InlineReviews.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 11
}
Write-Output "Running GitHub.StartPage.UnitTests..."
Run-NUnit test GitHub.StartPage.UnitTests $TimeoutDuration $config
if (!$?) {
$exitcode = 12
}
if ($exitcode -ne 0) {
$host.SetShouldExit($exitcode)
}
exit $exitcode

Двоичные данные
signingkey.snk

Двоичный файл не отображается.

Просмотреть файл

@ -1,16 +0,0 @@
using System;
namespace GitHub.Api
{
static partial class ApiClientConfiguration
{
const string clientId = "YOUR CLIENT ID HERE";
const string clientSecret = "YOUR CLIENT SECRET HERE";
static partial void Configure()
{
ClientId = clientId;
ClientSecret = clientSecret;
}
}
}

Просмотреть файл

@ -7,13 +7,34 @@
<Import Project="$(SolutionDir)\src\common\signing.props" />
<ItemGroup Condition="$(Buildtype) == 'Internal'">
<Compile Remove="ApiClientConfiguration_User.cs" />
<Compile Include="..\..\script\src\ApiClientConfiguration_User.cs">
<Link>ApiClientConfiguration_User.cs</Link>
</Compile>
</ItemGroup>
<Target Name="AddClientSecret" BeforeTargets="BeforeCompile"
Inputs="$(MSBuildThisFileFullPath)" Outputs="$(IntermediateOutputPath)ApiClientConfiguration.$(GitHubVS_ClientId).cs">
<Error Condition="'$(GitHubVS_ClientId)' == '' OR '$(GitHubVS_ClientSecret)' == ''"
Text="Please define 'GitHubVS_ClientId' and 'GitHubVS_ClientSecret' environment variables (restart Visual Studio if necessary)" />
<PropertyGroup>
<GeneratedFilePath>$(IntermediateOutputPath)ApiClientConfiguration.$(GitHubVS_ClientId).cs</GeneratedFilePath>
<GeneratedText>
<![CDATA[
namespace GitHub.Api
{
static partial class ApiClientConfiguration
{
static partial void Configure()
{
ClientId = "$(GitHubVS_ClientId)"%3b
ClientSecret = "$(GitHubVS_ClientSecret)"%3b
}
}
}
]]>
</GeneratedText>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(GeneratedFilePath)" />
</ItemGroup>
<WriteLinesToFile File="$(GeneratedFilePath)" Lines="$(GeneratedText)" WriteOnlyWhenDifferent="true" Overwrite="true" />
</Target>
<ItemGroup>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Net.Http" />

Просмотреть файл

@ -0,0 +1,9 @@
namespace GitHub
{
public static class ExtensionInformation
{
// HACK: For some reason ThisAssembly.AssemblyFileVersion can't be referenced
// directly from inside GitHub.VisualStudio.
public const string Version = ThisAssembly.AssemblyFileVersion;
}
}

Просмотреть файл

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="f4fbb70d-dee2-4dee-b322-bd74e3010e8f" Version="2.10.8.0" Language="en-US" Publisher="GitHub, Inc" />
<Identity Id="f4fbb70d-dee2-4dee-b322-bd74e3010e8f" Version="|%CurrentProject%;GetBuildVersion|" Language="en-US" Publisher="GitHub, Inc" />
<DisplayName>GitHub Essentials</DisplayName>
<Description>Clone or checkout code from GitHub</Description>
<PackageId>GitHub.VisualStudio.16</PackageId>

Просмотреть файл

@ -357,7 +357,6 @@
<Import Project="packaging.targets" />
<!-- For regenerating templates on build -->
<Import Project="..\common\t4.targets" />
<Import Project="versioning.targets" />
<!--
This is a workaround for allowing neutral CTO resource produced from *.vsct to go in the main assembly.
We move the neutral *.cto file to be categorized as WithCulture=true,Culture=en to prevent the tools from falsely reporting:

Просмотреть файл

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="c3d3dc68-c977-411f-b3e8-03b0dccf7dfc" Version="2.10.8.0" Language="en-US" Publisher="GitHub, Inc" />
<Identity Id="c3d3dc68-c977-411f-b3e8-03b0dccf7dfc" Version="|%CurrentProject%;GetBuildVersion|" Language="en-US" Publisher="GitHub, Inc" />
<DisplayName>GitHub Extension for Visual Studio</DisplayName>
<Description xml:space="preserve">A Visual Studio Extension that brings the GitHub Flow into Visual Studio.</Description>
<PackageId>GitHub.VisualStudio</PackageId>

Просмотреть файл

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask
TaskName="GenerateVersion"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<SolutionInfoFile ParameterType="System.String" Required="true" />
<GeneratedVersion ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var str = File.ReadAllText(this.SolutionInfoFile);
var regex = new Regex(@"Version = ""([\d]+\.[\d]+\.[\d]+.[\d]+)""");
var v = Version.Parse(regex.Match(str).Groups[1].Value);
this.GeneratedVersion = String.Format("{0}.{1}.{2}.{3}", v.Major, v.Minor, v.Build, DateTimeOffset.UtcNow.ToUnixTimeSeconds());
]]>
</Code>
</Task>
</UsingTask>
<Target Name="GenerateVersionFile"
Condition="$(SkipPackage) != 'Skip'"
AfterTargets="CoreCompile"
Inputs="$(SolutionDir)\src\common\SolutionInfo.cs"
Outputs="$(SolutionDir)\build\version">
<GenerateVersion SolutionInfoFile="$(SolutionDir)\src\common\SolutionInfo.cs">
<Output TaskParameter="GeneratedVersion" PropertyName="GeneratedVersion" />
</GenerateVersion>
<Message Text="Generating file '$(SolutionDir)\build\version' with version '$(GeneratedVersion)'" />
<WriteLinesToFile File="$(SolutionDir)\build\version" Lines="$(GeneratedVersion)" Overwrite="True" />
</Target>
<Target Name="GetBuildVersion" Returns="$(BuildVersion)" DependsOnTargets="GenerateVersionFile">
<ReadLinesFromFile File="$(SolutionDir)\build\version">
<Output TaskParameter="Lines" PropertyName="BuildVersion" />
</ReadLinesFromFile>
</Target>
</Project>

Просмотреть файл

@ -170,7 +170,6 @@
<None Include="..\common\settings.json">
<Link>Properties\settings.json</Link>
</None>
<None Include="..\..\build\version" />
</ItemGroup>
<ItemGroup>
<VSCTCompile Include="GitHub.VisualStudio.vsct">
@ -318,7 +317,6 @@
<Import Project="packaging.targets" />
<!-- For regenerating templates on build -->
<Import Project="..\common\t4.targets" />
<Import Project="versioning.targets" />
<!--
This is a workaround for allowing neutral CTO resource produced from *.vsct to go in the main assembly.
We move the neutral *.cto file to be categorized as WithCulture=true,Culture=en to prevent the tools from falsely reporting:

Просмотреть файл

@ -35,7 +35,7 @@ using static System.FormattableString;
namespace GitHub.VisualStudio
{
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", AssemblyVersionInformation.Version)]
[InstalledProductRegistration("#110", "#112", ExtensionInformation.Version)]
[Guid(Guids.guidGitHubPkgString)]
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideAutoLoad(Guids.GitContextPkgString, PackageAutoLoadFlags.BackgroundLoad)]

Просмотреть файл

@ -171,7 +171,7 @@ namespace GitHub.Services
current.Dimensions.Lang = CultureInfo.InstalledUICulture.IetfLanguageTag;
current.Dimensions.CurrentLang = CultureInfo.CurrentCulture.IetfLanguageTag;
current.Dimensions.CurrentUILang = CultureInfo.CurrentUICulture.IetfLanguageTag;
current.Dimensions.AppVersion = AssemblyVersionInformation.Version;
current.Dimensions.AppVersion = ExtensionInformation.Version;
current.Dimensions.VSVersion = vsservices.VSVersion;
current.Dimensions.IsGitHubUser = IsGitHubUser;

Просмотреть файл

@ -49,7 +49,7 @@ namespace GitHub.Services
var operation = new TelemetryEvent(Event.UsageTracker);
operation.Properties[Property.TelemetryVersion] = TelemetryVersion;
operation.Properties[Property.CounterName] = counterName;
operation.Properties[Property.ExtensionVersion] = AssemblyVersionInformation.Version;
operation.Properties[Property.ExtensionVersion] = ExtensionInformation.Version;
operation.Properties[Property.IsGitHubUser] = IsGitHubUser;
operation.Properties[Property.IsEnterpriseUser] = IsEnterpriseUser;

Просмотреть файл

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask
TaskName="GenerateVersion"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<SolutionInfoFile ParameterType="System.String" Required="true" />
<GeneratedVersion ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var str = File.ReadAllText(this.SolutionInfoFile);
var regex = new Regex(@"Version = ""([\d]+\.[\d]+\.[\d]+.[\d]+)""");
var v = Version.Parse(regex.Match(str).Groups[1].Value);
this.GeneratedVersion = String.Format("{0}.{1}.{2}.{3}", v.Major, v.Minor, v.Build, DateTimeOffset.UtcNow.ToUnixTimeSeconds());
]]>
</Code>
</Task>
</UsingTask>
<Target Name="GenerateVersionFile"
Condition="$(SkipPackage) != 'Skip'"
AfterTargets="CoreCompile"
Inputs="$(SolutionDir)\src\common\SolutionInfo.cs"
Outputs="$(SolutionDir)\build\version">
<GenerateVersion SolutionInfoFile="$(SolutionDir)\src\common\SolutionInfo.cs">
<Output TaskParameter="GeneratedVersion" PropertyName="GeneratedVersion" />
</GenerateVersion>
<Message Text="Generating file '$(SolutionDir)\build\version' with version '$(GeneratedVersion)'" />
<WriteLinesToFile File="$(SolutionDir)\build\version" Lines="$(GeneratedVersion)" Overwrite="True" />
</Target>
<Target Name="GetBuildVersion" Returns="$(BuildVersion)" DependsOnTargets="GenerateVersionFile">
<ReadLinesFromFile File="$(SolutionDir)\build\version">
<Output TaskParameter="Lines" PropertyName="BuildVersion" />
</ReadLinesFromFile>
</Target>
</Project>

Просмотреть файл

@ -1,23 +1,12 @@
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub Extension for Visual Studio")]
[assembly: AssemblyVersion(AssemblyVersionInformation.Version)]
[assembly: AssemblyFileVersion(AssemblyVersionInformation.Version)]
[assembly: AssemblyInformationalVersion(AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright © GitHub, Inc. 2014-2016")]
[assembly: AssemblyCopyright("Copyright © GitHub, Inc. 2014-2019")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "2.10.8.0";
}
}

Просмотреть файл

@ -1,28 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildType Condition="Exists('..\..\script\key.snk')">Internal</BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildType)' == 'Internal'">
<AssemblyOriginatorKeyFile>..\..\script\key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildType)' != 'Internal' and Exists('..\..\signingkey')">
<AssemblyOriginatorKeyFile>..\..\signingkey.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>..\..\key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\script\key.snk" Condition="'$(BuildType)' == 'Internal'">
<None Include="..\..\key.snk">
<Link>key.snk</Link>
</None>
<None Include="..\..\signingkey" Condition="'$(BuildType)' != 'Internal' and Exists('..\..\signingkey')">
<Link>signingkey</Link>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,2 +0,0 @@
@if "%1" == "" echo Please specify Debug or Release && EXIT /B
powershell -ExecutionPolicy Unrestricted scripts\test.ps1 -Config:%1

Просмотреть файл

@ -18,19 +18,3 @@ using System.Runtime.InteropServices;
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("14fdee91-7301-4247-846c-049647bf8e99")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -18,19 +18,3 @@ using System.Runtime.InteropServices;
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("09313e65-7adb-48c1-ad3a-572020c5bdcb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Двоичные данные
tools/VsixUtil/VsixUtil.exe

Двоичный файл не отображается.

13
vars.cmd Normal file
Просмотреть файл

@ -0,0 +1,13 @@
@echo off
rem Add path to Visual Studio 2019 Tools
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools" set PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\Common7\Tools" set PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\Common7\Tools
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools" set PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\Common7\Tools" set PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\Common7\Tools
rem Set up Developer Command Prompt
call VsDevCmd.bat
rem Use local NuGet version
set PATH=%cd%\tools\nuget;%PATH%

11
version.json Normal file
Просмотреть файл

@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "2.11",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
],
"assemblyVersion": {
"precision": "revision"
}
}