提交 f3d9c96f 编写于 作者: J Jared Parsons

Unify restore across Windows and Linux

This changes the Windows builds to restore in the same manner as Linux.  Helps ensure we keep the lab consistent between the runs.

The other positive upside of this change is shaves ~10 minutes of individual runs.  Roslyn.sln is a *huge* solution, has a rather large MSBuild include pattern and as a result puts a lot of pressure on restore.  As such the set of restores we do typically takes ~10 minutes.

Long term we'll be working with NuGet to get this time down a bit.  At the moment though we're a bit of an odd solution here with our size and time requirements.
上级 42da9bd8
......@@ -30,7 +30,7 @@
Outputs="$(ToolsetPackagesSemaphore);
$(ToolsetCompilerPropsFilePath);
$(RoslynDiagnosticsPropsFilePath)"
Condition="'$(OS)' == 'Windows_NT'">
Condition="'$(OS)' == 'Windows_NT' AND '$(NuGetRestorePackages)' != 'false'">
<Message Importance="High" Text="Restoring toolset packages..." />
<!-- Run restore -->
......
param ([string]$nugetZipUrl = $(throw "Need an URL to the NuGet zip") )
$destination = ${env:UserProfile}
$outFilePath = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "zip")
write-host "Downloading $nugetZipUrl -> $outFilePath"
$client = new-object System.Net.WebClient
$client.DownloadFile($nugetZipUrl, $outFilePath)
# It's possible for restore to run in parallel on the test machines. As such
# we need to restore only new files to handle simultaneous restore scenarios.
write-host "Extracting"
Add-Type -assembly "System.IO.Compression.Filesystem"
$archive = [IO.Compression.ZipFile]::OpenRead($outFilePath)
foreach ($entry in $archive.Entries) {
$entryFilePath = join-path $destination $entry.FullName
if (test-path $entryFilePath) {
continue;
}
# If it's a directory then create it now. Calling ExtractToFile will
# throw on a directory. There is no way I can find to ask a
# ZipArchiveEntry if it is a directory hence we just check for a file
# extension
[string]$ext = [IO.Path]::GetExtension($entryFilePath)
if ($ext -eq "") {
$null = mkdir $entryFilePath -errorAction SilentlyContinue
continue;
}
$entryDirectory = split-path -parent $entryFilePath
if (-not (test-path $entryDirectory)) {
$null = mkdir $entryDirectory -errorAction SilentlyContinue
}
try {
write-host "Restoring $entryFilePath"
[IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entryFilePath)
} catch {
write-host "Unable to restore $($entry.FullName) $Error"
}
}
......@@ -2,8 +2,11 @@
REM Parse Arguments.
set NugetZipUrlRoot=https://dotnetci.blob.core.windows.net/roslyn
set NugetZipUrl=%NuGetZipUrlRoot%/nuget.24.zip
set RoslynRoot=%~dp0
set BuildConfiguration=Debug
set BuildRestore=false
:ParseArguments
if "%1" == "" goto :DoneParsing
if /I "%1" == "/?" call :Usage && exit /b 1
......@@ -11,19 +14,27 @@ if /I "%1" == "/debug" set BuildConfiguration=Debug&&shift&& goto :ParseArgument
if /I "%1" == "/release" set BuildConfiguration=Release&&shift&& goto :ParseArguments
if /I "%1" == "/test32" set Test64=false&&shift&& goto :ParseArguments
if /I "%1" == "/test64" set Test64=true&&shift&& goto :ParseArguments
if /I "%1" == "/restore" set BuildRestore=true&&shift&& goto :ParseArguments
call :Usage && exit /b 1
:DoneParsing
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"
REM Build the compiler so we can self host it for the full build
nuget.exe restore -nocache -verbosity quiet %RoslynRoot%build/ToolsetPackages/project.json
nuget.exe restore -nocache -verbosity quiet %RoslynRoot%build/Toolset.sln
REM Restore the NuGet packages
if "%BuildRestore%" == "true" (
nuget.exe restore -nocache -verbosity quiet %RoslynRoot%build/ToolsetPackages/project.json
nuget.exe restore -nocache -verbosity quiet %RoslynRoot%build/Toolset.sln
nuget.exe restore -nocache %RoslynRoot%build\ToolsetPackages\project.json
nuget.exe restore -nocache %RoslynRoot%Roslyn.sln
nuget.exe restore -nocache %RoslynRoot%src\Samples\Samples.sln
) else (
powershell -noprofile -executionPolicy RemoteSigned -command "%RoslynRoot%\build\scripts\restore.ps1 %NugetZipUrl%"
)
REM Set the build version only so the assembly version is set to the semantic version,
REM which allows analyzers to laod because the compiler has binding redirects to the
REM semantic version
msbuild /nologo /v:m /m /p:BuildVersion=0.0.0.0 %RoslynRoot%build/Toolset.sln /p:Configuration=%BuildConfiguration%
msbuild /nologo /v:m /m /p:BuildVersion=0.0.0.0 %RoslynRoot%build/Toolset.sln /p:NuGetRestorePackages=false /p:Configuration=%BuildConfiguration%
mkdir %RoslynRoot%Binaries\Bootstrap
move Binaries\%BuildConfiguration%\* %RoslynRoot%Binaries\Bootstrap
......@@ -33,10 +44,6 @@ REM Clean the previous build
msbuild /v:m /t:Clean build/Toolset.sln /p:Configuration=%BuildConfiguration%
taskkill /F /IM vbcscompiler.exe
nuget.exe restore -nocache %RoslynRoot%build\ToolsetPackages\project.json
nuget.exe restore -nocache %RoslynRoot%Roslyn.sln
nuget.exe restore -nocache %RoslynRoot%src\Samples\Samples.sln
msbuild /v:m /m /p:BootstrapBuildPath=%RoslynRoot%Binaries\Bootstrap BuildAndTest.proj /p:Configuration=%BuildConfiguration% /p:Test64=%Test64%
if ERRORLEVEL 1 (
taskkill /F /IM vbcscompiler.exe
......@@ -48,16 +55,6 @@ REM Kill any instances of VBCSCompiler.exe to release locked files;
REM otherwise future CI runs may fail while trying to delete those files.
taskkill /F /IM vbcscompiler.exe
REM Verify that our project.lock.json files didn't change as a result of
REM restore. If they do then the commit changed the dependencies without
REM updating the lock files.
REM git diff --exit-code --quiet
REM if ERRORLEVEL 1 (
REM echo Commit changed dependencies without updating project.lock.json
REM git diff --exit-code
REM exit /b 1
REM )
REM It is okay and expected for taskkill to fail (it's a cleanup routine). Ensure
REM caller sees successful exit.
exit /b 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册