Skip to content

Commit 7a99ea2

Browse files
committed
优化(项目配置): 更新版本号并改进代码生成逻辑
更新项目版本号至1.0.1,取消对Show方法的注释以启用调用,完善NuGet包描述信息,重构代码生成器初始化逻辑以简化源文件处理
1 parent b834aa1 commit 7a99ea2

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>1.0.0</Version>
3+
<Version>1.0.1</Version>
44
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66
<LangVersion>preview</LangVersion>

demo/CodeRegionExamplesConsoleApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ internal partial class ExampleProgram
2020
{
2121
static void Main(string[] args)
2222
{
23-
//Show();
23+
Show();
2424
}
2525
}

src/CodeInject/CodeInject.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<PackageIcon>logo.png</PackageIcon>
1212
<PackageReadmeFile>README.md</PackageReadmeFile>
1313
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
14+
<Description>A source generator for code injection that allows injecting code into methods, properties, and other code regions at compile time.</Description>
1415
</PropertyGroup>
1516

1617
<ItemGroup>

src/CodeInjectSourceGenerator/CodeInjectIncrementalSourceGenerator.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,8 @@ public class CodeInjectIncrementalSourceGenerator : IIncrementalGenerator
2929
{
3030
public void Initialize(IncrementalGeneratorInitializationContext context)
3131
{
32-
// 获取项目中的源文件
33-
var sourceFiles = context.SyntaxProvider
34-
.CreateSyntaxProvider(
35-
predicate: static (s, _) => s is CompilationUnitSyntax,
36-
transform: static (ctx, _) => ctx)
37-
.Where(static ctx => ctx.Node is CompilationUnitSyntax);
38-
3932
// 添加 attribute 源码到消费项目
40-
context.RegisterSourceOutput(sourceFiles.Collect(), (ctx, sources) =>
33+
context.RegisterPostInitializationOutput((ctx) =>
4134
{
4235
var attributeSource = GetAttributeSourceFromEmbeddedResource();
4336
if (!string.IsNullOrEmpty(attributeSource))

0 commit comments

Comments
 (0)