未验证 提交 a7cd9a7f 编写于 作者: J Jared Parsons 提交者: GitHub

Merge pull request #34848 from jaredpar/fix-ps

Clean up our CI setup code
......@@ -504,48 +504,9 @@ function Ensure-ProcDump() {
return $outDir
}
function Prepare-TempDir() {
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\.editorconfig") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\Directory.Build.props") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\Directory.Build.targets") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\Directory.Build.rsp") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\NuGet.Config") $TempDir
}
function List-Processes() {
Write-Host "Listing running build processes..."
Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Out-Host
Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Out-Host
Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | where { $_.Modules | select { $_.ModuleName -eq "VBCSCompiler.dll" } } | Out-Host
Get-Process -Name "devenv" -ErrorAction SilentlyContinue | Out-Host
}
try {
if ($PSVersionTable.PSVersion.Major -lt "5") {
Write-Host "PowerShell version must be 5 or greater (version $($PSVersionTable.PSVersion) detected)"
exit 1
}
$regKeyProperty = Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name "LongPathsEnabled" -ErrorAction Ignore
if (($null -eq $regKeyProperty) -or ($regKeyProperty.LongPathsEnabled -ne 1)) {
Write-Host "LongPath is not enabled, you may experience build errors. You can avoid these by enabling LongPath with ``reg ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1``"
}
Process-Arguments
. (Join-Path $PSScriptRoot "build-utils.ps1")
if ($testVsi) {
# Setup the CI machine for running our integration tests.
function Setup-IntegrationTestRun() {
$processesToStopOnExit += "devenv"
}
Push-Location $RepoRoot
if ($ci) {
List-Processes
Prepare-TempDir
if ($testVsi) {
$screenshotPath = (Join-Path $LogDir "StartingBuild.png")
try {
Capture-Screenshot $screenshotPath
......@@ -584,10 +545,48 @@ try {
# Make sure we can capture a screenshot. An exception at this point will fail-fast the build.
Capture-Screenshot $screenshotPath
}
}
function Prepare-TempDir() {
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\.editorconfig") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\Directory.Build.props") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\Directory.Build.targets") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\Directory.Build.rsp") $TempDir
Copy-Item (Join-Path $RepoRoot "src\Workspaces\MSBuildTest\Resources\NuGet.Config") $TempDir
}
function List-Processes() {
Write-Host "Listing running build processes..."
Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Out-Host
Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Out-Host
Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | where { $_.Modules | select { $_.ModuleName -eq "VBCSCompiler.dll" } } | Out-Host
Get-Process -Name "devenv" -ErrorAction SilentlyContinue | Out-Host
}
try {
if ($PSVersionTable.PSVersion.Major -lt "5") {
Write-Host "PowerShell version must be 5 or greater (version $($PSVersionTable.PSVersion) detected)"
exit 1
}
$regKeyProperty = Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name "LongPathsEnabled" -ErrorAction Ignore
if (($null -eq $regKeyProperty) -or ($regKeyProperty.LongPathsEnabled -ne 1)) {
Write-Host "LongPath is not enabled, you may experience build errors. You can avoid these by enabling LongPath with `"reg ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1`""
}
Process-Arguments
. (Join-Path $PSScriptRoot "build-utils.ps1")
Push-Location $RepoRoot
if ($ci) {
List-Processes
Prepare-TempDir
if ($testVsi) {
Setup-IntegrationTestRun
}
$global:_DotNetInstallDir = Join-Path $RepoRoot ".dotnet"
InstallDotNetSdk $global:_DotNetInstallDir $GlobalJson.tools.dotnet
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册