Skip to content

Commit

Permalink
TLDR: artifacts are going to move around in Binaries\Debug and the di…
Browse files Browse the repository at this point in the history
…rectory is going to get a lot bigger.

At a high level build projects can be classified into three categories based on how they write output:

- incorrect: a given output path is written to more than once with different contents
- less correct: a given output path is written to more than once but always with the same content
- correct: a given output path is written to exactly once

Today the roslyn build is decidedly “incorrect” as pretty much every file is written directly into Binaries\Debug. This means it ends up writing pretty much every Visual Studio SDK DLL twice: once for Dev14 and once for Dev15. For example at various points in the build Binaries\Debug\Microsoft.VisualStudio.Text.Data.dll may refer to Dev14 and at others it’s Dev15. If this seems like a scary proposition for a build that’s because it is indeed scary and it has real consequences. By now pretty much everyone on the team has hit the build race condition that is dragging down our PRs.

The general fix here is to move build outputs into separate directories. Instead of building to $(Configuration) projects now build into say $(Configuration)\Exes\$(MSBuildProjectFileName). This will have a substantial increase in the size of Binaries. We will be looking into ways to reduce that. In the short term though build stability far outweighs the size increase.

This change takes us most of the way to "correct". There are several places I had to compromise in order to get this initial change in:

- UnitTests still build to a common output folder (one for Dev14, another for Dev15). Pulling unit tests apart is going to take a bit of work.
- Every project has a <RoslynProjectType> entry. This will go away in the future for most projects. It's temporarily needed so I can fix roslyn-internal in parallel without taking down the build.
- VSL.Imports.targets is messy. Unavoidable for now due to the above. It will get cleaner as I iterate on this.

None of these are relevant to the underlying race condition. Hence it's okay to push them off.
  • Loading branch information
jaredpar committed Oct 22, 2016
1 parent e5ebda7 commit b9ba3e9
Show file tree
Hide file tree
Showing 226 changed files with 960 additions and 843 deletions.
15 changes: 4 additions & 11 deletions BuildAndTest.proj
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,19 @@

<!-- MakeConst unit tests tracked by https://github.com/dotnet/roslyn/issues/5918 -->
<TestAssemblies Condition="'$(Test64)' != 'true'"
Include="$(OutputDirectory)\$(IncludePattern);$(OutputDirectory)\Dev15Tests\$(IncludePattern)" />
Include="$(OutputDirectory)\UnitTests*\**\$(IncludePattern);" />

<TestAssemblies Condition="'$(Test64)' == 'true'"
Include="$(OutputDirectory)\$(IncludePattern);$(OutputDirectory)\Dev15Tests\$(IncludePattern)"
Exclude="$(OutputDirectory)\Roslyn.Interactive*" />
Include="$(OutputDirectory)\UnitTests*\**\$(IncludePattern);"
Exclude="$(OutputDirectory)\UnitTests*\**\Roslyn.Interactive*" />

<CoreTestAssemblies Include="$(CoreClrTestDirectory)\$(IncludePattern)" />

<MisplacedTestAssemblies Include="$(OutputDirectory)\**\$(IncludePattern)"
Exclude="$(OutputDirectory)\$(IncludePattern);$(OutputDirectory)\Dev15Tests\$(IncludePattern);@(CoreTestAssemblies)" />
</ItemGroup>

<Error Condition="'@(MisplacedTestAssemblies->Count())' &gt; 0"
Text="Found test assemblies outside a well-known test directory:
@(MisplacedTestAssemblies, '%0a')" />

<PropertyGroup>
<CoreRunExe>$(CoreClrTestDirectory)\CoreRun.exe</CoreRunExe>
<CoreRunArgs>$(CoreClrTestDirectory)\xunit.console.netcore.exe @(CoreTestAssemblies, ' ') -parallel all -xml $(CoreClrTestDirectory)\xUnitResults\TestResults.xml</CoreRunArgs>
<RunTestsExe>Binaries\$(Configuration)\RunTests\RunTests.exe</RunTestsExe>
<RunTestsExe>Binaries\$(Configuration)\Tools\RunTests\RunTests.exe</RunTestsExe>
<RunTestsArgs>$(NuGetPackageRoot)\xunit.runner.console\$(xunitrunnerconsoleVersion)\tools $(RunTestArgs) @(TestAssemblies, ' ')</RunTestsArgs>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ bootstrap: $(ROSLYN_TOOLSET_PATH) $(RESTORE_SEMAPHORE_PATH)
$(MSBUILD_CMD) src/Compilers/CSharp/CscCore/CscCore.csproj && \
$(MSBUILD_CMD) src/Compilers/VisualBasic/VbcCore/VbcCore.csproj && \
mkdir -p $(BOOTSTRAP_PATH) && \
cp -f Binaries/$(BUILD_CONFIGURATION)/csccore/* $(BOOTSTRAP_PATH) && \
cp -f Binaries/$(BUILD_CONFIGURATION)/vbccore/* $(BOOTSTRAP_PATH) && \
cp -f Binaries/$(BUILD_CONFIGURATION)/Exes/CscCore/* $(BOOTSTRAP_PATH) && \
cp -f Binaries/$(BUILD_CONFIGURATION)/Exes/VbcCore/* $(BOOTSTRAP_PATH) && \
build/scripts/crossgen.sh $(BOOTSTRAP_PATH) && \
rm -rf Binaries/$(BUILD_CONFIGURATION)

Expand Down
4 changes: 3 additions & 1 deletion Restore.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ call "%NugetExe%" restore "%RoslynRoot%src\Samples\Samples.sln" %NuGetAdditional
echo Restoring packages: Templates
call "%NugetExe%" restore "%RoslynRoot%src\Setup\Templates\Templates.sln" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

echo Restoring packages: Toolset
call "%NugetExe%" restore "%RoslynRoot%build\Toolset\Toolset.csproj" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

echo Restoring packages: Roslyn (this may take some time)
call "%NugetExe%" restore "%RoslynRoot%build\Toolset.sln" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed
call "%NugetExe%" restore "%RoslynSolution%" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

echo Restoring packages: DevDiv tools
Expand Down
68 changes: 28 additions & 40 deletions Roslyn.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2658,26 +2658,20 @@ Global
{1553DE60-A2B0-4FAF-B1B8-C0A7313781CC}.Release|x64.Build.0 = Release|Any CPU
{1553DE60-A2B0-4FAF-B1B8-C0A7313781CC}.Release|x86.ActiveCfg = Release|Any CPU
{1553DE60-A2B0-4FAF-B1B8-C0A7313781CC}.Release|x86.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|ARM.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x86.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x86.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Any CPU.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|ARM.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|ARM.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x86.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x86.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Any CPU.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|ARM.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.Build.0 = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.Build.0 = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x86.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Any CPU.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|ARM.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.Build.0 = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.Build.0 = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x86.ActiveCfg = Release|x64
{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|ARM.ActiveCfg = Debug|Any CPU
Expand All @@ -2698,26 +2692,20 @@ Global
{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|x64.Build.0 = Release|Any CPU
{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|x86.ActiveCfg = Release|Any CPU
{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|x86.Build.0 = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|ARM.ActiveCfg = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|ARM.Build.0 = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x64.ActiveCfg = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x64.Build.0 = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x86.ActiveCfg = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x86.Build.0 = Debug|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.Build.0 = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|ARM.ActiveCfg = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|ARM.Build.0 = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x64.ActiveCfg = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x64.Build.0 = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x86.ActiveCfg = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x86.Build.0 = Release|Any CPU
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.ActiveCfg = Debug|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|ARM.ActiveCfg = Debug|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Mixed Platforms.Build.0 = Debug|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x64.ActiveCfg = Debug|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x86.ActiveCfg = Debug|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x86.Build.0 = Debug|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.ActiveCfg = Release|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|ARM.ActiveCfg = Release|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Mixed Platforms.ActiveCfg = Release|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Mixed Platforms.Build.0 = Release|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x64.ActiveCfg = Release|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x86.ActiveCfg = Release|x86
{E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x86.Build.0 = Release|x86
{3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|ARM.ActiveCfg = Debug|Any CPU
Expand Down
94 changes: 91 additions & 3 deletions build/Targets/VSL.Imports.targets
Original file line number Diff line number Diff line change
@@ -1,17 +1,104 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->

<!-- If the project hasn't configured a ruleset, set a default ruleset. -->
<Choose>
<When Condition="'$(RoslynProjectType)' == 'Dll'">
<PropertyGroup>
<_CopyReferences>false</_CopyReferences>
<_CopyProjectReferences>false</_CopyProjectReferences>
<OutDir>$(OutDir)Dlls\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'ExeDesktop'">
<PropertyGroup>
<OutDir>$(OutDir)Exes\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'ExeCoreClr'">
<PropertyGroup>
<_CopyReferences>false</_CopyReferences>
<OutDir>$(OutDir)Exes\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'ToolDesktop'">
<PropertyGroup>
<OutDir>$(OutDir)Tools\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'UnitTest'">
<PropertyGroup>
<OutDir>$(OutDir)UnitTests\Current\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'UnitTestNext'">
<PropertyGroup>
<_CopyReferences>false</_CopyReferences>
<OutDir>$(OutDir)UnitTests\Next\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'CompilerGeneratorTool'">
<PropertyGroup>
<_CopyReferences>false</_CopyReferences>
<OutDir>$(OutDir)Exes\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'DeploymentCompilergeneratorTools'">
<PropertyGroup>
<OutDir>$(OutDir)CompilerGeneratorTools\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'Deployment'">
<PropertyGroup>
<OutDir>$(OutDir)Deployment\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'Vsix'">
<PropertyGroup>
<_CopyReferences>false</_CopyReferences>
<OutDir>$(OutDir)Vsix\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'Ignore'">
<!-- Thinking through these -->
<PropertyGroup>
<_CopyReferences>false</_CopyReferences>
<_CopyProjectReferences>false</_CopyProjectReferences>
<OutDir>$(OutDir)Ignore\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'Dependency'">
<!-- Thinking through these -->
<PropertyGroup>
<OutDir>$(OutDir)Ignore\$(MSBuildProjectName)\</OutDir>
</PropertyGroup>
</When>
<When Condition="'$(RoslynProjectType)' == 'Custom'">
<!-- Do nothing -->
</When>
</Choose>

<ItemDefinitionGroup Condition="'$(_CopyReferences)' == 'false'">
<Reference>
<Private>False</Private>
</Reference>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(_CopyProjectReferences)' == 'false'">
<ProjectReference>
<Private>False</Private>
</ProjectReference>
</ItemDefinitionGroup>

<!-- This file is imported by all projects at the end of the project files -->
<!-- Update common properties -->
<PropertyGroup>
<OutputPath>$(OutDir)</OutputPath>
<DocumentationFile Condition="'$(DocumentationFile)' == '' AND '$(NoDocumentationFile)' != 'true' AND '$(Nonshipping)' != 'true' AND '$(ProjectLanguage)' == 'VB' AND '$(AssemblyName)' != ''">$(AssemblyName).xml</DocumentationFile>
<DocumentationFile Condition="'$(DocumentationFile)' == '' AND '$(NoDocumentationFile)' != 'true' AND '$(Nonshipping)' != 'true' AND '$(ProjectLanguage)' == 'CSharp' AND '$(AssemblyName)' != ''">$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<DocumentationFile Condition="'$(DocumentationFile)' == '' AND '$(NoDocumentationFile)' != 'true' AND '$(Nonshipping)' != 'true' AND '$(ProjectLanguage)' == 'CSharp' AND '$(AssemblyName)' != ''">$(BaseIntermediateOutputPath)$(AssemblyName).xml</DocumentationFile>
<RoslynPublicKey>0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9</RoslynPublicKey>
<RoslynInternalKey>002400000480000094000000060200000024000052534131000400000100010055e0217eb635f69281051f9a823e0c7edd90f28063eb6c7a742a19b4f6139778ee0af438f47aed3b6e9f99838aa8dba689c7a71ddb860c96d923830b57bbd5cd6119406ddb9b002cf1c723bf272d6acbb7129e9d6dd5a5309c94e0ff4b2c884d45a55f475cd7dba59198086f61f5a8c8b5e601c0edbf269733f6f578fc8579c2</RoslynInternalKey>
</PropertyGroup>

<PropertyGroup>
<!-- While UseCommonOutputDirectory will prevent NuGet implementations from being copied,
we still need to turn off CopyNuGetImplementations to prevent the build task from complaining about a
lack of a runtime section in our project.json. -->
Expand Down Expand Up @@ -387,6 +474,7 @@
==================================================================================== -->



<PropertyGroup>
<ProducingSignedVsix Condition="'$(ShouldSignBuild)' == 'true' AND '$(NonShipping)' != 'true' AND '$(CreateVsixContainer)' == 'true'">true</ProducingSignedVsix>
Expand Down
Loading

0 comments on commit b9ba3e9

Please sign in to comment.