-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multi-target Json and Logger Source Generators between Roslyn v3.11 a…
…nd v4.0 (#58446) * Multi-target LoggerMessageGenerator between Roslyn v3.11 and v4.0 * Include a .targets file in NuGet packages which will select the correct analyzer assembly depending on which Roslyn version will be used to compile. * Multi-target JsonSourceGenerator between Roslyn v3.11 and v4.0 * Fix restore * Update NuGet package MSBuild logic to detect when SupportsRoslynComponentVersioning is not available, and use the lowest analyzer available. * Handle non-SDK projects by running after ResolveNuGetPackageAssets * Respond to PR feedback - Name .cs and .csproj files with Roslyn in the name - Upgrade to Roslyn 3.11 so IsExplicitlyNamedTupleElement API is available - Fix some references to the test projects - Fix incremental pack of the analyzer targets
- Loading branch information
Showing
58 changed files
with
532 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<Project> | ||
<Target Name="_{TargetPrefix}GatherAnalyzers"> | ||
|
||
<ItemGroup> | ||
<_{TargetPrefix}Analyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == '{NuGetPackageId}'" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="_{TargetPrefix}AnalyzerMultiTargeting" | ||
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'" | ||
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets" | ||
DependsOnTargets="_{TargetPrefix}GatherAnalyzers"> | ||
|
||
<ItemGroup> | ||
<!-- Remove our analyzers targeting roslyn4.x --> | ||
<Analyzer Remove="@(_{TargetPrefix}Analyzer)" | ||
Condition="$([System.String]::Copy('%(_{TargetPrefix}Analyzer.Identity)').IndexOf('roslyn4')) >= 0"/> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="_{TargetPrefix}RemoveAnalyzers" | ||
Condition="'$({DisableSourceGeneratorPropertyName})' == 'true'" | ||
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets" | ||
DependsOnTargets="_{TargetPrefix}GatherAnalyzers"> | ||
|
||
<!-- Remove all our analyzers --> | ||
<ItemGroup> | ||
<Analyzer Remove="@(_{TargetPrefix}Analyzer)" /> | ||
</ItemGroup> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.