From c6d7dcb893b1f4eaefd1d8ba5707f27bd95a23d0 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 5 Sep 2022 15:39:24 +0200 Subject: [PATCH] Use analyzers from targeting pack for .NET Current Add analyzers to the frameworklist that OOB projects in src/libraries use, and only auto ProjectReference the analyzers in generators.targets when not using the analyzers from the targeting pack. --- eng/generatorProjects.targets | 38 ++++++++++++ eng/generators.targets | 59 ++++++++++--------- src/libraries/Directory.Build.targets | 27 +-------- ...osoft.Interop.LibraryImportGenerator.props | 19 ------ src/libraries/frameworklist.targets | 6 +- src/libraries/oob.proj | 2 + src/libraries/sfx.proj | 2 +- 7 files changed, 78 insertions(+), 75 deletions(-) create mode 100644 eng/generatorProjects.targets delete mode 100644 src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Microsoft.Interop.LibraryImportGenerator.props diff --git a/eng/generatorProjects.targets b/eng/generatorProjects.targets new file mode 100644 index 0000000000000..93354fb90e69d --- /dev/null +++ b/eng/generatorProjects.targets @@ -0,0 +1,38 @@ + + + + analyzers/dotnet + $(GeneratorProjectBaseTargetPath)/$(AnalyzerLanguage) + + + + + + + + + $(GeneratorProjectBaseTargetPath) + + + + + + <_analyzerPath>analyzers/dotnet + <_analyzerPath Condition="'$(_analyzerPath)' != ''">$(_analyzerPath)/roslyn$(AnalyzerRoslynVersion) + <_analyzerPath Condition="'$(_analyzerPath)' != ''">$(_analyzerPath)/$(AnalyzerLanguage) + + + + <_AnalyzerPackFile Include="@(_BuildOutputInPackage)" IsSymbol="false" /> + <_AnalyzerPackFile Include="@(_TargetPathsToSymbols)" IsSymbol="true" /> + <_AnalyzerPackFile PackagePath="$(_analyzerPath)/%(TargetPath)" /> + + + + + + diff --git a/eng/generators.targets b/eng/generators.targets index ac01adc5cc4c4..37fb3bd035cac 100644 --- a/eng/generators.targets +++ b/eng/generators.targets @@ -9,23 +9,27 @@ + - doesn't reference the targeting pack (i.e. when inbox) and + - references System.Private.CoreLib, or + - references System.Runtime.InteropServices --> @@ -55,22 +59,21 @@ OutputItemType="" /> - - - - - - true - - - - - - - + + + + + + + diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index 8f9b52adb2805..827d953abe633 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -86,7 +86,7 @@ - + @@ -95,9 +95,6 @@ $(LibrariesAllBinArtifactsPath) - - $(NetCoreAppCurrentTestHostSharedFrameworkPath) @@ -110,8 +107,6 @@ $(MicrosoftNetCoreAppRefPackRefDir) $(MicrosoftNetCoreAppRuntimePackRidLibTfmDir) - - @@ -125,6 +120,7 @@ + @@ -216,23 +212,4 @@ - - - - <_analyzerPath>analyzers/dotnet - <_analyzerPath Condition="'$(AnalyzerRoslynVersion)' != ''">$(_analyzerPath)/roslyn$(AnalyzerRoslynVersion) - <_analyzerPath Condition="'$(AnalyzerLanguage)' != ''">$(_analyzerPath)/$(AnalyzerLanguage) - - - - <_AnalyzerPackFile Include="@(_BuildOutputInPackage)" IsSymbol="false" /> - <_AnalyzerPackFile Include="@(_TargetPathsToSymbols)" IsSymbol="true" /> - <_AnalyzerPackFile PackagePath="$(_analyzerPath)/%(TargetPath)" /> - - - - diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Microsoft.Interop.LibraryImportGenerator.props b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Microsoft.Interop.LibraryImportGenerator.props deleted file mode 100644 index 14caceaf8e4d2..0000000000000 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Microsoft.Interop.LibraryImportGenerator.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - diff --git a/src/libraries/frameworklist.targets b/src/libraries/frameworklist.targets index 6e1966fe42454..103581037f512 100644 --- a/src/libraries/frameworklist.targets +++ b/src/libraries/frameworklist.targets @@ -15,6 +15,8 @@ @(SharedFrameworkAssemblyWithoutReferenceAssembly)" TargetPath="ref/$(NetCoreAppCurrent)" Condition="!$(NetCoreAppLibraryNoReference.Contains('%(Filename);'))" /> + @@ -22,7 +24,7 @@ @@ -34,7 +36,7 @@ diff --git a/src/libraries/oob.proj b/src/libraries/oob.proj index 29594462f92b0..12e150166d93f 100644 --- a/src/libraries/oob.proj +++ b/src/libraries/oob.proj @@ -7,6 +7,7 @@ + @@ -22,6 +23,7 @@ + diff --git a/src/libraries/sfx.proj b/src/libraries/sfx.proj index bfe5a1c490223..ddd192227b71b 100644 --- a/src/libraries/sfx.proj +++ b/src/libraries/sfx.proj @@ -11,12 +11,12 @@ SharedFrameworkAssembly + -