提交 eff05a2f 编写于 作者: T Tanner Gooding

Updating Roslyn to use the Managed Query API for locating a valid Dev15 install.

上级 f6ff3b9a
@echo off
@setlocal
@setlocal enabledelayedexpansion
set RoslynRoot=%~dp0
set DevDivPackages=%RoslynRoot%src\Setup\DevDivPackages
......@@ -47,6 +47,14 @@ call "%NugetExe%" restore "%RoslynRoot%build\ToolsetPackages\dev15Willow.project
echo Restoring packages: Roslyn SDK
call "%NugetExe%" restore "%RoslynRoot%build\ToolsetPackages\roslynsdk.project.json" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed
echo Locating MSBuild for Solution restore
call "%RoslynRoot%SetDevCommandPrompt.cmd" || goto :RestoreFailed
REM If we have an applocal copy of MSBuild, pass it to NuGet. Otherwise, assume NuGet knows how to find it.
if exist "%DevenvDir%\..\..\MSBuild\15.0\Bin\MSBuild.exe" (
set NuGetAdditionalCommandLineArgs=%NuGetAdditionalCommandLineArgs% -msbuildpath "%DevenvDir%\..\..\MSBuild\15.0\Bin"
)
echo Restoring packages: Samples
call "%NugetExe%" restore "%RoslynRoot%src\Samples\Samples.sln" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed
......
@echo off
:: prefer building with Dev15
:: Prefer building with Dev15 and try the simple route first (we may be running from a DevCmdPrompt already)
set CommonToolsDir=%VS150COMNTOOLS%
:: VS150COMNTOOLS is not set globally any more, so fall back to default preview location before trying Dev14
if not exist "%CommonToolsDir%" set CommonToolsDir=%ProgramFiles(x86)%\\Microsoft Visual Studio\\VS15Preview\\Common7\\Tools\\
:: VS150COMNTOOLS is not set globally any more, so fall back to using the managed query api before trying Dev14
if not exist "%CommonToolsDir%" for /f "usebackq delims=" %%v in (`powershell -noprofile -executionPolicy Bypass -file "%RoslynRoot%build\scripts\locate-vs.ps1"`) do set "CommonToolsDir=%%v"
if not exist "%CommonToolsDir%" set CommonToolsDir=%VS140COMNTOOLS%
if not exist "%CommonToolsDir%" exit /b 1
call "%CommonToolsDir%\VsDevCmd.bat"
exit /b 0
......@@ -12,6 +12,7 @@
"xunit.runner.console": "2.2.0-beta1-build3239",
"Roslyn.Build.Util": "0.9.4-portable",
"RoslynDependencies.OptimizationData": "2.0.0-rc-61101-16",
"RoslynTools.Microsoft.LocateVS": "0.2.0-beta",
"RoslynTools.Microsoft.SignTool": "0.2.0-beta"
},
"frameworks": {
......
......@@ -5,13 +5,7 @@ REM NuGet.exe, it's version and ensure that it's present on the enlistment.
set NuGetExeVersion=3.6.0-beta1
set NuGetExeFolder=%~dp0..\..
set NuGetExe=%NuGetExeFolder%\NuGet.exe
REM If we have an applocal copy of MSBuild, pass it to NuGet. Otherwise, assume NuGet knows how to find it.
if exist "%DevenvDir%\..\..\MSBuild\15.0\Bin\MSBuild.exe" (
set NuGetAdditionalCommandLineArgs=-verbosity quiet -configfile "%NuGetExeFolder%\nuget.config" -Project2ProjectTimeOut 1200 -msbuildpath "%DevenvDir%\..\..\MSBuild\15.0\Bin"
) else (
set NuGetAdditionalCommandLineArgs=-verbosity quiet -configfile "%NuGetExeFolder%\nuget.config" -Project2ProjectTimeOut 1200
)
set NuGetAdditionalCommandLineArgs=-verbosity quiet -configfile "%NuGetExeFolder%\nuget.config" -Project2ProjectTimeOut 1200
REM Download NuGet.exe if we haven't already
if not exist "%NuGetExe%" (
......
Param(
[string] $locateVsApiVersion = "0.2.0-beta"
)
set-strictmode -version 2.0
$ErrorActionPreference="Stop"
function Create-Directory([string[]] $path) {
if (!(Test-Path -path $path)) {
New-Item -path $path -force -itemType "Directory" | Out-Null
}
}
function Locate-LocateVsApi {
$packagesPath = Locate-PackagesPath
$locateVsApi = Join-Path -path $packagesPath -ChildPath "RoslynTools.Microsoft.LocateVS\$locateVsApiVersion\lib\net46\LocateVS.dll"
if (!(Test-Path -path $locateVsApi)) {
throw "The specified LocateVS API version ($locateVsApiVersion) could not be located."
}
return Resolve-Path -path $locateVsApi
}
function Locate-PackagesPath {
if ($env:NUGET_PACKAGES -eq $null) {
$env:NUGET_PACKAGES = Join-Path -path $env:UserProfile -childPath ".nuget\packages\"
}
$packagesPath = $env:NUGET_PACKAGES
Create-Directory -path $packagesPath
return Resolve-Path -path $packagesPath
}
try
{
$locateVsApi = Locate-LocateVsApi
$requiredPackageIds = @()
$requiredPackageIds += "Microsoft.Component.MSBuild"
$requiredPackageIds += "Microsoft.Net.Component.4.6.TargetingPack"
$requiredPackageIds += "Microsoft.VisualStudio.Component.PortableLibrary"
$requiredPackageIds += "Microsoft.VisualStudio.Component.Roslyn.Compiler"
$requiredPackageIds += "Microsoft.VisualStudio.Component.VSSDK"
Add-Type -path $locateVsApi
$visualStudioInstallationPath = [LocateVS.Instance]::GetInstallPath("15.0", $requiredPackageIds)
return Join-Path -Path $visualStudioInstallationPath -ChildPath "Common7\Tools\"
}
catch
{
Write-Host "Error: $($_.Exception.Message)"
Exit 1
}
......@@ -45,8 +45,6 @@ if not "%BuildTimeLimit%" == "" (
set RunProcessWatchdog=false
)
call "%RoslynRoot%SetDevCommandPrompt.cmd" || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-branch.ps1" || goto :BuildFailed
REM Output the commit that we're building, for reference in Jenkins logs
......@@ -55,6 +53,7 @@ git show --no-patch --pretty=raw HEAD
REM Restore the NuGet packages
call "%RoslynRoot%\Restore.cmd" || goto :BuildFailed
call "%RoslynRoot%SetDevCommandPrompt.cmd" || goto :BuildFailed
REM Ensure the binaries directory exists because msbuild can fail when part of the path to LogFile isn't present.
set bindir=%RoslynRoot%Binaries
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册