Skip to content

Commit

Permalink
1.3.6 released
Browse files Browse the repository at this point in the history
  • Loading branch information
vipwan committed Aug 30, 2024
1 parent feafb2a commit 8c3f61b
Show file tree
Hide file tree
Showing 9 changed files with 442 additions and 412 deletions.
2 changes: 1 addition & 1 deletion Biwen.AutoClassGen.Attributes/AutoInjectAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public enum ServiceLifetime
}

/// <summary>
///
/// AutoInject
/// </summary>
/// <param name="baseType">NULL表示服务自身</param>
/// <param name="serviceLifetime">服务生命周期</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Copyright>MIT</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>Roslyn,SourceGenerator,DTO,Mapper,Decorator,QuickApi</PackageTags>
<PackageReleaseNotes>built-in decorate extension</PackageReleaseNotes>
<PackageReleaseNotes>built-in decorate for extension</PackageReleaseNotes>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>SA1402,1573,1591,1712</NoWarn>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
Expand Down
367 changes: 367 additions & 0 deletions Biwen.AutoClassGen.Gen/AutoDecorSourceGenerator.cs

Large diffs are not rendered by default.

18 changes: 1 addition & 17 deletions Biwen.AutoClassGen.Gen/AutoInjectSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class AutoInjectSourceGenerator : IIncrementalGenerator
private const string AutoInjectKeyedAttributeName = "Biwen.AutoClassGen.Attributes.AutoInjectKeyedAttribute`1";



public void Initialize(IncrementalGeneratorInitializationContext context)
{

Expand Down Expand Up @@ -504,7 +503,7 @@ private static void GenSource(SourceProductionContext context, IEnumerable<AutoI
var envSource = Template.Replace("$services", classes.ToString());
envSource = envSource.Replace("$namespaces", rawNamespace);
// format:
envSource = FormatContent(envSource);
envSource = envSource.FormatContent();
context.AddSource($"Biwen.AutoClassGenInject.g.cs", SourceText.From(envSource, Encoding.UTF8));

}
Expand All @@ -518,7 +517,6 @@ private record AutoInjectDefine(string ImplType, string BaseType, string LifeTim

}


#region tmpl

private const string Template = """
Expand Down Expand Up @@ -549,19 +547,5 @@ public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddAu

#endregion


/// <summary>
/// 格式化代码
/// </summary>
/// <param name="csCode"></param>
/// <returns></returns>
private static string FormatContent(string csCode)
{
var tree = CSharpSyntaxTree.ParseText(csCode);
var root = tree.GetRoot().NormalizeWhitespace();
var ret = root.ToFullString();
return ret;
}

}
}
2 changes: 1 addition & 1 deletion Biwen.AutoClassGen.Gen/Biwen.AutoClassGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Copyright>MIT</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>Roslyn,SourceGenerator,QuickApi</PackageTags>
<PackageReleaseNotes>built-in decorate extension</PackageReleaseNotes>
<PackageReleaseNotes>built-in decorate for extension</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/vipwan/Biwen.AutoClassGen</PackageProjectUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1573,1591,1712,SA1309</NoWarn>
Expand Down
Loading

0 comments on commit 8c3f61b

Please sign in to comment.