diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj index 3a2b88a..7c61d08 100644 --- a/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj +++ b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj @@ -10,4 +10,7 @@ + + + diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj.DotSettings b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj.DotSettings index 671cf2a..983a9ab 100644 --- a/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj.DotSettings +++ b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Appegy.Union.Generator.Shapes.csproj.DotSettings @@ -1,4 +1,5 @@  True True + True True \ No newline at end of file diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Shapes/Attributes/ExposeAttribute.cs b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Shapes/Attributes/ExposeAttribute.cs new file mode 100644 index 0000000..796324a --- /dev/null +++ b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Shapes/Attributes/ExposeAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Appegy.Union +{ + [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public class ExposeAttribute : Attribute + { + public Type[] Interfaces { get; } + + public ExposeAttribute(params Type[] interfaces) + { + Interfaces = interfaces; + } + } +} \ No newline at end of file diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Shapes/Attributes/UnionAttribute.cs b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Shapes/Attributes/UnionAttribute.cs new file mode 100644 index 0000000..50c1eba --- /dev/null +++ b/Appegy.Union.Generator~/Appegy.Union.Generator.Shapes/Shapes/Attributes/UnionAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Appegy.Union +{ + [AttributeUsage(System.AttributeTargets.Struct | AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public class UnionAttribute : System.Attribute + { + public System.Type[] Types { get; } + + public UnionAttribute(params System.Type[] types) + { + Types = types; + } + } +} \ No newline at end of file diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator/Attributes/AttributesNames.cs b/Appegy.Union.Generator~/Appegy.Union.Generator/Attributes/AttributesNames.cs index dbb280f..947bf44 100644 --- a/Appegy.Union.Generator~/Appegy.Union.Generator/Attributes/AttributesNames.cs +++ b/Appegy.Union.Generator~/Appegy.Union.Generator/Attributes/AttributesNames.cs @@ -2,6 +2,7 @@ public static class AttributesNames { + public static readonly string GeneratedCodeAttribute = $@"[global::System.CodeDom.Compiler.GeneratedCodeAttribute(""Appegy.Union"", ""{typeof(AttributesNames).Assembly.GetName().Version}"")]"; public const string UnionAttributeName = "Appegy.Union.UnionAttribute"; public const string ExposeAttributeName = "Appegy.Union.ExposeAttribute"; } \ No newline at end of file diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator/Attributes/AttributesSource.cs b/Appegy.Union.Generator~/Appegy.Union.Generator/Attributes/AttributesSource.cs deleted file mode 100644 index b39dfcf..0000000 --- a/Appegy.Union.Generator~/Appegy.Union.Generator/Attributes/AttributesSource.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; - -namespace Appegy.Union.Generator; - -public static class AttributesSource -{ - public static readonly string GeneratedCodeAttribute = $@"[global::System.CodeDom.Compiler.GeneratedCodeAttribute(""Appegy.Union"", ""{typeof(AttributesNames).Assembly.GetName().Version}"")]"; - public static readonly string UnionAttribute = @$"// - -namespace Appegy.Union -{{ - {GeneratedCodeAttribute} - [global::System.AttributeUsageAttribute(global::System.AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] - internal class UnionAttribute : global::System.Attribute - {{ - public global::System.Type[] Types {{ get; }} - - public UnionAttribute(params global::System.Type[] types) - {{ - Types = types; - }} - }} -}}"; - - public static readonly string ExposeAttribute = @$"// - -namespace Appegy.Union -{{ - {GeneratedCodeAttribute} - [global::System.AttributeUsageAttribute(global::System.AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] - internal class ExposeAttribute : global::System.Attribute - {{ - public global::System.Type[] Interfaces {{ get; }} - - public ExposeAttribute(params global::System.Type[] interfaces) - {{ - Interfaces = interfaces; - }} - }} -}}"; -} \ No newline at end of file diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator/Expose/ExposeAttributeGenerator.cs b/Appegy.Union.Generator~/Appegy.Union.Generator/Expose/ExposeAttributeGenerator.cs index fa536a2..9693b3c 100644 --- a/Appegy.Union.Generator~/Appegy.Union.Generator/Expose/ExposeAttributeGenerator.cs +++ b/Appegy.Union.Generator~/Appegy.Union.Generator/Expose/ExposeAttributeGenerator.cs @@ -8,7 +8,6 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; -using static Appegy.Union.Generator.AttributesSource; using static Appegy.Union.Generator.AttributesNames; namespace Appegy.Union.Generator; @@ -33,8 +32,6 @@ public class ExposeAttributeGenerator : IIncrementalGenerator public void Initialize(IncrementalGeneratorInitializationContext context) { - context.RegisterPostInitializationOutput(c => c.AddSource("ExposeAttribute.g.cs", ExposeAttribute)); - var exposeSources = context .SyntaxProvider .ForAttributeWithMetadataName( diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator/Union/Parts/UnionDeclarationPart.cs b/Appegy.Union.Generator~/Appegy.Union.Generator/Union/Parts/UnionDeclarationPart.cs index e210117..e22ad2e 100644 --- a/Appegy.Union.Generator~/Appegy.Union.Generator/Union/Parts/UnionDeclarationPart.cs +++ b/Appegy.Union.Generator~/Appegy.Union.Generator/Union/Parts/UnionDeclarationPart.cs @@ -8,7 +8,7 @@ public override void Generate(IndentedTextWriter codeWriter, UnionAttributePartI { var (syntax, types) = input; - codeWriter.WriteLine(AttributesSource.GeneratedCodeAttribute); + codeWriter.WriteLine(AttributesNames.GeneratedCodeAttribute); codeWriter.WriteLine("[global::System.Runtime.InteropServices.StructLayout(global::System.Runtime.InteropServices.LayoutKind.Explicit, Pack = 1)]"); codeWriter.Write("partial struct "); codeWriter.WriteLine(syntax.Identifier.Text); diff --git a/Appegy.Union.Generator~/Appegy.Union.Generator/Union/UnionAttributeGenerator.cs b/Appegy.Union.Generator~/Appegy.Union.Generator/Union/UnionAttributeGenerator.cs index cb20c0b..9700817 100644 --- a/Appegy.Union.Generator~/Appegy.Union.Generator/Union/UnionAttributeGenerator.cs +++ b/Appegy.Union.Generator~/Appegy.Union.Generator/Union/UnionAttributeGenerator.cs @@ -8,7 +8,6 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; -using static Appegy.Union.Generator.AttributesSource; using static Appegy.Union.Generator.AttributesNames; namespace Appegy.Union.Generator; @@ -37,8 +36,6 @@ public class UnionAttributeGenerator : IIncrementalGenerator public void Initialize(IncrementalGeneratorInitializationContext context) { - context.RegisterPostInitializationOutput(c => c.AddSource("UnionAttribute.g.cs", UnionAttribute)); - var sources = context .SyntaxProvider .ForAttributeWithMetadataName( diff --git a/Runtime/Appegy.Union.Generator.dll b/Runtime/Appegy.Union.Generator.dll index 07b9fd4..2f522f7 100644 --- a/Runtime/Appegy.Union.Generator.dll +++ b/Runtime/Appegy.Union.Generator.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da7c87d3ee08c9d52eece931e67a2ee36172d955a7d5a3eada557d729ba791e0 -size 57344 +oid sha256:d1141df8050ec5086c10e75ac2e0047630095079b1707cbe1e61f6500574e597 +size 55296 diff --git a/Runtime/Appegy.Union.Generator.pdb b/Runtime/Appegy.Union.Generator.pdb index 0d9df86..a10f83c 100644 Binary files a/Runtime/Appegy.Union.Generator.pdb and b/Runtime/Appegy.Union.Generator.pdb differ diff --git a/Runtime/Appegy.Union.asmdef b/Runtime/Appegy.Union.asmdef new file mode 100644 index 0000000..8fa76df --- /dev/null +++ b/Runtime/Appegy.Union.asmdef @@ -0,0 +1,14 @@ +{ + "name": "Appegy.Union", + "rootNamespace": "Appegy.Union", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Runtime/Appegy.Union.asmdef.meta b/Runtime/Appegy.Union.asmdef.meta new file mode 100644 index 0000000..7f25036 --- /dev/null +++ b/Runtime/Appegy.Union.asmdef.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0c0693a7b4264386a6dfa0ea92c11448 +timeCreated: 1757152490 \ No newline at end of file diff --git a/Runtime/ExposeAttribute.cs b/Runtime/ExposeAttribute.cs new file mode 100644 index 0000000..e84d18c --- /dev/null +++ b/Runtime/ExposeAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Appegy.Union +{ + [AttributeUsage(AttributeTargets.Struct)] + public class ExposeAttribute : Attribute + { + public Type[] Interfaces { get; } + + public ExposeAttribute(params Type[] interfaces) + { + Interfaces = interfaces; + } + } +} \ No newline at end of file diff --git a/Runtime/ExposeAttribute.cs.meta b/Runtime/ExposeAttribute.cs.meta new file mode 100644 index 0000000..d66b382 --- /dev/null +++ b/Runtime/ExposeAttribute.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0bfc42e7906e4a038511fdc42c16c03d +timeCreated: 1757151831 \ No newline at end of file diff --git a/Runtime/UnionAttribute.cs b/Runtime/UnionAttribute.cs new file mode 100644 index 0000000..e7df7b1 --- /dev/null +++ b/Runtime/UnionAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Appegy.Union +{ + [AttributeUsage(AttributeTargets.Struct)] + public class UnionAttribute : Attribute + { + public Type[] Types { get; } + + public UnionAttribute(params Type[] types) + { + Types = types; + } + } +} \ No newline at end of file diff --git a/Runtime/UnionAttribute.cs.meta b/Runtime/UnionAttribute.cs.meta new file mode 100644 index 0000000..35344cc --- /dev/null +++ b/Runtime/UnionAttribute.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8a98605af9f4463bbf17236631cf737b +timeCreated: 1757151816 \ No newline at end of file