From 780e8d15846aaf8e52823e8a0d6adc937b97ae8d Mon Sep 17 00:00:00 2001 From: Andres Pineda <pineda.andres@gmail.com> Date: Thu, 22 Aug 2024 16:02:57 -0400 Subject: [PATCH] fix(mvux): update default bindable generation tool version --- .../Uno.Extensions.Reactive.Tests.csproj | 5 +++++ .../Config/BindableGenerationToolAttribute.cs | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Uno.Extensions.Reactive.Tests/Uno.Extensions.Reactive.Tests.csproj b/src/Uno.Extensions.Reactive.Tests/Uno.Extensions.Reactive.Tests.csproj index 6786c3893a..e4b9ac8a13 100644 --- a/src/Uno.Extensions.Reactive.Tests/Uno.Extensions.Reactive.Tests.csproj +++ b/src/Uno.Extensions.Reactive.Tests/Uno.Extensions.Reactive.Tests.csproj @@ -8,6 +8,11 @@ </PropertyGroup> <ItemGroup> + <!--We need this version of the BindableGenerationTool for the Tests to run properly--> + <AssemblyAttribute Include="Uno.Extensions.Reactive.Config.BindableGenerationToolAttribute"> + <_Parameter1>3</_Parameter1> + <_Parameter1_TypeName>System.Int32</_Parameter1_TypeName> + </AssemblyAttribute> <PackageReference Include="FluentAssertions" /> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" /><!--For local usage we use the most recent version--> <PackageReference Include="Microsoft.NET.Test.Sdk" /> diff --git a/src/Uno.Extensions.Reactive/Config/BindableGenerationToolAttribute.cs b/src/Uno.Extensions.Reactive/Config/BindableGenerationToolAttribute.cs index 4642f03f42..3095bc20ac 100644 --- a/src/Uno.Extensions.Reactive/Config/BindableGenerationToolAttribute.cs +++ b/src/Uno.Extensions.Reactive/Config/BindableGenerationToolAttribute.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; namespace Uno.Extensions.Reactive.Config; @@ -9,9 +8,21 @@ namespace Uno.Extensions.Reactive.Config; [AttributeUsage(AttributeTargets.Assembly)] public class BindableGenerationToolAttribute : Attribute { + // Latest version is 3, keeping version 2 as default for backward compatibility + private const int DefaultVersion = 2; + + /// <summary> + /// Creates a new BindableGenerationTool object. + /// </summary> + /// <param name="version">The version of the tool to use when generating the bindables</param> + public BindableGenerationToolAttribute(int version = DefaultVersion) + { + Version = version; + } + /// <summary> /// Gets or sets the version of tool that should be used to generate bindables. /// </summary> /// <remarks>Set this to 1 to use code gen used in Uno.Extensions.Reactive versions below 2.3</remarks> - public int Version { get; init; } = 3; + public int Version { get; init; } }