source-build changes to support release/6.0.2xx (#12750)

* Update dotnet version used by source-build

* Additional source-build patches

* Bring in msbuild patch for committed changes that haven't flown
This commit is contained in:
Michael Simons 2021-12-06 17:17:53 -06:00 committed by GitHub
parent 9df348884d
commit b6a61fcd0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 100 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "6.0.100"
"dotnet": "6.0.200-preview.21603.2"
},
"msbuild-sdks": {
"Microsoft.Build.CentralPackageVersions": "2.0.1",

View file

@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MichaelSimons <msimons@microsoft.com>
Date: Mon, 6 Dec 2021 18:39:25 +0000
Subject: [PATCH] WebHost delegate nullability
Addresses the following errors:
src/Hosting/Hosting/src/Internal/WebHost.cs(83,56): error CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<IServiceProvider, IHostApplicationLifetime?>' (possibly because of nullability attributes).
src/Hosting/Hosting/src/Internal/WebHost.cs(86,56): error CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<IServiceProvider, IApplicationLifetime?>' (possibly because of nullability attributes).
src/Hosting/Hosting/src/Internal/WebHost.cs(88,56): error CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<IServiceProvider, IApplicationLifetime?>' (possibly because of nullability attributes).
Cherry-pick of WebHost only changes made under https://github.com/dotnet/aspnetcore/commit/13a460820e90c8f3e90eb4fdbbb3de671389bf0c#diff-6ef451f2ae3e04d73dde362bdf9de6b101aef95e3a4f5190e5c96967d683aef9
---
src/Hosting/Hosting/src/Internal/WebHost.cs | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/Hosting/Hosting/src/Internal/WebHost.cs b/src/Hosting/Hosting/src/Internal/WebHost.cs
index ca52bd1f40..643d03e8af 100644
--- a/src/Hosting/Hosting/src/Internal/WebHost.cs
+++ b/src/Hosting/Hosting/src/Internal/WebHost.cs
@@ -79,16 +79,14 @@ namespace Microsoft.AspNetCore.Hosting
_hostingServiceProvider = hostingServiceProvider;
_applicationServiceCollection.AddSingleton<ApplicationLifetime>();
// There's no way to to register multiple service types per definition. See https://github.com/aspnet/DependencyInjection/issues/360
-#pragma warning disable CS8634 // The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'class' constraint.
- _applicationServiceCollection.AddSingleton(services
- => services.GetService<ApplicationLifetime>() as IHostApplicationLifetime);
+ _applicationServiceCollection.AddSingleton<IHostApplicationLifetime>(services
+ => services.GetService<ApplicationLifetime>()!);
#pragma warning disable CS0618 // Type or member is obsolete
- _applicationServiceCollection.AddSingleton(services
- => services.GetService<ApplicationLifetime>() as AspNetCore.Hosting.IApplicationLifetime);
- _applicationServiceCollection.AddSingleton(services
- => services.GetService<ApplicationLifetime>() as Extensions.Hosting.IApplicationLifetime);
+ _applicationServiceCollection.AddSingleton<AspNetCore.Hosting.IApplicationLifetime>(services
+ => services.GetService<ApplicationLifetime>()!);
+ _applicationServiceCollection.AddSingleton<Extensions.Hosting.IApplicationLifetime>(services
+ => services.GetService<ApplicationLifetime>()!);
#pragma warning restore CS0618 // Type or member is obsolete
-#pragma warning restore CS8634 // The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'class' constraint.
_applicationServiceCollection.AddSingleton<HostedServiceExecutor>();
}

View file

@ -7,13 +7,29 @@ Removes prebuilts.
Background Issue: https://github.com/dotnet/source-build/issues/2542
---
eng/dependabot/Packages.props | 3 ---
src/Build/Microsoft.Build.csproj | 4 +++-
src/Directory.BeforeCommon.targets | 2 +-
src/Framework/Microsoft.Build.Framework.csproj | 2 +-
src/Samples/Directory.Build.props | 1 +
src/Tasks/Microsoft.Build.Tasks.csproj | 4 +++-
src/Utilities/Microsoft.Build.Utilities.csproj | 2 +-
5 files changed, 9 insertions(+), 4 deletions(-)
7 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/eng/dependabot/Packages.props b/eng/dependabot/Packages.props
index a1f21de26..ff74d6e7f 100644
--- a/eng/dependabot/Packages.props
+++ b/eng/dependabot/Packages.props
@@ -22,9 +22,6 @@
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
<GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.2" />
- </ItemGroup>
-
- <ItemGroup>
<GlobalPackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.15" PrivateAssets="All" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
</ItemGroup>
diff --git a/src/Build/Microsoft.Build.csproj b/src/Build/Microsoft.Build.csproj
index d08e337c5..3b173aee5 100644
--- a/src/Build/Microsoft.Build.csproj
@ -43,6 +59,19 @@ index 913c97b12..320bffa56 100644
<DefineConstants>$(DefineConstants);FEATURE_MSCOREE</DefineConstants>
</PropertyGroup>
diff --git a/src/Framework/Microsoft.Build.Framework.csproj b/src/Framework/Microsoft.Build.Framework.csproj
index df7556447..c7edff611 100644
--- a/src/Framework/Microsoft.Build.Framework.csproj
+++ b/src/Framework/Microsoft.Build.Framework.csproj
@@ -31,7 +31,7 @@
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<!-- Promote CompilerServices.Unsafe from the old version we get from System.Memory on net472. -->
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
- <PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" />
+ <PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<Reference Include="System.Xaml" />
</ItemGroup>
diff --git a/src/Samples/Directory.Build.props b/src/Samples/Directory.Build.props
index 6b9d6cd9f..317ef14a6 100644
--- a/src/Samples/Directory.Build.props

View file

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Rainer Sigwald <raines@microsoft.com>
Date: Fri, 3 Dec 2021 14:24:03 -0600
Subject: [PATCH] Don't reference PublicApiAnalyzers in sourcebuild (#7118)
This package is only super relevant at PR-build time so it should
be fine to drop it from source-build scenarios. Fixes #7115.
Patch created from https://github.com/dotnet/msbuild/pull/7118
---
src/Directory.Build.targets | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index 2a840bfd7..bff6cc905 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -85,7 +85,7 @@
<ItemGroup Condition="'$(GenerateReferenceAssemblySource)' == 'true'">
<!-- Ensure API stability for shipping packages -->
- <PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="all" />
+ <PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="all" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<AdditionalFiles Include="PublicAPI/$(PublicApiTfm)/PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI/$(PublicApiTfm)/PublicAPI.Unshipped.txt" />