mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
54 lines
3.1 KiB
XML
54 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!--
|
||
Copyright (c) 2025-2026 GeWuYou
|
||
SPDX-License-Identifier: Apache-2.0
|
||
-->
|
||
|
||
<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 -->
|
||
|
||
<PropertyGroup>
|
||
<!--
|
||
默认收集消费者项目根目录下的 project.godot,
|
||
让 Godot 项目元数据生成能力在常规 Godot C# 工程里开箱即用。
|
||
-->
|
||
<GFrameworkGodotProjectFile Condition="'$(GFrameworkGodotProjectFile)' == ''">project.godot</GFrameworkGodotProjectFile>
|
||
<!--
|
||
当前生成器按文件名识别 project.godot,因此允许调整相对路径,
|
||
但不支持把目标文件重命名为其他文件名。
|
||
-->
|
||
<_GFrameworkGodotProjectFileName>$([System.IO.Path]::GetFileName('$(GFrameworkGodotProjectFile)'))</_GFrameworkGodotProjectFileName>
|
||
<_GFrameworkGodotProjectFileNameLower>$([System.String]::Copy('$(_GFrameworkGodotProjectFileName)').ToLowerInvariant())</_GFrameworkGodotProjectFileNameLower>
|
||
</PropertyGroup>
|
||
|
||
<ItemGroup>
|
||
<!--
|
||
仅在 NuGet 打包布局存在时自动注入 analyzer。
|
||
仓库内项目引用场景会通过 ProjectReference(OutputItemType=Analyzer) 提供生成器,
|
||
因此这里需要避免对不存在的打包路径做无效引用。
|
||
-->
|
||
<Analyzer Include="$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.Godot.SourceGenerators.dll"
|
||
Condition="Exists('$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.Godot.SourceGenerators.dll')"/>
|
||
<Analyzer Include="$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.Godot.SourceGenerators.Abstractions.dll"
|
||
Condition="Exists('$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.Godot.SourceGenerators.Abstractions.dll')"/>
|
||
<Analyzer Include="$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.SourceGenerators.Common.dll"
|
||
Condition="Exists('$(MSBuildThisFileDirectory)../analyzers/dotnet/cs/GFramework.SourceGenerators.Common.dll')"/>
|
||
</ItemGroup>
|
||
|
||
<ItemGroup Condition="Exists('$(MSBuildProjectDirectory)/$(GFrameworkGodotProjectFile)')">
|
||
<AdditionalFiles Include="$(MSBuildProjectDirectory)/$(GFrameworkGodotProjectFile)"/>
|
||
</ItemGroup>
|
||
|
||
<Target Name="ValidateGFrameworkGodotProjectFileName"
|
||
BeforeTargets="CoreCompile"
|
||
Condition="Exists('$(MSBuildProjectDirectory)/$(GFrameworkGodotProjectFile)') and '$(_GFrameworkGodotProjectFileNameLower)' != 'project.godot'">
|
||
<Warning Text="GFrameworkGodotProjectFile can change the relative path, but the file name must remain 'project.godot'; otherwise GodotProjectMetadataGenerator will ignore the file."/>
|
||
</Target>
|
||
|
||
<!-- Ensure the analyzers are loaded -->
|
||
<Target Name="EnsureGFrameworkGodotAnalyzers" BeforeTargets="CoreCompile">
|
||
<Message Text="Loading GFramework.Godot source generators" Importance="high"/>
|
||
</Target>
|
||
</Project>
|