Skip to content

Commit

Permalink
Bump Roslyn to 4.12 where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Dec 18, 2024
1 parent 36b0c25 commit b0398a4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ComputeSharp.CodeFixers/ComputeSharp.CodeFixers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions src/ComputeSharp.D2D1.Uwp/ComputeSharp.D2D1.Uwp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</ItemGroup>
</Target>

<!-- Remove the analyzer if using Roslyn < 4.11 (ComputeSharp.D2D1.Uwp's generators require Roslyn 4.11) -->
<!-- Remove the analyzer if using Roslyn < 4.12 (ComputeSharp.D2D1.Uwp's generators require Roslyn 4.12) -->
<Target Name="_ComputeSharpD2D1UwpRemoveAnalyzersForRoslyn3"
Condition="'$(CSharpCoreTargetsPath)' != ''"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
Expand All @@ -29,15 +29,16 @@
<ComputeSharpD2D1UwpCurrentCompilerVersion>@(ComputeSharpD2D1UwpCurrentCompilerAssemblyIdentity->'%(Version)')</ComputeSharpD2D1UwpCurrentCompilerVersion>

<!-- The CurrentCompilerVersionIsNotNewEnough property can now be defined based on the Roslyn assembly version -->
<ComputeSharpD2D1UwpCurrentCompilerVersionIsNotNewEnough Condition="$([MSBuild]::VersionLessThan($(ComputeSharpD2D1UwpCurrentCompilerVersion), 4.11))">true</ComputeSharpD2D1UwpCurrentCompilerVersionIsNotNewEnough>
<ComputeSharpD2D1UwpCurrentCompilerVersionIsNotNewEnough Condition="$([MSBuild]::VersionLessThan($(ComputeSharpD2D1UwpCurrentCompilerVersion), 4.12))">true</ComputeSharpD2D1UwpCurrentCompilerVersionIsNotNewEnough>
</PropertyGroup>

<!-- If the Roslyn version is < 4.11, disable the source generators -->
<!-- If the Roslyn version is < 4.12, disable the source generators -->
<ItemGroup Condition ="'$(ComputeSharpD2D1UwpCurrentCompilerVersionIsNotNewEnough)' == 'true'">
<Analyzer Remove="@(_ComputeSharpD2D1UwpAnalyzer)"/>
</ItemGroup>

<!-- There is no need to emit a warning here, as this package is always a transitive dependency from ComputeSharp.D2D1, which does emit the warning -->
<!-- Emit a warning (see notes in 'ComputeSharp.D2D1') -->
<Warning Condition ="'$(ComputeSharpD2D1UwpCurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The ComputeSharp.D2D1.Uwp source generators have been disabled on the current configuration, as they need Roslyn 4.12 in order to work. ComputeSharp.D2D1.Uwp requires the source generators to run in order for [GeneratedCanvasEffectProperty] to work correctly. If you wish to use that API, you need a more up to date IDE (eg. VS 2022 17.12 or greater) or .NET SDK version (.NET 9 SDK or greater)."/>
</Target>

<!-- Remove the analyzer if Roslyn is missing -->
Expand Down
9 changes: 5 additions & 4 deletions src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</ItemGroup>
</Target>

<!-- Remove the analyzer if using Roslyn < 4.11 (ComputeSharp.D2D1.WinUI's generators require Roslyn 4.11) -->
<!-- Remove the analyzer if using Roslyn < 4.12 (ComputeSharp.D2D1.WinUI's generators require Roslyn 4.12) -->
<Target Name="_ComputeSharpD2D1WinUIRemoveAnalyzersForRoslyn3"
Condition="'$(CSharpCoreTargetsPath)' != ''"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
Expand All @@ -29,15 +29,16 @@
<ComputeSharpD2D1WinUICurrentCompilerVersion>@(ComputeSharpD2D1WinUICurrentCompilerAssemblyIdentity->'%(Version)')</ComputeSharpD2D1WinUICurrentCompilerVersion>

<!-- The CurrentCompilerVersionIsNotNewEnough property can now be defined based on the Roslyn assembly version -->
<ComputeSharpD2D1WinUICurrentCompilerVersionIsNotNewEnough Condition="$([MSBuild]::VersionLessThan($(ComputeSharpD2D1WinUICurrentCompilerVersion), 4.11))">true</ComputeSharpD2D1WinUICurrentCompilerVersionIsNotNewEnough>
<ComputeSharpD2D1WinUICurrentCompilerVersionIsNotNewEnough Condition="$([MSBuild]::VersionLessThan($(ComputeSharpD2D1WinUICurrentCompilerVersion), 4.12))">true</ComputeSharpD2D1WinUICurrentCompilerVersionIsNotNewEnough>
</PropertyGroup>

<!-- If the Roslyn version is < 4.11, disable the source generators -->
<!-- If the Roslyn version is < 4.12, disable the source generators -->
<ItemGroup Condition ="'$(ComputeSharpD2D1WinUICurrentCompilerVersionIsNotNewEnough)' == 'true'">
<Analyzer Remove="@(_ComputeSharpD2D1WinUIAnalyzer)"/>
</ItemGroup>

<!-- There is no need to emit a warning here, as this package is always a transitive dependency from ComputeSharp.D2D1, which does emit the warning -->
<!-- Emit a warning (see notes in 'ComputeSharp.D2D1') -->
<Warning Condition ="'$(ComputeSharpD2D1WinUICurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The ComputeSharp.D2D1.WinUI source generators have been disabled on the current configuration, as they need Roslyn 4.12 in order to work. ComputeSharp.D2D1.WinUI requires the source generators to run in order for [GeneratedCanvasEffectProperty] to work correctly. If you wish to use that API, you need a more up to date IDE (eg. VS 2022 17.12 or greater) or .NET SDK version (.NET 9 SDK or greater)."/>
</Target>

<!-- Remove the analyzer if Roslyn is missing -->
Expand Down
2 changes: 1 addition & 1 deletion src/ComputeSharp.D2D1/ComputeSharp.D2D1.targets
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
emitting this manually lets us customize the message to inform developers as to why exactly the generators have been
disabled, and that ComputeSharp will not work at all unless a more up to date IDE or compiler version are used.
-->
<Error Condition ="'$(ComputeSharpD2D1CurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The ComputeSharp.D2D1 source generators have been disabled on the current configuration, as they need Roslyn 4.9 in order to work. ComputeSharp.D2D1 requires the source generators to run in order to process shaders, so the library cannot be used without a more up to date IDE (eg. VS 2022 17.8 or greater) or .NET SDK version (.NET 8 SDK or greater)."/>
<Error Condition ="'$(ComputeSharpD2D1CurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The ComputeSharp.D2D1 source generators have been disabled on the current configuration, as they need Roslyn 4.9 in order to work. ComputeSharp.D2D1 requires the source generators to run in order to process shaders, so the library cannot be used without a more up to date IDE (eg. VS 2022 17.8 or greater) or .NET SDK version (.NET 8 SDK or greater)."/>
</Target>

<!-- Remove the analyzer if Roslyn is missing -->
Expand Down
2 changes: 1 addition & 1 deletion src/ComputeSharp/ComputeSharp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
emitting this manually lets us customize the message to inform developers as to why exactly the generators have been
disabled, and that ComputeSharp will not work at all unless a more up to date IDE or compiler version are used.
-->
<Error Condition ="'$(ComputeSharpCurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The ComputeSharp source generators have been disabled on the current configuration, as they need Roslyn 4.9 in order to work. ComputeSharp requires the source generators to run in order to process shaders, so the library cannot be used without a more up to date IDE (eg. VS 2022 17.8 or greater) or .NET SDK version (.NET 8 SDK or greater)."/>
<Error Condition ="'$(ComputeSharpCurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The ComputeSharp source generators have been disabled on the current configuration, as they need Roslyn 4.9 in order to work. ComputeSharp requires the source generators to run in order to process shaders, so the library cannot be used without a more up to date IDE (eg. VS 2022 17.8 or greater) or .NET SDK version (.NET 8 SDK or greater)."/>
</Target>

<!-- Remove the analyzer if Roslyn is missing -->
Expand Down

0 comments on commit b0398a4

Please sign in to comment.