Skip to content

Commit

Permalink
MSBuild project dependency black magic
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberboss committed Sep 9, 2024
1 parent 80c7def commit 371a758
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,23 @@

<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Client\Tgstation.Server.Client.csproj" />
<ProjectReference Include="..\Tgstation.Server.Host\Tgstation.Server.Host.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>

<!-- https://github.com/dotnet/msbuild/issues/2661#issuecomment-338808147 -->
<Target Name="WorkaroundSdk939" BeforeTargets="ImportGraphQLApiSchema">
<MSBuild Projects="..\Tgstation.Server.Host\Tgstation.Server.Host.csproj" />
</Target>

<Target Name="DeleteGeneratedFiles" BeforeTargets="ImportGraphQLApiSchema">
<RemoveDir Directories="$(IntermediateOutputPath)berry" />
</Target>

<Target Name="ImportGraphQLApiSchema" BeforeTargets="BeforeBuild" Inputs="../../artifacts/tgs-api.graphql" Outputs="schema.graphql">
<!-- https://github.com/ChilliCream/graphql-platform/blob/c0c8df525ca0f47bf3b3b409a8b22cbe37f7a9c0/src/StrawberryShake/MetaPackages/Common/MSBuild/StrawberryShake.targets#L20 -->
<Target Name="ImportGraphQLApiSchema" BeforeTargets="_GraphQLCodeGenerationRoot" Inputs="../../artifacts/tgs-api.graphql" Outputs="schema.graphql">
<Copy SkipUnchangedFiles="true" SourceFiles="../../artifacts/tgs-api.graphql" DestinationFiles="schema.graphql" />
</Target>

<Target Name="FixWarningsInGeneratedSchema" BeforeTargets="CoreCompile">
<Target Name="FixWarningsInGeneratedSchema" AfterTargets="GenerateGraphQLCode">
<PropertyGroup>
<InputFile>$(IntermediateOutputPath)berry/GraphQLClient.Client.cs</InputFile>
<OutputFile>$(IntermediateOutputPath)berry/GraphQLClient.Client.cs</OutputFile>
Expand Down

0 comments on commit 371a758

Please sign in to comment.