mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
build(generator): 添加源代码生成器的 MSBuild targets 配置文件
- 为 GFramework.Godot.SourceGenerators 创建 GeWuYou.GFramework.Godot.SourceGenerators.targets 文件 - 为 GFramework.SourceGenerators 创建 GeWuYou.GFramework.SourceGenerators.targets 文件 - 在项目中启用 EnforceExtendedAnalyzerRules 规则 - 修正项目引用路径配置 - 更新包打包配置以包含正确的 targets 文件 - 从 GFramework.csproj 中移除多余的 targets 文件排除配置
This commit is contained in:
parent
f3c5840ebe
commit
c5a11820bc
@ -14,6 +14,7 @@
|
||||
<!-- 可选:调试生成代码 -->
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
|
||||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Roslyn 依赖,只用于 Generator 自身 -->
|
||||
@ -27,7 +28,7 @@
|
||||
|
||||
<!-- Generator 编译期引用 Attributes / Common,但不打包 -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\GFramework.Godot.SourceGenerators.Abstractions\GFramework.Godot.SourceGenerators.Abstractions.csproj" PrivateAssets="all"/>
|
||||
<ProjectReference Include="..\GFramework.Godot.SourceGenerators.Abstractions\GFramework.Godot.SourceGenerators.Abstractions.csproj" PrivateAssets="all"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ★关键:只把 Generator DLL 放进 analyzers -->
|
||||
@ -48,6 +49,6 @@
|
||||
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.xml" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||
<!-- 包含targets文件 -->
|
||||
<None Include="GFramework.Godot.SourceGenerators.targets" Pack="true" PackagePath="build" Visible="false"/>
|
||||
<None Include="GeWuYou.GFramework.Godot.SourceGenerators.targets" Pack="true" PackagePath="build" Visible="false"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- This file is automatically generated by the NuGet package -->
|
||||
<!-- It ensures that the source generators are properly registered during build -->
|
||||
|
||||
<ItemGroup>
|
||||
<Analyzer Include="$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.Godot.SourceGenerators.dll"/>
|
||||
<Analyzer Include="$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.Godot.SourceGenerators.Abstractions.dll"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Ensure the analyzers are loaded -->
|
||||
<Target Name="EnsureGFrameworkGodotAnalyzers" BeforeTargets="CoreCompile">
|
||||
<Message Text="Loading GFramework.Godot source generators" Importance="high"/>
|
||||
</Target>
|
||||
</Project>
|
||||
@ -14,6 +14,7 @@
|
||||
<!-- 可选:调试生成代码 -->
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
|
||||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Roslyn 依赖,只用于 Generator 自身 -->
|
||||
@ -49,6 +50,6 @@
|
||||
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.xml" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
|
||||
<!-- 包含targets文件 -->
|
||||
<None Include="GFramework.SourceGenerators.targets" Pack="true" PackagePath="build" Visible="false"/>
|
||||
<None Include="GeWuYou.GFramework.SourceGenerators.targets" Pack="true" PackagePath="build" Visible="false"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- This file is automatically generated by the NuGet package -->
|
||||
<!-- It ensures that the source generators are properly registered during build -->
|
||||
|
||||
<ItemGroup>
|
||||
<Analyzer Include="$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.SourceGenerators.dll"/>
|
||||
<Analyzer Include="$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.SourceGenerators.Abstractions.dll"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Ensure the analyzers are loaded -->
|
||||
<Target Name="EnsureGFrameworkAnalyzers" BeforeTargets="CoreCompile">
|
||||
<Message Text="Loading GFramework source generators" Importance="high"/>
|
||||
</Target>
|
||||
</Project>
|
||||
@ -43,7 +43,6 @@
|
||||
<None Remove="GFramework.SourceGenerators.Tests\**"/>
|
||||
<None Remove="GFramework.Godot.SourceGenerators.Abstractions\**"/>
|
||||
<None Remove="GFramework.SourceGenerators.Abstractions\**"/>
|
||||
<None Remove="GFramework.Godot.SourceGenerators.targets"/>
|
||||
</ItemGroup>
|
||||
<!-- 聚合核心模块 -->
|
||||
<ItemGroup>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user