From 495bd89f408f5613b4d770ee423f86c61679bc37 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 8 Oct 2023 23:04:43 +0200 Subject: [PATCH 1/3] Add obsolete annotations to APIs removed in 3.0 --- .../Attributes/AutoConstructorAttribute.cs | 6 ++++++ .../Attributes/ShaderMethodAttribute.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs index 20737a4c..c71aeaa2 100644 --- a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs +++ b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; namespace ComputeSharp; @@ -6,6 +7,11 @@ namespace ComputeSharp; /// An attribute that indicates that a target shader type should get an automatic constructor for all fields. /// [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)] +[EditorBrowsable(EditorBrowsableState.Never)] +[Obsolete( + "This API (and its accompanying source generator) is being removed in a future version of ComputeSharp. " + + "If you're relying on this functionality, consider switching to primary constructors, once they are supported. " + + "Otherwise, consider using alternative source generators providing similar functionality available on NuGet.")] public sealed class AutoConstructorAttribute : Attribute { } \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs b/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs index fc3b6415..84a5afbd 100644 --- a/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs +++ b/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; namespace ComputeSharp; @@ -10,6 +11,11 @@ namespace ComputeSharp; /// Methods also need to be static, though this can only be tested at runtime. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] +[EditorBrowsable(EditorBrowsableState.Never)] +[Obsolete( + "This API (and shader metaprogramming in general) is being removed in a future version of ComputeSharp. " + + "If you're relying on this functionality, consider manually implementing different shader variants. " + + "It is possible to still reuse code by moving it to helper methods that are used by multiple shaders.")] public sealed class ShaderMethodAttribute : Attribute { } \ No newline at end of file From bc1cd6ae95adadaaa23300e7b127ffa8e83ed75f Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 8 Oct 2023 23:05:01 +0200 Subject: [PATCH 2/3] Bump the package version to 2.2 --- build/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Directory.Build.props b/build/Directory.Build.props index e5dcc07e..e91636de 100644 --- a/build/Directory.Build.props +++ b/build/Directory.Build.props @@ -60,7 +60,7 @@ As such, this needs to be changed before a new release as well. --> - 2.1.0 + 2.2.0 false From e8afdfed4d4de4ef9eddf553f8b49b114455f232 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 8 Oct 2023 23:21:26 +0200 Subject: [PATCH 3/3] Suppress obsolete warnings --- samples/Directory.Build.props | 3 +++ .../AutoConstructorGenerator.cs | 2 ++ tests/Directory.Build.props | 3 +++ 3 files changed, 8 insertions(+) diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props index 6d1aa4f6..ba8850f6 100644 --- a/samples/Directory.Build.props +++ b/samples/Directory.Build.props @@ -5,6 +5,9 @@ $(NoWarn);CS1591 + + + $(NoWarn);CS0618 diff --git a/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs b/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs index 0da326cc..5395f808 100644 --- a/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs +++ b/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs @@ -9,6 +9,8 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +#pragma warning disable CS0618 + namespace ComputeSharp.Core.SourceGenerators; /// diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 50b882db..654a3725 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -23,6 +23,9 @@ $(NoWarn);IDE0251 + + + $(NoWarn);CS0618