diff --git a/Documentation/Blazorise.Docs/Components/ComponentApiDocs.razor b/Documentation/Blazorise.Docs/Components/ComponentApiDocs.razor index de8d4e6d6b..ad988df714 100644 --- a/Documentation/Blazorise.Docs/Components/ComponentApiDocs.razor +++ b/Documentation/Blazorise.Docs/Components/ComponentApiDocs.razor @@ -1,4 +1,5 @@ - +@using Blazorise.Generator.Features.ApiDocsDtos + API diff --git a/Documentation/Blazorise.Docs/Components/ComponentApiDocsProperty.razor b/Documentation/Blazorise.Docs/Components/ComponentApiDocsProperty.razor index b4b79dd4f2..2ae9e2076a 100644 --- a/Documentation/Blazorise.Docs/Components/ComponentApiDocsProperty.razor +++ b/Documentation/Blazorise.Docs/Components/ComponentApiDocsProperty.razor @@ -1,4 +1,5 @@ - +@using Blazorise.Generator.Features.ApiDocsDtos + @if (filteredApiDocsForComponents.Any()) { diff --git a/Source/SourceGenerators/Blazorise.ApiDocsDtos/ComponentsApiDocsSource.cs b/Source/SourceGenerators/Blazorise.Generator.Features/ApiDocsDtos/ComponentsApiDocsSource.cs similarity index 91% rename from Source/SourceGenerators/Blazorise.ApiDocsDtos/ComponentsApiDocsSource.cs rename to Source/SourceGenerators/Blazorise.Generator.Features/ApiDocsDtos/ComponentsApiDocsSource.cs index 749c0ecf68..1bb9e4ec97 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsDtos/ComponentsApiDocsSource.cs +++ b/Source/SourceGenerators/Blazorise.Generator.Features/ApiDocsDtos/ComponentsApiDocsSource.cs @@ -1,4 +1,9 @@ -namespace Blazorise; +using System; +using System.Collections.Generic; +using System.Linq; +using Blazorise.Generator.Features.ApiDocsDtos; + +namespace Blazorise; public interface IComponentsApiDocsSource diff --git a/Source/SourceGenerators/Blazorise.ApiDocsDtos/Extensions.cs b/Source/SourceGenerators/Blazorise.Generator.Features/ApiDocsDtos/Extensions.cs similarity index 74% rename from Source/SourceGenerators/Blazorise.ApiDocsDtos/Extensions.cs rename to Source/SourceGenerators/Blazorise.Generator.Features/ApiDocsDtos/Extensions.cs index 94440bf539..fdce08cbde 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsDtos/Extensions.cs +++ b/Source/SourceGenerators/Blazorise.Generator.Features/ApiDocsDtos/Extensions.cs @@ -1,4 +1,7 @@ -namespace Blazorise; +using System; +using System.Linq; + +namespace Blazorise.Generator.Features.ApiDocsDtos; public static class TypeExtensions { diff --git a/Source/SourceGenerators/Blazorise.Generator.Features/GenerateEqualityAttribute.cs b/Source/SourceGenerators/Blazorise.Generator.Features/GenerateEqualityAttribute.cs index 9fb4579d07..adb336345a 100644 --- a/Source/SourceGenerators/Blazorise.Generator.Features/GenerateEqualityAttribute.cs +++ b/Source/SourceGenerators/Blazorise.Generator.Features/GenerateEqualityAttribute.cs @@ -1,10 +1,6 @@ using System; -namespace Blazorise.Generator.Features -{ - [AttributeUsage( AttributeTargets.Class )] - public class GenerateEqualityAttribute : Attribute - { +namespace Blazorise.Generator.Features; - } -} +[AttributeUsage( AttributeTargets.Class )] +public class GenerateEqualityAttribute : Attribute; \ No newline at end of file diff --git a/Source/SourceGenerators/Blazorise.Generator.Features/GenerateIgnoreEqualityAttribute.cs b/Source/SourceGenerators/Blazorise.Generator.Features/GenerateIgnoreEqualityAttribute.cs index c6ab8dc026..3b90a61271 100644 --- a/Source/SourceGenerators/Blazorise.Generator.Features/GenerateIgnoreEqualityAttribute.cs +++ b/Source/SourceGenerators/Blazorise.Generator.Features/GenerateIgnoreEqualityAttribute.cs @@ -1,10 +1,6 @@ using System; -namespace Blazorise.Generator.Features -{ - [AttributeUsage( AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event )] - public class GenerateIgnoreEqualityAttribute : Attribute - { +namespace Blazorise.Generator.Features; - } -} +[AttributeUsage( AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event )] +public class GenerateIgnoreEqualityAttribute : Attribute; \ No newline at end of file diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/ComponentsApiDocsGenerator.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/ComponentsApiDocsGenerator.cs similarity index 93% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/ComponentsApiDocsGenerator.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/ComponentsApiDocsGenerator.cs index c36fee3e61..556efdcd67 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/ComponentsApiDocsGenerator.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/ComponentsApiDocsGenerator.cs @@ -1,15 +1,15 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Text; -using Blazorise.ApiDocsGenerator.Helpers; -using Microsoft.CodeAnalysis.Text; +using Blazorise.Generator.ApiDocsGenerator.Dtos; +using Blazorise.Generator.ApiDocsGenerator.Extensions; +using Blazorise.Generator.ApiDocsGenerator.Helpers; using Microsoft.CodeAnalysis; -using System.Collections.Immutable; -using Blazorise.ApiDocsGenerator.Dtos; -using Blazorise.ApiDocsGenerator.Extensions; +using Microsoft.CodeAnalysis.Text; -namespace Blazorise.ApiDocsGenerator; +namespace Blazorise.Generator.ApiDocsGenerator; [Generator] public class ComponentsApiDocsGenerator : IIncrementalGenerator @@ -25,11 +25,13 @@ public void Initialize( IncrementalGeneratorInitializationContext context ) var (compilation, components) = source; INamespaceSymbol namespaceToSearch = GetNamespaceToSearch( compilation ); var sourceText = GenerateComponentsApiSource( compilation, components, namespaceToSearch ); - ctx.AddSource( "ComponentsApiSource.g.cs", SourceText.From( sourceText, Encoding.UTF8 ) ); + ctx.AddSource( "ApiDocsSourceGenerated/ComponentsApiSource.g.cs", SourceText.From( sourceText, Encoding.UTF8 ) ); // ctx.AddSource( "Log.txt", SourceText.From( Logger.LogMessages, Encoding.UTF8 ) ); } ); } + private const string ApiDocsSourceNamespace = "ApiDocsSourceGenerated"; + private INamespaceSymbol GetNamespaceToSearch( Compilation compilation ) { Logger.LogAlways( DateTime.Now.ToLongTimeString() ); @@ -137,8 +139,10 @@ private static string GenerateComponentsApiSource( Compilation compilation, Immu $$""" using System; using System.Collections.Generic; + using Blazorise.Generator.Features.ApiDocsDtos; + - namespace Blazorise.Docs; + namespace Blazorise.{{ApiDocsSourceNamespace}};//CHANGING this requires also changes to Blazorise.Weavers.Fody, where the removal is done. public class ComponentApiSource_ForNamespace_{{namespaceToSearch.Name}}:IComponentsApiDocsSource { diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Dtos/ComponentInfo.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Dtos/ComponentInfo.cs similarity index 91% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Dtos/ComponentInfo.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Dtos/ComponentInfo.cs index 904b0e0d9e..73032ed551 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Dtos/ComponentInfo.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Dtos/ComponentInfo.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Microsoft.CodeAnalysis; -namespace Blazorise.ApiDocsGenerator.Dtos; +namespace Blazorise.Generator.ApiDocsGenerator.Dtos; public record ComponentInfo( INamedTypeSymbol Type, IEnumerable Properties, IEnumerable PublicMethods, IEnumerable InheritsFromChain ) { diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Extensions/Extensions.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Extensions/Extensions.cs similarity index 92% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Extensions/Extensions.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Extensions/Extensions.cs index 9ca5455bc1..e35d918bc7 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Extensions/Extensions.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Extensions/Extensions.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using Blazorise.ApiDocsGenerator.Helpers; +using Blazorise.Generator.ApiDocsGenerator.Helpers; using Microsoft.CodeAnalysis; -namespace Blazorise.ApiDocsGenerator.Extensions; +namespace Blazorise.Generator.ApiDocsGenerator.Extensions; public static class EnumerableExtensions { diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/DefaultValueHelper.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/DefaultValueHelper.cs similarity index 97% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/DefaultValueHelper.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/DefaultValueHelper.cs index 761f15381c..1d9744d963 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/DefaultValueHelper.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/DefaultValueHelper.cs @@ -1,13 +1,9 @@ -using System; -using System.Globalization; -using System.IO; -using System.Linq; +using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Diagnostics; -namespace Blazorise.ApiDocsGenerator.Helpers; +namespace Blazorise.Generator.ApiDocsGenerator.Helpers; public static class DefaultValueHelper { diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/ExtractorParts.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/ExtractorParts.cs similarity index 93% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/ExtractorParts.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/ExtractorParts.cs index eda31537b9..1245a77ef3 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/ExtractorParts.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/ExtractorParts.cs @@ -1,6 +1,6 @@ using System; -namespace Blazorise.ApiDocsGenerator.Helpers; +namespace Blazorise.Generator.ApiDocsGenerator.Helpers; public enum ExtractorParts { diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/FullyQualifiedNameRewriter.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/FullyQualifiedNameRewriter.cs similarity index 98% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/FullyQualifiedNameRewriter.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/FullyQualifiedNameRewriter.cs index 3c72e8024c..08a4f1ae7a 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/FullyQualifiedNameRewriter.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/FullyQualifiedNameRewriter.cs @@ -2,7 +2,7 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Blazorise.ApiDocsGenerator.Helpers; +namespace Blazorise.Generator.ApiDocsGenerator.Helpers; /// diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/InfoExtractor.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/InfoExtractor.cs similarity index 94% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/InfoExtractor.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/InfoExtractor.cs index a2f025e1ca..f2b64d798a 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/InfoExtractor.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/InfoExtractor.cs @@ -1,11 +1,9 @@ -using System.Collections.Generic; -using Blazorise.ApiDocsGenerator.Dtos; +using System.Linq; +using Blazorise.Generator.ApiDocsGenerator.Dtos; +using Blazorise.Generator.ApiDocsGenerator.Extensions; using Microsoft.CodeAnalysis; -using System.Linq; -using Blazorise.ApiDocsGenerator.Extensions; - -namespace Blazorise.ApiDocsGenerator.Helpers; +namespace Blazorise.Generator.ApiDocsGenerator.Helpers; public class InfoExtractor { diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/Logger.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/Logger.cs similarity index 92% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/Logger.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/Logger.cs index cb306459d4..0a3a5ceb8d 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/Logger.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/Logger.cs @@ -1,7 +1,6 @@ -namespace Blazorise.ApiDocsGenerator.Helpers; - -using System.Text; +using System.Text; +namespace Blazorise.Generator.ApiDocsGenerator.Helpers; /// /// This looks silly, but works surprisingly well. diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/StringHelpers.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/StringHelpers.cs similarity index 97% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/StringHelpers.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/StringHelpers.cs index 2070fdc4bc..c9daf1f1bd 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/StringHelpers.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/StringHelpers.cs @@ -3,11 +3,9 @@ using System.Globalization; using System.Linq; using System.Text.RegularExpressions; -using Blazorise.ApiDocsGenerator.Dtos; -using Blazorise.ApiDocsGenerator.Extensions; using Microsoft.CodeAnalysis; -namespace Blazorise.ApiDocsGenerator.Helpers; +namespace Blazorise.Generator.ApiDocsGenerator.Helpers; /// /// Methods that are too small to have their own file diff --git a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/XmlCommentToHtmlConverter.cs b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/XmlCommentToHtmlConverter.cs similarity index 98% rename from Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/XmlCommentToHtmlConverter.cs rename to Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/XmlCommentToHtmlConverter.cs index 921dbefdd2..0fbcb92d1c 100644 --- a/Source/SourceGenerators/Blazorise.ApiDocsGenerator/Helpers/XmlCommentToHtmlConverter.cs +++ b/Source/SourceGenerators/Blazorise.Generator/ApiDocsGenerator/Helpers/XmlCommentToHtmlConverter.cs @@ -1,11 +1,10 @@ using System.Linq; -using System.Text.RegularExpressions; - -namespace Blazorise.ApiDocsGenerator.Helpers; - using System.Text; +using System.Text.RegularExpressions; using System.Xml.Linq; +namespace Blazorise.Generator.ApiDocsGenerator.Helpers; + public class XmlCommentToHtmlConverter { public string Convert( string xmlComment )