Skip to content

refactor(generators): 将源代码生成器项目目标框架降级至 netstandard2.0#126

Merged
GeWuYou merged 3 commits into
mainfrom
refactor/generators-downgrade-to-netstandard20
Mar 21, 2026
Merged

refactor(generators): 将源代码生成器项目目标框架降级至 netstandard2.0#126
GeWuYou merged 3 commits into
mainfrom
refactor/generators-downgrade-to-netstandard20

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Mar 21, 2026

Copy link
Copy Markdown
Owner
  • 将 GFramework.Godot.SourceGenerators 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
  • 将 GFramework.SourceGenerators.Abstractions 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
  • 将 GFramework.SourceGenerators 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
  • 将 GFramework.SourceGenerators.Common 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
  • 从 GFramework.SourceGenerators 项目中移除对 GFramework.Core.Abstractions 的引用
  • 从 GFramework.SourceGenerators.Abstractions 项目中移除对 GFramework.Core.Abstractions 的引用
  • 更新 PriorityGenerator 中的语法检查逻辑,使用 Any 替代 All 进行 partial 关键字检查
  • 更新 PriorityAttribute 文档注释中的 cref 格式为 c 标签

Summary by Sourcery

将源代码生成器项目降级到 .NET Standard 2.0,并调整相关引用和优先级处理逻辑。

增强内容:

  • 通过将 partial 关键字检查更新为基于存在性的条件,放宽 PriorityGenerator 中的语法验证。
  • PriorityAttribute 的 XML 文档中的 cref 用法替换为代码格式引用,以使说明更清晰。

构建:

  • 将所有源代码生成器项目(包括 Godot 和公共抽象层)的目标框架从 netstandard2.1 更改为 netstandard2.0
  • 从相关的源代码生成器项目中移除对 GFramework.Core.Abstractions 的项目引用,以与降级后的目标框架保持一致。
Original summary in English

Summary by Sourcery

Downgrade source generator projects to .NET Standard 2.0 and adjust related references and priority handling logic.

Enhancements:

  • Relax the syntax validation in PriorityGenerator by updating the partial keyword check to use an existence-based condition.
  • Clarify PriorityAttribute XML documentation by switching cref usage to a code-formatted reference.

Build:

  • Change the target framework of all source generator projects (including Godot and common abstractions) from netstandard2.1 to netstandard2.0.
  • Remove project references to GFramework.Core.Abstractions from the relevant source generator projects to align with the downgraded target framework.

- 将 GFramework.Godot.SourceGenerators 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 将 GFramework.SourceGenerators.Abstractions 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 将 GFramework.SourceGenerators 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 将 GFramework.SourceGenerators.Common 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 从 GFramework.SourceGenerators 项目中移除对 GFramework.Core.Abstractions 的引用
- 从 GFramework.SourceGenerators.Abstractions 项目中移除对 GFramework.Core.Abstractions 的引用
- 更新 PriorityGenerator 中的语法检查逻辑,使用 Any 替代 All 进行 partial 关键字检查
- 更新 PriorityAttribute 文档注释中的 cref 格式为 c 标签
@deepsource-io

deepsource-io Bot commented Mar 21, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 63a6c2e...a42ec0c on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Mar 21, 2026 1:32p.m. Review ↗
Secrets Mar 21, 2026 1:32p.m. Review ↗

@sourcery-ai

sourcery-ai Bot commented Mar 21, 2026

Copy link
Copy Markdown
审阅者指南(在较小 PR 上折叠)

审阅者指南

重构源生成器项目,使其以 netstandard2.0 为目标以获得更广泛的兼容性;移除不必要的 Core.Abstractions 引用;调整 PriorityGenerator 中的 partial 关键字校验逻辑;并更新 PriorityAttribute 的 XML 文档格式。

更新后的 PriorityGenerator 和 PriorityAttribute(类)的类图

classDiagram

  class PriorityAttribute {
    +PriorityAttribute()
    <<attribute>>
    +int Priority
  }

  class PriorityGenerator {
    +bool ValidateSymbol(context, syntax, typeSymbol)
  }

  class IPrioritized {
    <<interface>>
    +int Priority
  }

  PriorityAttribute ..> IPrioritized : documents_generated_impl_for
  PriorityGenerator ..> PriorityAttribute : validates_usage_of
Loading

按文件划分的变更

变更 详情 文件
将所有与源生成器相关的项目从 netstandard2.1 重新定位到 netstandard2.0。
  • 在源生成器项目的 Directory.Build.props 中更新目标框架
  • 在 GFramework.Godot.SourceGenerators.csproj 中更新目标框架
  • 在 GFramework.SourceGenerators.Abstractions.csproj 中更新目标框架
  • 在 GFramework.SourceGenerators.Common 项目配置中更新目标框架
  • 在 GFramework.SourceGenerators.csproj 中更新目标框架
GFramework.Godot.SourceGenerators.Abstractions/Directory.Build.props
GFramework.Godot.SourceGenerators/GFramework.Godot.SourceGenerators.csproj
GFramework.SourceGenerators.Abstractions/Directory.Build.props
GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj
GFramework.SourceGenerators.Common/Directory.Build.props
GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
移除源生成器项目对 GFramework.Core.Abstractions 的依赖,以将其与核心抽象解耦。
  • 从 GFramework.SourceGenerators 项目中移除对 GFramework.Core.Abstractions 的项目引用
  • 从 GFramework.SourceGenerators.Abstractions 项目中移除对 GFramework.Core.Abstractions 的项目引用
GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj
修复 PriorityGenerator 中 partial 关键字的校验逻辑,以正确要求类型必须是 partial 的。
  • 在验证是否存在 partial 关键字时,将基于 All 的检查替换为基于 Any 的语法修饰符检查
  • 在缺少 partial 修饰符时保留诊断报告
GFramework.SourceGenerators/Bases/PriorityGenerator.cs
规范 PriorityAttribute 的 XML 文档格式,以避免跨程序集对 Core.Abstractions 的 cref 引用。
  • 在 PriorityAttribute 的摘要注释中,将 <see cref="..."/> 引用更改为普通的 <c>...</c> 代码引用
  • 在摘要句子末尾添加句号以保持一致性
GFramework.SourceGenerators.Abstractions/Bases/PriorityAttribute.cs

技巧和命令

与 Sourcery 交互

  • 触发新的审阅: 在 Pull Request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub Issue: 在审阅评论下回复,要求 Sourcery 从该评论创建一个 issue。你也可以直接回复审阅评论 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题的任意位置写上 @sourcery-ai 以随时生成标题。你也可以在 Pull Request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 Pull Request 摘要: 在 Pull Request 正文的任意位置写上 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在 Pull Request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在 Pull Request 中评论 @sourcery-ai guide,即可随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 Pull Request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 取消所有 Sourcery 审阅: 在 Pull Request 中评论 @sourcery-ai dismiss,即可取消所有现有的 Sourcery 审阅。如果你想从头开始一次新的审阅,这尤其有用——别忘了再评论 @sourcery-ai review 来触发新的审阅!

自定义你的使用体验

前往你的 控制面板 以:

  • 启用或禁用诸如 Sourcery 生成的 Pull Request 摘要、审阅者指南等审阅功能。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the source generator projects to target netstandard2.0 for broader compatibility, removes unnecessary Core.Abstractions references, adjusts the partial keyword validation logic in PriorityGenerator, and updates XML documentation formatting for PriorityAttribute.

Class diagram for updated PriorityGenerator and PriorityAttribute (class)

classDiagram

  class PriorityAttribute {
    +PriorityAttribute()
    <<attribute>>
    +int Priority
  }

  class PriorityGenerator {
    +bool ValidateSymbol(context, syntax, typeSymbol)
  }

  class IPrioritized {
    <<interface>>
    +int Priority
  }

  PriorityAttribute ..> IPrioritized : documents_generated_impl_for
  PriorityGenerator ..> PriorityAttribute : validates_usage_of
Loading

File-Level Changes

Change Details Files
Retarget all source generator-related projects from netstandard2.1 to netstandard2.0.
  • Update target framework in Directory.Build.props for source generator projects
  • Update target framework in GFramework.Godot.SourceGenerators.csproj
  • Update target framework in GFramework.SourceGenerators.Abstractions.csproj
  • Update target framework in GFramework.SourceGenerators.Common project configuration
  • Update target framework in GFramework.SourceGenerators.csproj
GFramework.Godot.SourceGenerators.Abstractions/Directory.Build.props
GFramework.Godot.SourceGenerators/GFramework.Godot.SourceGenerators.csproj
GFramework.SourceGenerators.Abstractions/Directory.Build.props
GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj
GFramework.SourceGenerators.Common/Directory.Build.props
GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
Remove dependencies on GFramework.Core.Abstractions from source generator projects to decouple them from core abstractions.
  • Remove project reference to GFramework.Core.Abstractions from GFramework.SourceGenerators project
  • Remove project reference to GFramework.Core.Abstractions from GFramework.SourceGenerators.Abstractions project
GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj
Fix partial keyword validation logic in PriorityGenerator to correctly require partial types.
  • Replace All-based check with Any-based check on syntax modifiers when validating the presence of the partial keyword
  • Preserve diagnostic reporting when the partial modifier is missing
GFramework.SourceGenerators/Bases/PriorityGenerator.cs
Normalize XML documentation formatting for PriorityAttribute to avoid cross-assembly cref to Core.Abstractions.
  • Change reference to a plain ... code reference in PriorityAttribute summary comment
  • Add trailing period in the summary sentence for consistency
GFramework.SourceGenerators.Abstractions/Bases/PriorityAttribute.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Comment thread GFramework.SourceGenerators/Bases/PriorityGenerator.cs Outdated

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我已经审核了你的更改,一切看起来都很棒!


Sourcery 对开源项目是免费的——如果你觉得我们的代码审查有帮助,请考虑分享给更多人 ✨
帮我变得更有用吧!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

GeWuYou added 2 commits March 21, 2026 21:30
- 为 GFramework.Godot 项目添加 GodotProjectDir 属性默认值
- 在 GFramework 元包中添加 NoPackageAnalysis 属性配置
- 为不同 .NET 版本添加占位符文件到包输出中
- 确保源代码生成器在标准 SDK 构建中正常运行
- 将语法节点的部分关键字检查从 Any 操作改为 All 操作
- 修正了对非部分类的诊断报告条件判断
- 确保只有当所有修饰符都不是部分关键字时才报告错误
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant