mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-24 20:34:29 +08:00
refactor(generator): 将Attributes项目重命名为Abstractions并更新引用
- 将GFramework.SourceGenerators.Attributes重命名为GFramework.SourceGenerators.Abstractions - 将GFramework.Godot.SourceGenerators.Attributes重命名为GFramework.Godot.SourceGenerators.Abstractions - 更新所有源生成器中对Attribute命名空间的引用 - 修改项目引用从Attributes指向Abstractions - 添加程序集打包配置到生成项目 - 更新解决方案文件中的项目引用路径 - 修正测试文件中的命名空间引用
This commit is contained in:
parent
fc88d908be
commit
5f55a1b8db
@ -5,6 +5,7 @@
|
|||||||
<PackageId>GeWuYou.GFramework.Godot.SourceGenerators.Attributes</PackageId>
|
<PackageId>GeWuYou.GFramework.Godot.SourceGenerators.Attributes</PackageId>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>10</LangVersion>
|
||||||
|
<RootNamespace>GFramework.Godot.SourceGenerators.Attributes</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,7 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
namespace GFramework.GFramework.Godot.SourceGenerators.Abstractions.logging;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Attributes.logging;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Godot日志特性,用于在类上标记以自动生成日志字段
|
/// Godot日志特性,用于在类上标记以自动生成日志字段
|
||||||
@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
<!-- Generator 编译期依赖 -->
|
<!-- Generator 编译期依赖 -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\GFramework.Godot.SourceGenerators.Attributes\GFramework.Godot.SourceGenerators.Attributes.csproj"
|
<ProjectReference Include="..\GFramework.Godot.SourceGenerators.Abstractions\GFramework.Godot.SourceGenerators.Abstractions.csproj" PrivateAssets="all"/>
|
||||||
PrivateAssets="all"/>
|
|
||||||
<ProjectReference Include="..\GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj"
|
<ProjectReference Include="..\GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj"
|
||||||
PrivateAssets="all"/>
|
PrivateAssets="all"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -36,5 +35,8 @@
|
|||||||
PackagePath="analyzers/dotnet/cs"
|
PackagePath="analyzers/dotnet/cs"
|
||||||
Visible="false"/>
|
Visible="false"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="$(OutputPath)\$(AssemblyName).Attributes.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||||
|
<None Include="GFramework.SourceGenerators.Common.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace GFramework.Godot.SourceGenerators.logging;
|
|||||||
public sealed class GodotLoggerGenerator : IIncrementalGenerator
|
public sealed class GodotLoggerGenerator : IIncrementalGenerator
|
||||||
{
|
{
|
||||||
private const string AttributeMetadataName =
|
private const string AttributeMetadataName =
|
||||||
"GFramework.Godot.SourceGenerators.Attributes.logging.GodotLogAttribute";
|
"GFramework.Godot.SourceGenerators.Abstractions.logging.GodotLogAttribute";
|
||||||
|
|
||||||
private const string AttributeShortName = "GodotLogAttribute";
|
private const string AttributeShortName = "GodotLogAttribute";
|
||||||
private const string AttributeShortNameWithoutSuffix = "GodotLog";
|
private const string AttributeShortNameWithoutSuffix = "GodotLog";
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
<PackageId>GeWuYou.GFramework.SourceGenerators.Attributes</PackageId>
|
<PackageId>GeWuYou.GFramework.SourceGenerators.Attributes</PackageId>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>10</LangVersion>
|
||||||
|
<RootNamespace>GFramework.SourceGenerators.Attributes</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0"/>
|
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0"/>
|
||||||
@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace GFramework.GFramework.SourceGenerators.Abstractions.enums;
|
||||||
|
|
||||||
namespace GFramework.SourceGenerators.Attributes.enums;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标注在 enum 上,Source Generator 会为该 enum 生成扩展方法。
|
/// 标注在 enum 上,Source Generator 会为该 enum 生成扩展方法。
|
||||||
@ -1,7 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
namespace GFramework.GFramework.SourceGenerators.Abstractions.logging;
|
||||||
|
|
||||||
namespace GFramework.SourceGenerators.Attributes.logging;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标注在类上,Source Generator 会为该类自动生成一个日志记录器字段。
|
/// 标注在类上,Source Generator 会为该类自动生成一个日志记录器字段。
|
||||||
@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace GFramework.GFramework.SourceGenerators.Abstractions.rule;
|
||||||
|
|
||||||
namespace GFramework.SourceGenerators.Attributes.rule;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标记该类需要自动实现 IContextAware
|
/// 标记该类需要自动实现 IContextAware
|
||||||
@ -22,7 +22,7 @@ public class ContextAwareGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace GFramework.SourceGenerators.Attributes.rule
|
namespace GFramework.SourceGenerators.Abstractions.rule
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public sealed class ContextAwareAttribute : Attribute
|
public sealed class ContextAwareAttribute : Attribute
|
||||||
@ -32,7 +32,7 @@ public class ContextAwareGeneratorTests
|
|||||||
|
|
||||||
namespace TestApp
|
namespace TestApp
|
||||||
{
|
{
|
||||||
using GFramework.SourceGenerators.Attributes.rule;
|
using GFramework.SourceGenerators.Abstractions.rule;
|
||||||
|
|
||||||
[ContextAware]
|
[ContextAware]
|
||||||
public partial class MyRule: GFramework.Core.rule.IContextAware
|
public partial class MyRule: GFramework.Core.rule.IContextAware
|
||||||
@ -89,7 +89,7 @@ public class ContextAwareGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace GFramework.SourceGenerators.Attributes.rule
|
namespace GFramework.SourceGenerators.Abstractions.rule
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public sealed class ContextAwareAttribute : Attribute
|
public sealed class ContextAwareAttribute : Attribute
|
||||||
@ -99,7 +99,7 @@ public class ContextAwareGeneratorTests
|
|||||||
|
|
||||||
namespace TestApp
|
namespace TestApp
|
||||||
{
|
{
|
||||||
using GFramework.SourceGenerators.Attributes.rule;
|
using GFramework.SourceGenerators.Abstractions.rule;
|
||||||
using GFramework.Core.rule;
|
using GFramework.Core.rule;
|
||||||
|
|
||||||
// 间接接口:继承自 IContextAware
|
// 间接接口:继承自 IContextAware
|
||||||
|
|||||||
@ -24,8 +24,7 @@
|
|||||||
|
|
||||||
<!-- Generator 编译期引用 Attributes / Common,但不打包 -->
|
<!-- Generator 编译期引用 Attributes / Common,但不打包 -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\GFramework.SourceGenerators.Attributes\GFramework.SourceGenerators.Attributes.csproj"
|
<ProjectReference Include="..\GFramework.SourceGenerators.Abstractions\GFramework.SourceGenerators.Abstractions.csproj" PrivateAssets="all"/>
|
||||||
PrivateAssets="all"/>
|
|
||||||
<ProjectReference Include="..\GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj"
|
<ProjectReference Include="..\GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj"
|
||||||
PrivateAssets="all"/>
|
PrivateAssets="all"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -37,5 +36,8 @@
|
|||||||
PackagePath="analyzers/dotnet/cs"
|
PackagePath="analyzers/dotnet/cs"
|
||||||
Visible="false"/>
|
Visible="false"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="$(OutputPath)\$(AssemblyName).Attributes.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||||
|
<None Include="GFramework.SourceGenerators.Common.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace GFramework.SourceGenerators.enums;
|
|||||||
public class EnumExtensionsGenerator : IIncrementalGenerator
|
public class EnumExtensionsGenerator : IIncrementalGenerator
|
||||||
{
|
{
|
||||||
private const string AttributeFullName =
|
private const string AttributeFullName =
|
||||||
"GFramework.SourceGenerators.Attributes.generator.enums.GenerateEnumExtensionsAttribute";
|
"GFramework.SourceGenerators.Abstractions.generator.enums.GenerateEnumExtensionsAttribute";
|
||||||
|
|
||||||
public void Initialize(IncrementalGeneratorInitializationContext context)
|
public void Initialize(IncrementalGeneratorInitializationContext context)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,7 +18,7 @@ namespace GFramework.SourceGenerators.logging;
|
|||||||
[Generator]
|
[Generator]
|
||||||
public sealed class LoggerGenerator : IIncrementalGenerator
|
public sealed class LoggerGenerator : IIncrementalGenerator
|
||||||
{
|
{
|
||||||
private const string AttributeMetadataName = "GFramework.SourceGenerators.Attributes.logging.LogAttribute";
|
private const string AttributeMetadataName = "GFramework.SourceGenerators.Abstractions.logging.LogAttribute";
|
||||||
private const string AttributeShortName = "LogAttribute";
|
private const string AttributeShortName = "LogAttribute";
|
||||||
private const string AttributeShortNameWithoutSuffix = "Log";
|
private const string AttributeShortNameWithoutSuffix = "Log";
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace GFramework.SourceGenerators.rule;
|
|||||||
public sealed class ContextAwareGenerator : IIncrementalGenerator
|
public sealed class ContextAwareGenerator : IIncrementalGenerator
|
||||||
{
|
{
|
||||||
private const string AttributeMetadataName =
|
private const string AttributeMetadataName =
|
||||||
"GFramework.SourceGenerators.Attributes.rule.ContextAwareAttribute";
|
"GFramework.SourceGenerators.Abstractions.rule.ContextAwareAttribute";
|
||||||
|
|
||||||
public void Initialize(IncrementalGeneratorInitializationContext context)
|
public void Initialize(IncrementalGeneratorInitializationContext context)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework ", "GFramework.c
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators", "GFramework.SourceGenerators\GFramework.SourceGenerators.csproj", "{E9D51809-0351-4B83-B85B-B5F469AAB3B8}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators", "GFramework.SourceGenerators\GFramework.SourceGenerators.csproj", "{E9D51809-0351-4B83-B85B-B5F469AAB3B8}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators.Attributes", "GFramework.SourceGenerators.Attributes\GFramework.SourceGenerators.Attributes.csproj", "{84C5C3C9-5620-4924-BA04-92F813F2B70F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators.Abstractions", "GFramework.SourceGenerators.Abstractions\GFramework.SourceGenerators.Abstractions.csproj", "{84C5C3C9-5620-4924-BA04-92F813F2B70F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Core", "GFramework.Core\GFramework.Core.csproj", "{A6D5854D-79EA-487A-9ED9-396E6A1F8031}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Core", "GFramework.Core\GFramework.Core.csproj", "{A6D5854D-79EA-487A-9ED9-396E6A1F8031}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -14,7 +14,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Game", "GFramewo
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Godot.SourceGenerators", "GFramework.Godot.SourceGenerators\GFramework.Godot.SourceGenerators.csproj", "{C56FD287-CBC6-4C44-B3DF-103FA3660CA0}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Godot.SourceGenerators", "GFramework.Godot.SourceGenerators\GFramework.Godot.SourceGenerators.csproj", "{C56FD287-CBC6-4C44-B3DF-103FA3660CA0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Godot.SourceGenerators.Attributes", "GFramework.Godot.SourceGenerators.Attributes\GFramework.Godot.SourceGenerators.Attributes.csproj", "{3A1132B7-EC3B-4BB6-A752-8ADC92BC08A0}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Godot.SourceGenerators.Abstractions", "GFramework.Godot.SourceGenerators.Abstractions\GFramework.Godot.SourceGenerators.Abstractions.csproj", "{3A1132B7-EC3B-4BB6-A752-8ADC92BC08A0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators.Common", "GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj", "{3DB57A3A-ACCF-47BE-A17B-2ADD68B6C8AA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators.Common", "GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj", "{3DB57A3A-ACCF-47BE-A17B-2ADD68B6C8AA}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user