Skip to content

Commit

Permalink
feat(UxmlTraitAttribute): move from UIComponents.Experimental namespa…
Browse files Browse the repository at this point in the history
…ce to UIComponents

BREAKING CHANGE: UxmlTraitAttribute has been moved from the UIComponents.Experimental namespace to UIComponents.
  • Loading branch information
jonisavo committed Oct 21, 2022
1 parent 7bfb5e0 commit e1ba54a
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using UIComponents.Experimental;

namespace UIComponents.Tests.Roslyn
namespace UIComponents.Tests.Roslyn
{
public partial class NestParentClass
{
Expand Down
3 changes: 1 addition & 2 deletions Assets/UIComponents.Tests/Roslyn/RoslynTestComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using UIComponents.Experimental;
using UnityEngine;
using UnityEngine;

namespace UIComponents.Tests.Roslyn
{
Expand Down
3 changes: 1 addition & 2 deletions Assets/UIComponents.Tests/Roslyn/RoslynTestVisualElement.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using UIComponents.Experimental;
using UnityEngine.UIElements;
using UnityEngine.UIElements;

namespace UIComponents.Tests.Roslyn
{
Expand Down
3 changes: 0 additions & 3 deletions Assets/UIComponents/Core/Experimental.meta

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Diagnostics;
using UnityEngine.TestTools;

namespace UIComponents.Experimental
namespace UIComponents
{
/// <summary>
/// When used in Unity 2021.2 or later, this attribute will generate
Expand Down
Binary file modified Assets/UIComponents/Roslyn/UIComponents.Roslyn.Generation.dll
Binary file not shown.
Binary file modified Assets/UIComponents/Roslyn/UIComponents.Roslyn.Generation.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Diagnostics.CodeAnalysis;

namespace UIComponents.Experimental
namespace UIComponents
{
[ExcludeFromCodeCoverage]
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public Task Verify_Traits(string fieldTypeName, bool useUnityEngine = false)

var source = $@"
using UIComponents;
using UIComponents.Experimental;
public partial class {fieldTypeNameCap}ComponentWithUsing : UIComponent
{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Task Generates_Enum_Traits()
public Task Does_Not_Generate_If_TraitAttribute_Type_IsMissing()
{
var source = @"
using UIComponents.Experimental;
using UIComponents;
public class Test
{
Expand All @@ -86,7 +86,7 @@ public class Test
public Task Works_On_Non_UIComponent_Type()
{
var source = @"
using UIComponents.Experimental;
using UIComponents;
public partial class NonUIComponentClass
{
Expand All @@ -108,7 +108,6 @@ public Task Generates_Enum_Trait_With_Internal_Enum()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
public partial class OwnEnumComponent : UIComponent
{
Expand Down Expand Up @@ -136,7 +135,6 @@ public Task Generates_In_Namespace()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
namespace Custom
{
Expand Down Expand Up @@ -170,7 +168,6 @@ public Task Allows_Specifying_Uxml_Name()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
public partial class CustomNamespaceComponent : UIComponent
{
Expand All @@ -192,7 +189,6 @@ public Task Handles_Subclass()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
public class MyComponent : UIComponent {}
Expand All @@ -210,7 +206,6 @@ public Task Allows_Setting_Default_Value()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
namespace Some.Place.Where.Enum.Is
{
Expand Down Expand Up @@ -241,7 +236,6 @@ public Task Generates_Traits_For_Many_Classes()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
public partial class FirstTraitClass
{
Expand Down Expand Up @@ -290,7 +284,6 @@ public Task Generates_Both_Traits_And_UxmlFactory()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
[UxmlName(""AwesomeUxmlName"")]
public partial class ComponentWithUxmlNameAndTraits : UIComponent
Expand All @@ -307,7 +300,6 @@ public Task Handles_Long_Member_Name_For_Trait()
{
var source = @"
using UIComponents;
using UIComponents.Experimental;
public partial class LongTraitNameComponent : UIComponent
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class UxmlAugmentGenerator : AugmentGenerator<ClassMemberSyntaxReceiver
protected override void OnBeforeExecute(GeneratorExecutionContext context)
{
_traitAttributeSymbol =
context.Compilation.GetTypeByMetadataName("UIComponents.Experimental.UxmlTraitAttribute");
context.Compilation.GetTypeByMetadataName("UIComponents.UxmlTraitAttribute");
_uxmlNameAttributeSymbol =
context.Compilation.GetTypeByMetadataName("UIComponents.UxmlNameAttribute");
}
Expand Down

0 comments on commit e1ba54a

Please sign in to comment.