Eliminate MicrosoftCodeAnalysis prebuilts in runtime (#14844)

* Eliminate MicrosoftCodeAnalysis prebuilts in runtime

* Add mechanism to define repo level nowarns versus utilizing patches

* Update src/SourceBuild/tarball/content/repos/aspnetcore.proj

Co-authored-by: Logan Bussell <loganbussell@microsoft.com>

Co-authored-by: Logan Bussell <loganbussell@microsoft.com>
This commit is contained in:
Michael Simons 2022-10-31 15:19:11 -05:00 committed by GitHub
parent e48dff3939
commit 1564a3226d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 53 deletions

View file

@ -85,11 +85,11 @@
NewText="/p:RepoRoot=&quot;$repo_root/&quot;" />
</Target>
<Target Name="AddCommonNoWarns"
<Target Name="AddNoWarns"
BeforeTargets="Build"
Condition=" EXISTS('$(ProjectDirectory)Directory.Build.props') OR EXISTS('$(ProjectDirectory)src/Directory.Build.props') "
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)AddCommonNoWarns.complete" >
Outputs="$(RepoCompletedSemaphorePath)AddNoWarns.complete" >
<!-- Don't warn on warnings that can be generated in source-build
but not necessarily in repo builds.
@ -104,7 +104,7 @@
<OldText><![CDATA[</Project>]]></OldText>
<NewText>
<![CDATA[ <PropertyGroup>
<NoWarn>%24(NoWarn);NU5104;NU1603</NoWarn>
<NoWarn>%24(NoWarn);NU5104;NU1603;$(RepoNoWarns)</NoWarn>
</PropertyGroup>
</Project>]]>
</NewText>

View file

@ -22,6 +22,11 @@
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<!-- CS0618 - Caused from deprecated IOperation.Children in
Microsoft.CodeAnalysis 4.3.0, but aspnetcore references version 4.2.0.
Requires https://github.com/dotnet/source-build/issues/2482 -->
<RepoNoWarns>CS0618</RepoNoWarns>
</PropertyGroup>
<ItemGroup>

View file

@ -7,6 +7,9 @@
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<!-- CS9057 - Caused by incoherency of analyzer assemblies during pre-release builds. -->
<RepoNoWarns>CS9057</RepoNoWarns>
</PropertyGroup>
<ItemGroup>

View file

@ -46,6 +46,9 @@
<!-- This repo uses text-only template packages from the internal transport feed. -->
<SetUpInternalTransportFeed>true</SetUpInternalTransportFeed>
<!-- CS9057 - Caused by incoherency of analyzer assemblies during pre-release builds. -->
<RepoNoWarns>CS9057</RepoNoWarns>
</PropertyGroup>
<ItemGroup>

View file

@ -7,6 +7,10 @@
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<!-- NU1507 - https://github.com/dotnet/razor-compiler/issues/242
Occurs when using NuGet central package management without defining any Package Source Mappings. -->
<RepoNoWarns>NU1507</RepoNoWarns>
</PropertyGroup>
<ItemGroup>

View file

@ -50,6 +50,8 @@
<ItemGroup>
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftCodeAnalysisVersion_4_X" Version="%24(MicrosoftCodeAnalysisVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftCodeAnalysisVersion_4_4" Version="%24(MicrosoftCodeAnalysisVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftCodeAnalysisVersion_LatestVS" Version="%24(MicrosoftCodeAnalysisVersion)" />
</ItemGroup>
<!-- Repository References -->

View file

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Logan Bussell <loganbussell@microsoft.com>
Date: Thu, 12 May 2022 14:32:59 -0700
Subject: [PATCH] Disable warning CS0618
This is needed because IOperation.Children is deprecated in
Microsoft.CodeAnalysis 4.3.0, but aspnetcore references version 4.2.0.
Requires https://github.com/dotnet/source-build/issues/2482 in order to eliminate this patch
---
.../src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj b/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj
index 0b94ad2a8f..1b5cb9d907 100644
--- a/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj
+++ b/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj
@@ -9,6 +9,7 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
+ <NoWarn>$(NoWarn);CS0618</NoWarn>
</PropertyGroup>
<ItemGroup>

View file

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Logan Bussell <loganbussell@microsoft.com>
Date: Fri, 13 May 2022 16:14:14 -0700
Subject: [PATCH] Add NoWarn for NU1507
This warning occurs when using NuGet central package management without defining
any Package Source Mappings.
Workaround for: https://github.com/dotnet/razor-compiler/issues/242
---
Directory.Build.props | 1 +
1 file changed, 1 insertion(+)
diff --git a/Directory.Build.props b/Directory.Build.props
index a57125f5..019ac376 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -55,6 +55,7 @@
<!-- Ensure API docs are available. -->
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
<NoWarn Condition=" '$(BuildingInsideVisualStudio)' == 'true' ">$(NoWarn);0105</NoWarn>
+ <NoWarn>$(NoWarn);NU1507</NoWarn>
<!-- For local builds, don't make missing XML docs a fatal build error, but still surface so we have visibility into undocumented APIs. -->
<WarningsNotAsErrors Condition=" '$(ContinuousIntegrationBuild)' != 'true' ">$(WarningsNotAsErrors);CS1591</WarningsNotAsErrors>