Aetheria/Directory.Build.targets
Meta Vens ee32cd4571 Scope the CultLib pin guard to projects that reference CultMath
Directory.Build.targets is imported by Unity's generated root csprojs too,
which take CultMath from the UPM DLL, so IDE builds of Assembly-CSharp broke
whenever the sibling CultLib was dirty, elsewhere, or missing. The guard now
runs only when a ProjectReference names the CultMath project under
CultLibRoot: Aetheria.Shared directly, AetherDb through the SDK's
transitive project references.

Checked: Assembly-CSharp skips the target; Aetheria.Shared still fails on a
wrong CultLibRevision, on CULTLIB_ROOT pointing at a scratch clone on another
commit, and AetherDb fails on that clone made dirty.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 18:00:11 +02:00

22 lines
1.5 KiB
XML

<Project>
<Target Name="VerifyCultLibRevision"
BeforeTargets="ResolveProjectReferences"
Condition="'$(SkipCultLibRevisionCheck)' != 'true' and '@(ProjectReference->AnyHaveMetadataValue('Identity', '$(CultLibRoot)\packages\cultmath\src\CultMath\CultMath.csproj'))' == 'true'">
<Error Condition="!Exists('$(CultLibRoot)\packages\cultmath\src\CultMath\CultMath.csproj')"
Text="CultLibRoot '$(CultLibRoot)' does not contain the required CultMath project." />
<Exec Command="&quot;$(GitExecutable)&quot; -C &quot;$(CultLibRoot)&quot; rev-parse HEAD"
ConsoleToMSBuild="true"
StandardOutputImportance="Low">
<Output TaskParameter="ConsoleOutput" PropertyName="ActualCultLibRevision" />
</Exec>
<Error Condition="'$([System.String]::Copy($(ActualCultLibRevision)).Trim())' != '$(CultLibRevision)'"
Text="CultLib must be revision $(CultLibRevision); found $([System.String]::Copy($(ActualCultLibRevision)).Trim()). Set CultLibRoot to the admitted clean worktree." />
<Exec Command="&quot;$(GitExecutable)&quot; -C &quot;$(CultLibRoot)&quot; status --porcelain --untracked-files=normal"
ConsoleToMSBuild="true"
StandardOutputImportance="Low">
<Output TaskParameter="ConsoleOutput" PropertyName="CultLibStatus" />
</Exec>
<Error Condition="'$([System.String]::Copy($(CultLibStatus)).Trim())' != ''"
Text="CultLibRoot must be clean before Aetheria consumes it." />
</Target>
</Project>