mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
chore(build): 调整项目打包配置以支持Source Generator
- 移除不再需要的RepositoryType属性 - 添加IncludeBuildOutput属性以控制构建输出 - 更新项目引用方式,将Source Generator作为Analyzer引入 - 配置打包目标,将Source Generator复制到nupkg的analyzers目录 - 优化项目排除逻辑,确保生成器相关文件不参与主项目编译 - 完善项目文件结构,提高可读性和维护性
This commit is contained in:
parent
92a171688e
commit
6046eee7fa
@ -13,7 +13,6 @@
|
|||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<PackageTags>game;framework</PackageTags>
|
<PackageTags>game;framework</PackageTags>
|
||||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
<IncludeSymbols>true</IncludeSymbols>
|
||||||
@ -21,32 +20,59 @@
|
|||||||
<RootNamespace>GFramework</RootNamespace>
|
<RootNamespace>GFramework</RootNamespace>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
|
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- 排除不需要参与打包/编译的目录 -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="README.md" Pack="true" PackagePath="" />
|
<None Include="README.md" Pack="true" PackagePath="" />
|
||||||
<None Remove="GFramework.Generator\**" />
|
<None Remove="GFramework.Generator\**" />
|
||||||
<None Remove="GFramework.Generator.Attributes\**" />
|
<None Remove="GFramework.Generator.Attributes\**" />
|
||||||
<None Remove="GFramework.Core\**" />
|
<None Remove="GFramework.Core\**" />
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="GFramework.Generator\**" />
|
<Compile Remove="GFramework.Generator\**" />
|
||||||
<Compile Remove="GFramework.Generator.Attributes\**" />
|
<Compile Remove="GFramework.Generator.Attributes\**" />
|
||||||
<Compile Remove="GFramework.Core\**" />
|
<Compile Remove="GFramework.Core\**" />
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Remove="GFramework.Generator\**" />
|
<EmbeddedResource Remove="GFramework.Generator\**" />
|
||||||
<EmbeddedResource Remove="GFramework.Generator.Attributes\**" />
|
<EmbeddedResource Remove="GFramework.Generator.Attributes\**" />
|
||||||
<EmbeddedResource Remove="GFramework.Core\**" />
|
<EmbeddedResource Remove="GFramework.Core\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- 引用 Source Generator -->
|
<!-- 作为 Analyzer 引入本地 SourceGenerator -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="GFramework.Generator\GFramework.Generator.csproj"/>
|
<ProjectReference Include="GFramework.Generator\GFramework.Generator.csproj"
|
||||||
|
OutputItemType="Analyzer"
|
||||||
|
ReferenceOutputAssembly="false" />
|
||||||
|
|
||||||
<ProjectReference Include="GFramework.Generator.Attributes\GFramework.Generator.Attributes.csproj"/>
|
<ProjectReference Include="GFramework.Generator.Attributes\GFramework.Generator.Attributes.csproj"/>
|
||||||
<ProjectReference Include="GFramework.Core\GFramework.Core.csproj"/>
|
<ProjectReference Include="GFramework.Core\GFramework.Core.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
<!-- 打包 Source Generator 到 nupkg 的 analyzers/ -->
|
||||||
|
<Target Name="BuildGeneratorAndPackAnalyzers" BeforeTargets="Pack">
|
||||||
|
<!-- 1. 构建 Source Generator 项目 -->
|
||||||
|
<MSBuild Projects="..\GFramework.Generator\GFramework.Generator.csproj"
|
||||||
|
Targets="Build"
|
||||||
|
Properties="Configuration=$(Configuration)" />
|
||||||
|
|
||||||
|
<!-- 2. 找到 Generator DLL -->
|
||||||
|
<ItemGroup>
|
||||||
|
<_GeneratorDll Include="..\GFramework.Generator\bin\$(Configuration)\netstandard2.0\GFramework.Generator.dll" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- 3. 复制到 obj/.../analyzers/netstandard2.0 -->
|
||||||
|
<MakeDir Directories="$(IntermediateOutputPath)analyzers\netstandard2.0" />
|
||||||
|
<Copy SourceFiles="@(_GeneratorDll)"
|
||||||
|
DestinationFolder="$(IntermediateOutputPath)analyzers\netstandard2.0"
|
||||||
|
SkipUnchangedFiles="true" />
|
||||||
|
|
||||||
|
<!-- 4. 标记为 nupkg 文件 -->
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="$(IntermediateOutputPath)analyzers\netstandard2.0\GFramework.Generator.dll"
|
||||||
|
Pack="true"
|
||||||
|
PackagePath="analyzers/netstandard2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user