From f3c5840ebeac9ad7ffb2b240a8e7806f4224a021 Mon Sep 17 00:00:00 2001
From: GwWuYou <95328647+GeWuYou@users.noreply.github.com>
Date: Sat, 27 Dec 2025 22:51:39 +0800
Subject: [PATCH] =?UTF-8?q?feat(diagnostic):=20=E6=B7=BB=E5=8A=A0=E9=80=9A?=
=?UTF-8?q?=E7=94=A8=E8=AF=8A=E6=96=AD=E6=8F=8F=E8=BF=B0=E7=AC=A6=E5=B9=B6?=
=?UTF-8?q?=E9=87=8D=E6=9E=84=E8=AF=8A=E6=96=AD=E7=B3=BB=E7=BB=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 添加 CommonDiagnostics 类提供通用诊断描述符
- 将诊断相关文件从 logging 目录移动到 diagnostics 目录
- 更新命名空间从 GFramework.SourceGenerators.Common.diagnostics 到 GFramework.SourceGenerators.diagnostics
- 修改诊断ID从 GFC001 到 GF_Common_Class_001
- 移除 GFramework.SourceGenerators.Common 项目引用
- 更新 AnalyzerReleases.Unshipped.md 文件中的诊断规则
- 重构 README.md 文件提供完整的项目介绍和使用指南
---
.../AnalyzerReleases.Unshipped.md | 1 +
.../GFramework.Godot.SourceGenerators.csproj | 10 +-
.../diagnostics/CommonDiagnostics.cs | 29 +++++
.../GodotLoggerDiagnostic.cs | 2 +-
.../logging/GodotLoggerGenerator.cs | 2 +-
.../AnalyzerReleases.Shipped.md | 3 -
.../AnalyzerReleases.Unshipped.md | 8 --
.../Directory.Build.props | 23 ----
.../GFramework.SourceGenerators.Common.csproj | 18 ---
.../AnalyzerReleases.Unshipped.md | 9 +-
.../GFramework.SourceGenerators.csproj | 7 --
.../diagnostics/CommonDiagnostics.cs | 4 +-
.../ContextAwareDiagnostic.cs | 2 +-
.../LoggerDiagnostic.cs | 2 +-
.../logging/LoggerGenerator.cs | 2 +-
.../rule/ContextAwareGenerator.cs | 2 +-
GFramework.csproj | 1 +
GFramework.sln | 6 -
README.md | 105 +++++++++++++++++-
19 files changed, 144 insertions(+), 92 deletions(-)
create mode 100644 GFramework.Godot.SourceGenerators/diagnostics/CommonDiagnostics.cs
rename GFramework.Godot.SourceGenerators/{logging => diagnostics}/GodotLoggerDiagnostic.cs (93%)
delete mode 100644 GFramework.SourceGenerators.Common/AnalyzerReleases.Shipped.md
delete mode 100644 GFramework.SourceGenerators.Common/AnalyzerReleases.Unshipped.md
delete mode 100644 GFramework.SourceGenerators.Common/Directory.Build.props
delete mode 100644 GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj
rename {GFramework.SourceGenerators.Common => GFramework.SourceGenerators}/diagnostics/CommonDiagnostics.cs (89%)
rename GFramework.SourceGenerators/{rule => diagnostics}/ContextAwareDiagnostic.cs (94%)
rename GFramework.SourceGenerators/{logging => diagnostics}/LoggerDiagnostic.cs (92%)
diff --git a/GFramework.Godot.SourceGenerators/AnalyzerReleases.Unshipped.md b/GFramework.Godot.SourceGenerators/AnalyzerReleases.Unshipped.md
index 58de45e..7043d79 100644
--- a/GFramework.Godot.SourceGenerators/AnalyzerReleases.Unshipped.md
+++ b/GFramework.Godot.SourceGenerators/AnalyzerReleases.Unshipped.md
@@ -5,4 +5,5 @@
Rule ID | Category | Severity | Notes
----------------------|--------------------------|----------|------------------------
+ GF_Common_Class_001 | GFramework.Common | Error | CommonDiagnostics
GF_Godot_Logging_001 | GFramework.Godot.Logging | Warning | GodotLoggerDiagnostics
\ No newline at end of file
diff --git a/GFramework.Godot.SourceGenerators/GFramework.Godot.SourceGenerators.csproj b/GFramework.Godot.SourceGenerators/GFramework.Godot.SourceGenerators.csproj
index 197c676..0b86717 100644
--- a/GFramework.Godot.SourceGenerators/GFramework.Godot.SourceGenerators.csproj
+++ b/GFramework.Godot.SourceGenerators/GFramework.Godot.SourceGenerators.csproj
@@ -27,8 +27,7 @@
-
-
+
@@ -44,17 +43,10 @@
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
-
-
-
-
diff --git a/GFramework.Godot.SourceGenerators/diagnostics/CommonDiagnostics.cs b/GFramework.Godot.SourceGenerators/diagnostics/CommonDiagnostics.cs
new file mode 100644
index 0000000..2b7d586
--- /dev/null
+++ b/GFramework.Godot.SourceGenerators/diagnostics/CommonDiagnostics.cs
@@ -0,0 +1,29 @@
+using Microsoft.CodeAnalysis;
+
+namespace GFramework.Godot.SourceGenerators.diagnostics;
+
+///
+/// 提供通用诊断描述符的静态类
+///
+public static class CommonDiagnostics
+{
+ ///
+ /// 定义类必须为partial的诊断描述符
+ ///
+ ///
+ /// 诊断ID: GF001
+ /// 诊断消息: "Class '{0}' must be declared partial for code generation"
+ /// 分类: GFramework.Common
+ /// 严重性: Error
+ /// 是否启用: true
+ ///
+ public static readonly DiagnosticDescriptor ClassMustBePartial =
+ new(
+ "GF_Common_Class_001",
+ "Class must be partial",
+ "Class '{0}' must be declared partial for code generation",
+ "GFramework.Common",
+ DiagnosticSeverity.Error,
+ true
+ );
+}
\ No newline at end of file
diff --git a/GFramework.Godot.SourceGenerators/logging/GodotLoggerDiagnostic.cs b/GFramework.Godot.SourceGenerators/diagnostics/GodotLoggerDiagnostic.cs
similarity index 93%
rename from GFramework.Godot.SourceGenerators/logging/GodotLoggerDiagnostic.cs
rename to GFramework.Godot.SourceGenerators/diagnostics/GodotLoggerDiagnostic.cs
index 740b285..77608b6 100644
--- a/GFramework.Godot.SourceGenerators/logging/GodotLoggerDiagnostic.cs
+++ b/GFramework.Godot.SourceGenerators/diagnostics/GodotLoggerDiagnostic.cs
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
-namespace GFramework.Godot.SourceGenerators.logging;
+namespace GFramework.Godot.SourceGenerators.diagnostics;
///
/// 提供诊断描述符的静态类,用于GFramework日志生成器的编译时检查
diff --git a/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs b/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs
index 06e8cdc..7ce8b19 100644
--- a/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs
+++ b/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs
@@ -1,7 +1,7 @@
using System;
using System.Linq;
using System.Text;
-using GFramework.SourceGenerators.Common.diagnostics;
+using GFramework.Godot.SourceGenerators.diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
diff --git a/GFramework.SourceGenerators.Common/AnalyzerReleases.Shipped.md b/GFramework.SourceGenerators.Common/AnalyzerReleases.Shipped.md
deleted file mode 100644
index 60b59dd..0000000
--- a/GFramework.SourceGenerators.Common/AnalyzerReleases.Shipped.md
+++ /dev/null
@@ -1,3 +0,0 @@
-; Shipped analyzer releases
-; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
-
diff --git a/GFramework.SourceGenerators.Common/AnalyzerReleases.Unshipped.md b/GFramework.SourceGenerators.Common/AnalyzerReleases.Unshipped.md
deleted file mode 100644
index 4586830..0000000
--- a/GFramework.SourceGenerators.Common/AnalyzerReleases.Unshipped.md
+++ /dev/null
@@ -1,8 +0,0 @@
-; Unshipped analyzer release
-; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
-
-### New Rules
-
- Rule ID | Category | Severity | Notes
----------|-------------------|----------|-------------------
- GFC001 | GFramework.Common | Error | CommonDiagnostics
\ No newline at end of file
diff --git a/GFramework.SourceGenerators.Common/Directory.Build.props b/GFramework.SourceGenerators.Common/Directory.Build.props
deleted file mode 100644
index 016f796..0000000
--- a/GFramework.SourceGenerators.Common/Directory.Build.props
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- netstandard2.0
- true
- true
-
- preview
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
-
diff --git a/GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj b/GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj
deleted file mode 100644
index a1c3b5b..0000000
--- a/GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- false
- true
- T:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/GFramework.SourceGenerators/AnalyzerReleases.Unshipped.md b/GFramework.SourceGenerators/AnalyzerReleases.Unshipped.md
index db19379..9ceb908 100644
--- a/GFramework.SourceGenerators/AnalyzerReleases.Unshipped.md
+++ b/GFramework.SourceGenerators/AnalyzerReleases.Unshipped.md
@@ -3,7 +3,8 @@
### New Rules
- Rule ID | Category | Severity | Notes
-----------------|----------------------------------|----------|------------------------
- GF_Logging_001 | GFramework.Godot.Logging | Warning | LoggerDiagnostics
- GF_Rule_001 | GFramework.SourceGenerators.rule | Error | ContextAwareDiagnostic
\ No newline at end of file
+ Rule ID | Category | Severity | Notes
+---------------------|----------------------------------|----------|------------------------
+ GF_Common_Class_001 | GFramework.Common | Error | CommonDiagnostics
+ GF_Logging_001 | GFramework.Godot.Logging | Warning | LoggerDiagnostics
+ GF_Rule_001 | GFramework.SourceGenerators.rule | Error | ContextAwareDiagnostic
\ No newline at end of file
diff --git a/GFramework.SourceGenerators/GFramework.SourceGenerators.csproj b/GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
index 4b376fe..a71a78a 100644
--- a/GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
+++ b/GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
@@ -28,7 +28,6 @@
-
@@ -45,16 +44,10 @@
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
-
-
-
diff --git a/GFramework.SourceGenerators.Common/diagnostics/CommonDiagnostics.cs b/GFramework.SourceGenerators/diagnostics/CommonDiagnostics.cs
similarity index 89%
rename from GFramework.SourceGenerators.Common/diagnostics/CommonDiagnostics.cs
rename to GFramework.SourceGenerators/diagnostics/CommonDiagnostics.cs
index 9c0cadc..1bd575d 100644
--- a/GFramework.SourceGenerators.Common/diagnostics/CommonDiagnostics.cs
+++ b/GFramework.SourceGenerators/diagnostics/CommonDiagnostics.cs
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
-namespace GFramework.SourceGenerators.Common.diagnostics;
+namespace GFramework.SourceGenerators.diagnostics;
///
/// 提供通用诊断描述符的静态类
@@ -19,7 +19,7 @@ public static class CommonDiagnostics
///
public static readonly DiagnosticDescriptor ClassMustBePartial =
new(
- "GFC001",
+ "GF_Common_Class_001",
"Class must be partial",
"Class '{0}' must be declared partial for code generation",
"GFramework.Common",
diff --git a/GFramework.SourceGenerators/rule/ContextAwareDiagnostic.cs b/GFramework.SourceGenerators/diagnostics/ContextAwareDiagnostic.cs
similarity index 94%
rename from GFramework.SourceGenerators/rule/ContextAwareDiagnostic.cs
rename to GFramework.SourceGenerators/diagnostics/ContextAwareDiagnostic.cs
index fcf58ff..ba4a00d 100644
--- a/GFramework.SourceGenerators/rule/ContextAwareDiagnostic.cs
+++ b/GFramework.SourceGenerators/diagnostics/ContextAwareDiagnostic.cs
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
-namespace GFramework.SourceGenerators.rule;
+namespace GFramework.SourceGenerators.diagnostics;
///
/// 提供与上下文感知相关的诊断规则定义
diff --git a/GFramework.SourceGenerators/logging/LoggerDiagnostic.cs b/GFramework.SourceGenerators/diagnostics/LoggerDiagnostic.cs
similarity index 92%
rename from GFramework.SourceGenerators/logging/LoggerDiagnostic.cs
rename to GFramework.SourceGenerators/diagnostics/LoggerDiagnostic.cs
index 743ddc9..27b5cf0 100644
--- a/GFramework.SourceGenerators/logging/LoggerDiagnostic.cs
+++ b/GFramework.SourceGenerators/diagnostics/LoggerDiagnostic.cs
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
-namespace GFramework.SourceGenerators.logging;
+namespace GFramework.SourceGenerators.diagnostics;
///
/// 提供诊断描述符的静态类,用于GFramework日志生成器的编译时检查
diff --git a/GFramework.SourceGenerators/logging/LoggerGenerator.cs b/GFramework.SourceGenerators/logging/LoggerGenerator.cs
index a6d0ba1..fa2b3bf 100644
--- a/GFramework.SourceGenerators/logging/LoggerGenerator.cs
+++ b/GFramework.SourceGenerators/logging/LoggerGenerator.cs
@@ -1,7 +1,7 @@
using System;
using System.Linq;
using System.Text;
-using GFramework.SourceGenerators.Common.diagnostics;
+using GFramework.SourceGenerators.diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
diff --git a/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs b/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs
index 56655ad..942e58e 100644
--- a/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs
+++ b/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs
@@ -1,6 +1,6 @@
using System.Linq;
using System.Text;
-using GFramework.SourceGenerators.Common.diagnostics;
+using GFramework.SourceGenerators.diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
diff --git a/GFramework.csproj b/GFramework.csproj
index bbdeb31..7f09c1d 100644
--- a/GFramework.csproj
+++ b/GFramework.csproj
@@ -43,6 +43,7 @@
+
diff --git a/GFramework.sln b/GFramework.sln
index ca953de..a7b836a 100644
--- a/GFramework.sln
+++ b/GFramework.sln
@@ -16,8 +16,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Godot.SourceGene
EndProject
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
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators.Common", "GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj", "{3DB57A3A-ACCF-47BE-A17B-2ADD68B6C8AA}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.SourceGenerators.Tests", "GFramework.SourceGenerators.Tests\GFramework.SourceGenerators.Tests.csproj", "{BB047F43-6AA0-4EA0-8AE9-E6B9784D9E8E}"
EndProject
Global
@@ -58,10 +56,6 @@ Global
{3A1132B7-EC3B-4BB6-A752-8ADC92BC08A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A1132B7-EC3B-4BB6-A752-8ADC92BC08A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A1132B7-EC3B-4BB6-A752-8ADC92BC08A0}.Release|Any CPU.Build.0 = Release|Any CPU
- {3DB57A3A-ACCF-47BE-A17B-2ADD68B6C8AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3DB57A3A-ACCF-47BE-A17B-2ADD68B6C8AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3DB57A3A-ACCF-47BE-A17B-2ADD68B6C8AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3DB57A3A-ACCF-47BE-A17B-2ADD68B6C8AA}.Release|Any CPU.Build.0 = Release|Any CPU
{BB047F43-6AA0-4EA0-8AE9-E6B9784D9E8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB047F43-6AA0-4EA0-8AE9-E6B9784D9E8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB047F43-6AA0-4EA0-8AE9-E6B9784D9E8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/README.md b/README.md
index aa10597..f728396 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,102 @@
-# 项目介绍
+# GFramework
-本项目参考(CV)自[QFramework](https://github.com/liangxiegame/QFramework)
+A comprehensive C# game development framework designed for Godot and general game development scenarios.
-# 为什么要有这个项目
+## Features
-- 原来的项目是单文件框架,我把框架拆成多个文件,方便管理
-- 纯粹个人自用,要使用还是请访问[QFramework](https://github.com/liangxiegame/QFramework)
-- 至于修改名字,是因为我为了方便会发布GuGet包,假设将来QFramework也要发布GuGet包,那么就会冲突了
\ No newline at end of file
+### Core Architecture
+
+- **Dependency Injection**: Built-in IoC container for managing object lifecycles
+- **Event System**: Type-safe event system for loose coupling
+- **Property Binding**: Bindable properties for reactive programming
+- **Logging Framework**: Structured logging with multiple log levels
+
+### Game Development Features
+
+- **Asset Management**: Centralized asset catalog system
+- **Resource Factory**: Factory pattern for resource creation
+- **Architecture Pattern**: Clean architecture with separation of concerns
+
+### Godot Integration
+
+- **Godot-Specific Extensions**: Extensions and utilities for Godot development
+- **Node Extensions**: Helpful extensions for Godot Node classes
+- **Godot Logger**: Specialized logging system for Godot applications
+
+## Projects
+
+### Core Projects
+
+- **GFramework.Core**: Core framework functionality
+- **GFramework.Game**: Game-specific abstractions and systems
+- **GFramework.Godot**: Godot-specific implementations
+
+### Source Generators
+
+- **GFramework.SourceGenerators**: Code generators for automatic code generation
+- **GFramework.Godot.SourceGenerators**: Godot-specific code generators
+- **GFramework.SourceGenerators.Abstractions**: Abstractions for source generators
+- **GFramework.Godot.SourceGenerators.Abstractions**: Godot-specific abstractions
+
+## Getting Started
+
+### Installation
+
+1. Install the NuGet packages:
+
+```bash
+dotnet add package GeWuYou.GFramework.Core
+dotnet add package GeWuYou.GFramework.Game
+dotnet add package GeWuYou.GFramework.Godot
+```
+
+### Basic Usage
+
+```csharp
+// Create an architecture instance
+var architecture = new MyArchitecture();
+
+// Initialize the architecture
+await architecture.InitializeAsync();
+
+// Access services
+var service = architecture.Container.Resolve();
+```
+
+### Godot Integration
+
+```csharp
+// Use Godot-specific features
+[GodotLog]
+public partial class MyGodotNode : Node
+{
+ // Auto-generated logger will be available
+ private readonly ILogger _log = Log.GetLogger("MyGodotNode");
+
+ public override void _Ready()
+ {
+ _log.Info("Node is ready!");
+ }
+}
+```
+
+## Architecture
+
+The framework follows clean architecture principles with the following layers:
+
+1. **Core Layer**: Fundamental abstractions and interfaces
+2. **Application Layer**: Use cases and application services
+3. **Infrastructure Layer**: External dependencies and implementations
+4. **Presentation Layer**: UI and user interaction components
+
+## License
+
+This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
+
+## Contributing
+
+Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
+
+## Support
+
+For support and questions, please open an issue in the repository.
\ No newline at end of file