Merge pull request #12455 from crummel/updateRoslynPatches

Update to Roslyn version of patch.
This commit is contained in:
Michael Simons 2021-10-19 22:14:19 -05:00 committed by GitHub
commit a6871de837
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 92 deletions

View file

@ -0,0 +1,33 @@
From 1a415d2019d74bcf009134326d1c25798589de64 Mon Sep 17 00:00:00 2001
From: Chris Rummel <crummel@microsoft.com>
Date: Tue, 19 Oct 2021 11:39:32 -0500
Subject: [PATCH] Apply arcade-powered source-build patches (#55823)
Don't include desktop artifacts that don't exist in source-build.
Source-build doesn't have these artifacts available, even when we eventually will
build desktop TFMs, because Roslyn is one of the first builds in source-build.
Instead Roslyn is picking up reference packages that don't have the `lib` directory
which is causing a build failure. This disables the attempt to grab these desktop
artifacts so source-build just skips them instead.
Backported to roslyn with https://github.com/dotnet/roslyn/pull/55823
---
.../DesktopCompilerArtifacts.targets | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets b/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets
index c8b87ab6958..107ff051b51 100644
--- a/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets
+++ b/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets
@@ -20,7 +20,7 @@
VS training data to the assemblies they produce.
-->
- <Target Name="InitializeDesktopCompilerArtifacts">
+ <Target Name="InitializeDesktopCompilerArtifacts" Condition="'$(DotNetBuildFromSource)' != 'true'">
<ItemGroup>
<!-- The Roslyn built binaries must be taken from these locations because this is the location where signing occurs -->
--
2.31.1

View file

@ -1,27 +0,0 @@
From eb67cc234b0073d8b210c3ae42b5efe481bd0900 Mon Sep 17 00:00:00 2001
From: Chris Rummel <crummel@microsoft.com>
Date: Tue, 20 Jul 2021 09:41:52 -0500
Subject: [PATCH 1/2] Patch out version check for source-build scenarios.
The immediate cause for removing this was that NuGet is not yet built at this point in the source-build process. Roslyn tries to use a reference package to run this task but fails (the usual "reference packages cannot be used at runtime" error). Additionally, this is not really a valid check in source-build - we give each repo the SDK and MSBuild that we expect it to use, and want to override its opinions about what it should be using.
---
eng/targets/Imports.targets | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/targets/Imports.targets b/eng/targets/Imports.targets
index 15b067deb04..303b10c40cd 100644
--- a/eng/targets/Imports.targets
+++ b/eng/targets/Imports.targets
@@ -159,7 +159,7 @@
<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.CompareVersions" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.SingleError" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
- <Target Name="_CheckRequiredMSBuildVersion" BeforeTargets="BeforeBuild">
+ <Target Name="_CheckRequiredMSBuildVersion" BeforeTargets="BeforeBuild" Condition="'$(DotNetBuildFromSource)' != 'true'">
<CompareVersions Left="$(MSBuildVersion)" Right="$(MinimumMSBuildVersion)">
<Output TaskParameter="Result" PropertyName="_VersionComparisonResult"/>
</CompareVersions>
--
2.18.0

View file

@ -1,65 +0,0 @@
From a235579b23a9aaf3f30202a69e92b93f7c569107 Mon Sep 17 00:00:00 2001
From: Chris Rummel <crummel@microsoft.com>
Date: Tue, 20 Jul 2021 14:20:14 -0500
Subject: [PATCH 2/2] Don't include desktop artifacts that don't exist in
source-build.
This fixes a bad intersection of a couple of things going on in the source-build Roslyn build.
- Roslyn.Extensions project that builds before this normally will restore a net46 version of System.Numerics.Vectors, but it sets it to CopyLocal and is building for net472, so this net46 DLL is output to the net472 folder.
- We don't build Roslyn.Extensions for net472 for other reasons, so we are missing this DLL but not the output from that project (we just get the .NET Core folders).
- DesktopCompilerArtifacts tries to specifically call out the System.Numerics.Vectors (and some other) DLLs because they are treated differently (NGEN is not supported for them).
- So the missing DLL, instead of just being ignored because of a wildcard, comes up as error trying to build these packages.
- We want full-framework Roslyn artifacts downstream but we don't ever run the fullfx Roslyn compiler, so we need these packages but not the CopyLocal fullfx DLLs.
So we keep the net472 build for these but remove the specifically-called out artifacts that we don't need.
---
.../Microsoft.Net.Compilers.Toolset.Package.csproj | 4 ++--
.../Microsoft.Net.Compilers.Package.csproj | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj b/src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj
index 9e646ebab5b..7b598978fd1 100644
--- a/src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj
+++ b/src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj
@@ -23,7 +23,7 @@
<!-- Remove NU5128 once https://github.com/NuGet/Home/issues/8583 is fixed -->
<NoWarn>$(NoWarn);NU5100;NU5128</NoWarn>
- <_DependsOn Condition="'$(TargetFramework)' == 'net472'">InitializeDesktopCompilerArtifacts</_DependsOn>
+ <_DependsOn Condition="'$(TargetFramework)' == 'net472' and '$(DotNetBuildFromSource)' != 'true'">InitializeDesktopCompilerArtifacts</_DependsOn>
<_DependsOn Condition="'$(TargetFramework)' == 'netcoreapp3.1'">InitializeCoreClrCompilerArtifacts</_DependsOn>
</PropertyGroup>
@@ -57,6 +57,6 @@
</ItemGroup>
</Target>
- <Import Project="DesktopCompilerArtifacts.targets" Condition="'$(TargetFramework)' == 'net472'" />
+ <Import Project="DesktopCompilerArtifacts.targets" Condition="'$(TargetFramework)' == 'net472' and '$(DotNetBuildFromSource)' != 'true'" />
<Import Project="CoreClrCompilerArtifacts.targets" Condition="'$(TargetFramework)' == 'netcoreapp3.1'" />
</Project>
diff --git a/src/NuGet/Microsoft.Net.Compilers/Microsoft.Net.Compilers.Package.csproj b/src/NuGet/Microsoft.Net.Compilers/Microsoft.Net.Compilers.Package.csproj
index 05f74e26ce6..c33e557c249 100644
--- a/src/NuGet/Microsoft.Net.Compilers/Microsoft.Net.Compilers.Package.csproj
+++ b/src/NuGet/Microsoft.Net.Compilers/Microsoft.Net.Compilers.Package.csproj
@@ -31,13 +31,13 @@
<Target Name="_GetFilesToPackage" DependsOnTargets="InitializeDesktopCompilerArtifacts">
<ItemGroup>
- <_File Include="@(DesktopCompilerArtifact)" TargetDir="tools"/>
- <_File Include="@(DesktopCompilerResourceArtifact)" TargetDir="tools"/>
+ <_File Include="@(DesktopCompilerArtifact)" TargetDir="tools" Condition="'$(DotNetBuildFromSource)' != 'true'" />
+ <_File Include="@(DesktopCompilerResourceArtifact)" TargetDir="tools" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<_File Include="$(MSBuildProjectDirectory)\build\**\*.*" TargetDir="build" />
<TfmSpecificPackageFile Include="@(_File)" PackagePath="%(_File.TargetDir)/%(_File.RecursiveDir)%(_File.FileName)%(_File.Extension)" />
</ItemGroup>
</Target>
- <Import Project="..\Microsoft.Net.Compilers.Toolset\DesktopCompilerArtifacts.targets"/>
+ <Import Project="..\Microsoft.Net.Compilers.Toolset\DesktopCompilerArtifacts.targets" />
</Project>
--
2.18.0