cultlib byte gate: CultMath source checks out CRLF everywhere, and the build refuses a tree without .git
Soul s2 found the CultMath bytes follow the checkout's line endings (an LF clone built 53084D94, not the tracked 6781BF20) and its path when no .git maps the root to /_/. .gitattributes pins packages/cultmath/src/** to eol=crlf, which the tracked DLL was built from, so no re-release. The build script refuses up front without .git, and the refusal and docs name line endings beside source and toolchain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
942e4033b2
commit
303476db6c
3 changed files with 30 additions and 7 deletions
9
.gitattributes
vendored
9
.gitattributes
vendored
|
|
@ -29,3 +29,12 @@ packages/cultmesh-ts/native/**/*.so.* binary
|
|||
# ends in `\r`) while CI, checking out on Linux, stays green.
|
||||
packages/cultmesh-ts/native/SHA256SUMS text eol=lf
|
||||
packages/cultmesh-ts/native/MANIFEST.txt text eol=lf
|
||||
|
||||
# CultMath source keeps CRLF in the working tree on every checkout. The release
|
||||
# gate compares the CultMath.dll it builds with the one org.gamecult.cultmath
|
||||
# tracks, byte for byte, and the bytes follow the checkout's line endings: the
|
||||
# pdb's document checksums feed the DLL's pdb id, timestamp and MVID. The
|
||||
# tracked DLL was built from CRLF source, so CRLF here keeps it valid, and an
|
||||
# LF-configured or Linux clone builds the same bytes as a Windows one. The index
|
||||
# stays LF; only the checkout changes.
|
||||
packages/cultmath/src/** text eol=crlf
|
||||
|
|
|
|||
|
|
@ -301,9 +301,16 @@ CultMath package's version and every `CultMath.dll` it built equals the one
|
|||
that package tracks, byte for byte. Any CultMath source change therefore means:
|
||||
release `org.gamecult.cultmath`, declare its new version in
|
||||
`org.gamecult.cultlib`, then release `org.gamecult.cultlib`. The bytes also
|
||||
depend on the .NET SDK and host, which no `global.json` pins, so the same
|
||||
refusal at unchanged CultMath source means this toolchain differs from the one
|
||||
that built the tracked DLL.
|
||||
depend on the checkout and the toolchain. `.gitattributes` pins CultMath
|
||||
source to CRLF on every checkout, because the tracked DLL was built from CRLF
|
||||
source and line endings reach the DLL through the pdb's document checksums; a
|
||||
clone checked out before that rule may still hold LF files (`git ls-files
|
||||
--eol packages/cultmath/src` shows `w/lf`) until they are checked out again.
|
||||
The build needs a git checkout, and refuses up front without `.git`: the repo
|
||||
root maps to `/_/` through git, so an archive or source zip would write its
|
||||
own path into the DLL. No `global.json` pins the .NET SDK, so the same refusal
|
||||
at unchanged source and CRLF checkout means this SDK or host differs from the
|
||||
one that built the tracked DLL.
|
||||
|
||||
### Coverage gaps
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@ param(
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
# The CultMath byte gate below needs a git checkout: ContinuousIntegrationBuild maps the repo root to /_/
|
||||
# through the SDK's git source root, so in a tree without .git (git archive, a source zip) the DLL names
|
||||
# the absolute obj path and its bytes change with the directory.
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $repoRoot ".git"))) {
|
||||
throw "$repoRoot has no .git, so CultMath.dll would carry this directory's path and fail the CultMath byte gate. Build from a git clone, not an archive or source zip."
|
||||
}
|
||||
$templateRoot = Join-Path $repoRoot "unity\org.gamecult.cultlib"
|
||||
# Every managed publish the package is assembled from, in the order $publishedByName fills (last wins).
|
||||
# This list is the one owner of publish-root identity: the clean step, the publish loop, the assembly
|
||||
|
|
@ -42,9 +48,10 @@ $unityPackageVersion = (Get-Content -LiteralPath (Join-Path $templateRoot "packa
|
|||
# (1) The declared dependency version must equal the CultMath package's own version. Checked here,
|
||||
# before anything is built.
|
||||
# (2) Every CultMath.dll the publishes below produce must equal, byte for byte, the one that package
|
||||
# tracks. Checked once they exist. The builds are deterministic for one toolchain, so a mismatch
|
||||
# means the CultMath source changed since that package was released, or this SDK, compiler or host
|
||||
# builds different bytes from the one that built the tracked DLL (no global.json pins the SDK).
|
||||
# tracks. Checked once they exist. The builds are deterministic for one toolchain and checkout, so a
|
||||
# mismatch means the CultMath source changed since that package was released, its checkout's line
|
||||
# endings differ from the CRLF that .gitattributes pins, or this SDK, compiler or host builds
|
||||
# different bytes from the one that built the tracked DLL (no global.json pins the SDK).
|
||||
$cultMathPackageRoot = Join-Path $repoRoot "packages\cultmath\unity\org.gamecult.cultmath"
|
||||
$cultMathDeclared = (Get-Content -LiteralPath (Join-Path $templateRoot "package.json") -Raw | ConvertFrom-Json).dependencies.'org.gamecult.cultmath'
|
||||
$cultMathAvailable = (Get-Content -LiteralPath (Join-Path $cultMathPackageRoot "package.json") -Raw | ConvertFrom-Json).version
|
||||
|
|
@ -92,7 +99,7 @@ foreach ($publish in $managedPublishes) {
|
|||
$builtCultMath = Join-Path $publish.Root "CultMath.dll"
|
||||
if (-not (Test-Path -LiteralPath $builtCultMath)) { continue }
|
||||
if ((Get-FileHash -LiteralPath $builtCultMath -Algorithm SHA256).Hash -ne $cultMathTrackedHash) {
|
||||
throw "Release order: the CultMath.dll built into $($publish.Root) differs from the one org.gamecult.cultmath $cultMathAvailable tracks. Either CultMath source changed since that release, or this toolchain builds different bytes from the one that built the tracked DLL. Check first: git log cultmath-unity-v$cultMathAvailable.. -- packages/cultmath/src for a source change, then dotnet --version and the host against the build that produced the tracked DLL. A source change means release CultMath first, then declare its version; a toolchain difference means build with the toolchain that produced the tracked DLL."
|
||||
throw "Release order: the CultMath.dll built into $($publish.Root) differs from the one org.gamecult.cultmath $cultMathAvailable tracks. Either CultMath source changed since that release, its checkout has other line endings, or this toolchain builds different bytes from the one that built the tracked DLL. Check first: git log cultmath-unity-v$cultMathAvailable.. -- packages/cultmath/src for a source change; git ls-files --eol packages/cultmath/src, where every file must read w/crlf (.gitattributes pins it; a clone checked out before that rule needs the files checked out again); then dotnet --version and the host against the build that produced the tracked DLL. A source change means release CultMath first, then declare its version; a toolchain difference means build with the toolchain that produced the tracked DLL."
|
||||
}
|
||||
$cultMathComparedRoots += $publish.Root
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue