Skip to content

Commit 1897310

Browse files
committed
Build Roslyn targeting net5.0
1 parent 2577b93 commit 1897310

8 files changed

+1974
-0
lines changed

patches/roslyn/0012-Build-Roslyn-as-net5.0-in-source-build.patch

Lines changed: 236 additions & 0 deletions
Large diffs are not rendered by default.

patches/roslyn/0013-Rename-IReadOnlySet-IRoslynReadOnlySet.patch

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
From 44ead158f2e5b0410f600baaa7286ea5bd7545ae Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <[email protected]>
3+
Date: Tue, 29 Dec 2020 00:39:00 -0600
4+
Subject: [PATCH 3/5] Fix new CS0618 showing up with net5.0
5+
6+
---
7+
Directory.Build.props | 2 +-
8+
src/Compilers/Core/MSBuildTask/Utilities.cs | 14 ++++++++------
9+
2 files changed, 9 insertions(+), 7 deletions(-)
10+
11+
diff --git a/Directory.Build.props b/Directory.Build.props
12+
index aaa1d5b9fe5..e468e163eb6 100644
13+
--- a/Directory.Build.props
14+
+++ b/Directory.Build.props
15+
@@ -4,7 +4,7 @@
16+
<Import Project="eng\targets\Settings.props" />
17+
18+
<PropertyGroup>
19+
- <WarningsNotAsErrors>$(WarningsNotAsErrors);CS0618;CS8600;CS8602;CS8603;CS8604;CS8777</WarningsNotAsErrors>
20+
+ <WarningsNotAsErrors>$(WarningsNotAsErrors);CS8600;CS8602;CS8603;CS8604;CS8605;CS8777</WarningsNotAsErrors>
21+
</PropertyGroup>
22+
23+
</Project>
24+
diff --git a/src/Compilers/Core/MSBuildTask/Utilities.cs b/src/Compilers/Core/MSBuildTask/Utilities.cs
25+
index 74da0c2bdd3..b6af0715406 100644
26+
--- a/src/Compilers/Core/MSBuildTask/Utilities.cs
27+
+++ b/src/Compilers/Core/MSBuildTask/Utilities.cs
28+
@@ -154,12 +154,14 @@ internal static void DeleteNoThrow(string path)
29+
30+
internal static string? TryGetAssemblyPath(Assembly assembly)
31+
{
32+
- if (assembly.GlobalAssemblyCache)
33+
- {
34+
- return null;
35+
- }
36+
-
37+
- if (assembly.CodeBase is { } codebase)
38+
+ // Removed: error CS0618: 'Assembly.GlobalAssemblyCache' is obsolete: 'The Global Assembly Cache is not supported.'
39+
+ // if (assembly.GlobalAssemblyCache)
40+
+ // {
41+
+ // return null;
42+
+ // }
43+
+
44+
+ // error CS0618: 'Assembly.CodeBase' is obsolete: 'Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead.'
45+
+ if (assembly.Location is { } codebase)
46+
{
47+
var uri = new Uri(codebase);
48+
return uri.IsFile ? uri.LocalPath : assembly.Location;
49+
--
50+
2.25.4
51+

patches/roslyn/0015-Add-__Roslyn-to-ReferenceEqualityComparer.patch

Lines changed: 1263 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From a388034e96c856d09209e899bfba66d08c9c6274 Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <[email protected]>
3+
Date: Tue, 29 Dec 2020 00:53:32 -0600
4+
Subject: [PATCH 5/5] Remove S.Runtime.InteropServices.WindowsRuntime
5+
6+
Doesn't exist and doesn't seem necessary in net5.0.
7+
---
8+
src/Compilers/Server/VBCSCompiler/ClientConnectionHandler.cs | 1 -
9+
1 file changed, 1 deletion(-)
10+
11+
diff --git a/src/Compilers/Server/VBCSCompiler/ClientConnectionHandler.cs b/src/Compilers/Server/VBCSCompiler/ClientConnectionHandler.cs
12+
index 6bda91e310b..ce7b044b208 100644
13+
--- a/src/Compilers/Server/VBCSCompiler/ClientConnectionHandler.cs
14+
+++ b/src/Compilers/Server/VBCSCompiler/ClientConnectionHandler.cs
15+
@@ -8,7 +8,6 @@
16+
using System.IO;
17+
using System.IO.Pipes;
18+
using System.Net.Sockets;
19+
-using System.Runtime.InteropServices.WindowsRuntime;
20+
using System.Text;
21+
using System.Threading;
22+
using System.Threading.Tasks;
23+
--
24+
2.25.4
25+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From dbb2cbb458f0b8d2fcf4af0c3dbb6628e62ea661 Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <[email protected]>
3+
Date: Tue, 29 Dec 2020 01:20:44 -0600
4+
Subject: [PATCH] Set compilers package targetframework to net5.0
5+
6+
---
7+
.../Microsoft.NETCore.Compilers.Package.csproj | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/src/NuGet/Microsoft.NETCore.Compilers/Microsoft.NETCore.Compilers.Package.csproj b/src/NuGet/Microsoft.NETCore.Compilers/Microsoft.NETCore.Compilers.Package.csproj
11+
index dcb5df09f24..0f3093bdc54 100644
12+
--- a/src/NuGet/Microsoft.NETCore.Compilers/Microsoft.NETCore.Compilers.Package.csproj
13+
+++ b/src/NuGet/Microsoft.NETCore.Compilers/Microsoft.NETCore.Compilers.Package.csproj
14+
@@ -1,7 +1,7 @@
15+
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
16+
<Project Sdk="Microsoft.NET.Sdk">
17+
<PropertyGroup>
18+
- <TargetFramework>netcoreapp3.1</TargetFramework>
19+
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
20+
21+
<IsPackable>true</IsPackable>
22+
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
23+
--
24+
2.25.4
25+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 86de24831b17b378c8f7aa5713b93c80300fcd16 Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <[email protected]>
3+
Date: Tue, 29 Dec 2020 01:34:45 -0600
4+
Subject: [PATCH] Update _RoslynTargetDirectoryName for net5.0
5+
6+
---
7+
.../build/Microsoft.Net.Compilers.Toolset.props | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/src/NuGet/Microsoft.Net.Compilers.Toolset/build/Microsoft.Net.Compilers.Toolset.props b/src/NuGet/Microsoft.Net.Compilers.Toolset/build/Microsoft.Net.Compilers.Toolset.props
11+
index 157388e0be7..aac3dcdee92 100644
12+
--- a/src/NuGet/Microsoft.Net.Compilers.Toolset/build/Microsoft.Net.Compilers.Toolset.props
13+
+++ b/src/NuGet/Microsoft.Net.Compilers.Toolset/build/Microsoft.Net.Compilers.Toolset.props
14+
@@ -2,7 +2,7 @@
15+
<Project>
16+
17+
<PropertyGroup>
18+
- <_RoslynTargetDirectoryName Condition="'$(MSBuildRuntimeType)' == 'Core'">netcoreapp3.1</_RoslynTargetDirectoryName>
19+
+ <_RoslynTargetDirectoryName Condition="'$(MSBuildRuntimeType)' == 'Core'">net5.0</_RoslynTargetDirectoryName>
20+
<_RoslynTargetDirectoryName Condition="'$(MSBuildRuntimeType)' != 'Core'">net472</_RoslynTargetDirectoryName>
21+
<_RoslynTasksDirectory>$(MSBuildThisFileDirectory)..\tasks\$(_RoslynTargetDirectoryName)\</_RoslynTasksDirectory>
22+
<RoslynTasksAssembly>$(_RoslynTasksDirectory)Microsoft.Build.Tasks.CodeAnalysis.dll</RoslynTasksAssembly>
23+
--
24+
2.25.4
25+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 96bc47bb4e052a986672efb2108c4f1804b8f1cb Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <[email protected]>
3+
Date: Tue, 29 Dec 2020 02:19:14 -0600
4+
Subject: [PATCH] Update to use net5.0 Roslyn
5+
6+
---
7+
src/Layout/redist/targets/GenerateLayout.targets | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets
11+
index 5b26387c1..48b0303b1 100644
12+
--- a/src/Layout/redist/targets/GenerateLayout.targets
13+
+++ b/src/Layout/redist/targets/GenerateLayout.targets
14+
@@ -20,7 +20,7 @@
15+
<RoslynDirectory>$(OutputPath)/Roslyn</RoslynDirectory>
16+
</PropertyGroup>
17+
<ItemGroup>
18+
- <RoslynBits Include="$(NuGetPackageRoot)/microsoft.net.compilers.toolset/$(MicrosoftNetCompilersToolsetPackageVersion)/tasks/netcoreapp3.1/**/*" />
19+
+ <RoslynBits Include="$(NuGetPackageRoot)/microsoft.net.compilers.toolset/$(MicrosoftNetCompilersToolsetPackageVersion)/tasks/net5.0/**/*" />
20+
</ItemGroup>
21+
<Error Condition="'@(RoslynBits)' == ''" Text="Something moved around in Roslyn package, adjust code here accordingly. TFM change?" />
22+
<Copy SourceFiles="@(RoslynBits)" DestinationFiles="@(RoslynBits->'$(RoslynDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
23+
--
24+
2.25.4
25+

0 commit comments

Comments
 (0)