feat(build): every managed binary names FrameLedger and carries the native copyright line; versioninfo-check reads both kinds (beta.14 PR-6, D50) (#269)
Owner request 2026-10-05 ("Thêm Assembly metadata"); D50: company and product "FrameLedger", the copyright the
native FL_COPYRIGHT word for word.
Measured before the change, from the built binaries: FrameLedger.Agent.exe/.dll read Company and Product
"FrameLedger.Agent" and FileDescription "FrameLedger.Agent" (what Task Manager lists); each library its own assembly
name; every managed LegalCopyright was one space; the apphost's OriginalFilename is its assembly's (FrameLedger.dll).
tools/versioninfo-check.ps1 read the five native binaries and nothing else.
- Directory.Build.props: Company, Product, Authors, Copyright, Description (the native blocks' sentence, the Comments
field), RepositoryUrl (stamped as AssemblyMetadata by the SDK); the FrameLedgerSourceRef metadata moved here from the
App csproj, and release.yml passes the same ref to the Agent's publish.
- App: AssemblyTitle "FrameLedger" and a Description. Agent: AssemblyTitle "FrameLedger Agent" and a Description.
- versioninfo-check.ps1: the rules in one function over a block, a managed half (-ManagedDir, -ExpectedProductVersion -
required, -ManagedOnly), one LegalCopyright across every binary read, the apphost carrying its assembly's block,
Company as well as Product = FrameLedger, and -SelfTest: ten cases, nine RED, each for the reason it names (four
mutations of the rules each turn the self-test red). build.ps1 runs the self-test and both halves (the managed half
alone under -SkipNative); release.yml reads out/app with the tag's version.
- AssemblyIdentityTests (App, Agent): company, product, copyright = FL_COPYRIGHT parsed from CMakeLists.txt,
description, RepositoryUrl = IssueLink.Repository, and the Win32 block Explorer shows. Red on the source before.
Docs: 12_BUILD (Identity table, the gate, the publish lines), 13_CI_CD, 19_SAFETY, FORKING (what a fork changes),
CHANGELOG.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1f7aebd0a4
commit
d565760830
14 files changed
+491
-70
No files matched your search
@@ -154,7 +154,9 @@ jobs:
|
||||
$ref = if ('${{ steps.version.outputs.dry_run }}' -eq 'true') { '${{ github.sha }}' } else { "v$v" }
|
||||
dotnet publish src/FrameLedger.App -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:Version=$v -p:FrameLedgerSourceRef=$ref -o out/app
|
||||
if ($LASTEXITCODE -ne 0) { throw 'App publish failed' }
|
||||
dotnet publish src/FrameLedger.Agent -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:Version=$v -o out/app
|
||||
# beta.14 (D50): the same ref for the Agent - Directory.Build.props stamps it on every assembly, and both
|
||||
# publishes build the same libraries into this one folder.
|
||||
dotnet publish src/FrameLedger.Agent -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:Version=$v -p:FrameLedgerSourceRef=$ref -o out/app
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Agent publish failed' }
|
||||
|
||||
# A self-contained package redistributes the .NET runtime, and its licence and
|
||||
@@ -195,7 +197,8 @@ jobs:
|
||||
if ($missing.Count -gt 0) { throw "out/app is missing: $($missing -join ', ')" }
|
||||
if (Test-Path out/app/FrameLedger.CaptureHost.exe) { throw 'out/app contains the unshipped capture host (12_BUILD: exactly two roots)' }
|
||||
if (@(Get-ChildItem out/app/licenses/dotnet -File -ErrorAction SilentlyContinue).Count -lt 2) { throw 'out/app/licenses/dotnet holds fewer than two files -- the runtime licence step did not run' }
|
||||
./tools/versioninfo-check.ps1 -BuildDir out/app
|
||||
# beta.14 (D50): the managed half too - the eight managed binaries, carrying the tag's full version.
|
||||
./tools/versioninfo-check.ps1 -BuildDir out/app -ManagedDir out/app -ExpectedProductVersion '${{ steps.version.outputs.version }}'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'versioninfo-check over the published tree' }
|
||||
$size = (Get-ChildItem out/app -Recurse -File | Measure-Object Length -Sum).Sum / 1MB
|
||||
Write-Host ("published tree: {0:N0} MB" -f $size)
|
||||
|
||||
@@ -86,6 +86,12 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
- **Over a chart, the wheel scrolls the page; Ctrl+wheel zooms the chart.** ScottPlot zoomed on every wheel, which with
|
||||
the pages scrolling again would have zoomed the chart and scrolled the page at once. Dragging still pans and
|
||||
double-click still resets.
|
||||
- **FrameLedger's own programs say what they are.** In Explorer (*Properties ▸ Details*) `FrameLedger.exe` and
|
||||
`FrameLedger.Agent.exe` now name the product, the author's copyright and what each one does, as the native DLLs always
|
||||
have; Task Manager lists the background service as *FrameLedger Agent* rather than *FrameLedger.Agent*. Until this
|
||||
release the Agent called its company and product "FrameLedger.Agent" and no managed file carried a copyright. The
|
||||
release check now reads both kinds of file and fails when one of them does not name FrameLedger or carries a different
|
||||
copyright line.
|
||||
|
||||
## [0.1.0-beta.13] - 2026-10-04
|
||||
|
||||
|
||||
@@ -69,6 +69,32 @@
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- beta.14 (D50): every managed binary names the product and who wrote it, as the native ones always have
|
||||
(19_SAFETY: a binary says plainly what it is). Explorer's Properties > Details and Task Manager read these. Until
|
||||
beta.14 the SDK's defaults stood: the Agent's Company and Product read "FrameLedger.Agent", each library's its own
|
||||
assembly name, and no managed binary carried a copyright. The copyright is the native FL_COPYRIGHT
|
||||
(src/native/CMakeLists.txt) word for word: tools/versioninfo-check.ps1 reads both from the built binaries and is
|
||||
red when they differ. The file description is the AssemblyTitle - an entry point sets its own, a library keeps its
|
||||
assembly name - and the Description is the Comments field, the native blocks' sentence for a library. The SDK
|
||||
stamps RepositoryUrl into every assembly as AssemblyMetadata; it is the App's IssueLink.Repository, and the App's
|
||||
AssemblyIdentityTests holds the two equal (a fork changes both - FORKING.md). -->
|
||||
<PropertyGroup>
|
||||
<Company>FrameLedger</Company>
|
||||
<Product>FrameLedger</Product>
|
||||
<Authors>poli0981</Authors>
|
||||
<Copyright>Copyright (C) 2026 poli0981. GPL-3.0-only with additional terms: see NOTICE</Copyright>
|
||||
<Description>Performance measurement tool. Identifies itself deliberately; see https://github.com/poli0981/frameledger</Description>
|
||||
<RepositoryUrl>https://github.com/poli0981/frameledger</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- beta.12: the source a build was made from - release.yml passes the tag (a rehearsal, its commit); a local build has
|
||||
none. The App's links into the repository open THIS version's documents with it (Services/RepositoryLinks.cs).
|
||||
Every assembly since beta.14 (D50), not the App's alone: the two publishes build the same libraries into one
|
||||
out/app, and release.yml passes the same ref to both. -->
|
||||
<ItemGroup Condition="'$(FrameLedgerSourceRef)' != ''">
|
||||
<AssemblyMetadata Include="FrameLedgerSourceRef" Value="$(FrameLedgerSourceRef)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Test projects: documentation comments are noise, and xUnit's own
|
||||
analyzers already cover what matters there. -->
|
||||
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ share — and migrate — one database, and fight over the same pipe and shared
|
||||
| Logon task | `LogonTask` (the Agent's maintenance verbs) | one task per name |
|
||||
| Issue and help links | `IssueLink.Repository` (`src/FrameLedger.App/Services/IssueLink.cs`) — `RepositoryLinks` builds every document link in the App from it and the source ref `release.yml` passes — plus the Releases link in `guide/01-install.md` and `.github/ISSUE_TEMPLATE/` | your users' reports belong in your tracker |
|
||||
| Who the documents name | `legal/EULA.md`, `legal/DISCLAIMER.md`, `legal/PRIVACY_POLICY.md` name poli0981 as the Developer, with a contact | the person who distributes a build is the one its users deal with; review every claim they make, too — they describe FrameLedger's builds, not yours |
|
||||
| Version information | `FL_COMPANY_NAME` / `FL_PRODUCT_NAME` in `src/native/CMakeLists.txt`, and the `ProductName` that `tools/versioninfo-check.ps1` requires | anti-cheat vendors and users identify the DLLs loaded into games by it (`docs/19_SAFETY_AND_ANTICHEAT.md`); it must name your project |
|
||||
| Version information | `FL_COMPANY_NAME` / `FL_PRODUCT_NAME` / `FL_COPYRIGHT` in `src/native/CMakeLists.txt`; `Company` / `Product` / `Authors` / `Copyright` / `Description` / `RepositoryUrl` in `Directory.Build.props` and the `AssemblyTitle` / `Description` of the App's and the Agent's csproj (since beta.14); and the names `tools/versioninfo-check.ps1` and the two `AssemblyIdentityTests` require | anti-cheat vendors and users identify the DLLs loaded into games and the processes beside them by it (`docs/19_SAFETY_AND_ANTICHEAT.md`); it must name your project, and the copyright line must be one line on every binary — the check compares them |
|
||||
| Checksums | your own `SHA256SUMS.txt` | users verify what *you* built |
|
||||
|
||||
The detection rules and the anti-cheat blocklist (`rules/detection-rules.json`) ship with each build; keeping them
|
||||
|
||||
@@ -320,13 +320,27 @@ function Invoke-ProjectGates {
|
||||
# Being plainly identifiable to anti-cheat is a requirement, not packaging
|
||||
# polish (docs/19_SAFETY_AND_ANTICHEAT.md). Reads the built binary, because
|
||||
# what ships is what an anti-cheat vendor sees.
|
||||
#
|
||||
# beta.14 (D50): BOTH HALVES. The rules prove themselves first (ten cases,
|
||||
# nine RED, each for its own reason), then the live pass reads the native five
|
||||
# and the managed eight from the App's and the Agent's build output, whose
|
||||
# ProductVersion is the VERSION file's here (release.yml passes the tag's).
|
||||
# Under -SkipNative the managed half still runs.
|
||||
Write-Step 'versioninfo-check'
|
||||
$versionTool = Join-Path $repo 'tools/versioninfo-check.ps1'
|
||||
if ((Test-Path $versionTool) -and -not $SkipNative) {
|
||||
Invoke-Checked 'versioninfo-check' { & $versionTool -BuildDir (Join-Path $repo "build/native/x64-$($Configuration.ToLower())") }
|
||||
}
|
||||
elseif ($SkipNative) {
|
||||
Skip-Gate 'versioninfo-check' 'native build skipped, so there is no binary to inspect'
|
||||
if (Test-Path $versionTool) {
|
||||
Invoke-Checked 'versioninfo-check (self-test)' { & $versionTool -SelfTest }
|
||||
$managedDirs = @('FrameLedger.App', 'FrameLedger.Agent' | ForEach-Object { Join-Path $repo "src/$_/bin/$Configuration" })
|
||||
$productVersion = (Get-Content (Join-Path $repo 'VERSION') -Raw).Trim()
|
||||
if ($SkipNative) {
|
||||
Invoke-Checked 'versioninfo-check (managed)' { & $versionTool -ManagedOnly -ManagedDir $managedDirs -ExpectedProductVersion $productVersion }
|
||||
Skip-Gate 'versioninfo-check (native)' 'native build skipped, so there is no binary to inspect'
|
||||
}
|
||||
else {
|
||||
Invoke-Checked 'versioninfo-check' {
|
||||
& $versionTool -BuildDir (Join-Path $repo "build/native/x64-$($Configuration.ToLower())") -ManagedDir $managedDirs -ExpectedProductVersion $productVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Skip-Gate 'versioninfo-check' 'tools/versioninfo-check.ps1 not implemented yet'
|
||||
|
||||
+29
-4
@@ -44,7 +44,7 @@ Compiler/linker flags (enforced in CMake, not per-target ad hoc): `/std:c++20 /M
|
||||
|
||||
**No AMD or Intel GPU *telemetry* SDK is vendored.** Those vendors' sensors are covered by LibreHardwareMonitor and the DXGI/PDH baseline (`18_GPU_VENDOR_APIS`). A build that pulls in Intel IGCL or AMD ADLX material is a licensing regression, not a feature — CI greps for it. **The AMD FidelityFX ffx-api headers (MIT by exception, tag v2.3.0) ARE vendored since 2026-09-04**, for the Overlay's upscaler hook and for types only — `fl_fidelityfx_headers` above, `18_GPU_VENDOR_APIS` §AMD for the licence reading, and `license-check.ps1` §2d for the per-file gate. Intel's XeSS SDK failed the checklist and nothing of it is here.
|
||||
|
||||
**VERSIONINFO is mandatory** on ~~`FrameLedger.Overlay.dll` and `FrameLedger.VkLayer.dll`~~ every shipped native — the five `tools/versioninfo-check.ps1` lists (corrected 2026-10-04): real `CompanyName`, `ProductName=FrameLedger`, `FileDescription`, version. Identifiability is a requirement (`19_SAFETY`), and a CI check fails the build if the resource block is missing.
|
||||
**VERSIONINFO is mandatory** on ~~`FrameLedger.Overlay.dll` and `FrameLedger.VkLayer.dll`~~ every shipped native — the five `tools/versioninfo-check.ps1` lists (corrected 2026-10-04): real `CompanyName`, `ProductName=FrameLedger`, `FileDescription`, version. Identifiability is a requirement (`19_SAFETY`), and a CI check fails the build if the resource block is missing. **Since beta.14 (D50) the managed binaries are held to the same** — §Version, *Identity*.
|
||||
|
||||
## Managed build & native integration
|
||||
|
||||
@@ -170,6 +170,29 @@ two products claiming to be one.
|
||||
- `release.yml` refuses a tag whose numeric core is not the file's. Bumping the version is one edit to
|
||||
`VERSION`, in the same commit as the changelog section, before the tag.
|
||||
|
||||
**Identity (beta.14, D50).** Every binary names the product, says what it is and carries one copyright line. Until
|
||||
beta.14 only the native blocks did: the managed ones carried the SDK's defaults — the Agent's company and product read
|
||||
`FrameLedger.Agent`, each library's its own assembly name — and no copyright, and those blocks are what Explorer's
|
||||
*Properties ▸ Details* and Task Manager show (Task Manager lists the Agent by its file description).
|
||||
|
||||
| Field | Native (`src/native/CMakeLists.txt`) | Managed (`Directory.Build.props`, the two entry points' csproj) |
|
||||
|---|---|---|
|
||||
| CompanyName, ProductName | `FL_COMPANY_NAME`, `FL_PRODUCT_NAME` = `FrameLedger` | `Company`, `Product` = `FrameLedger` |
|
||||
| LegalCopyright | `FL_COPYRIGHT` | `Copyright` — the same line, word for word |
|
||||
| FileDescription | each target's `fl_add_version_resource` description | `AssemblyTitle`: `FrameLedger` (App), `FrameLedger Agent` (Agent); a library keeps its assembly name |
|
||||
| Comments | the identification sentence | `Description` — the same sentence for a library, a line of its own for each entry point |
|
||||
| FileVersion / ProductVersion | the numeric core, `x.y.z.0` | `x.y.z.0` / the full version (`-p:Version`, a pre-release's tag included) |
|
||||
| OriginalFilename | the file's own name | the assembly's (`FrameLedger.dll`) — the apphost `.exe` carries a copy of its assembly's block |
|
||||
|
||||
Also stamped on every assembly: `AssemblyMetadata("RepositoryUrl")` (the SDK, from `RepositoryUrl`; the App test holds
|
||||
it equal to `IssueLink.Repository`) and, when `release.yml` passes it, `FrameLedgerSourceRef` — the App csproj's alone
|
||||
until beta.14, now `Directory.Build.props`', and passed to both publishes. `tools/versioninfo-check.ps1` reads all of it
|
||||
from the BUILT binaries — the native five and, with `-ManagedDir`, the managed eight (`FrameLedger.exe`/`.dll`,
|
||||
`FrameLedger.Agent.exe`/`.dll`, Domain, Application, Infrastructure, Shared) — and is red when a copyright differs
|
||||
anywhere, when a managed `ProductVersion` is not `-ExpectedProductVersion` (required: a comparison with nothing passes
|
||||
everything), or when an apphost does not carry its assembly's block; its `-SelfTest` (ten cases, nine RED, each for the
|
||||
reason it names) runs first. `AssemblyIdentityTests` (App and Agent) pins the source against `FL_COPYRIGHT`.
|
||||
|
||||
The Velopack package version is the tag's (`vpk pack --packVersion`), and `UpdateManager.CurrentVersion` reads
|
||||
the installed package's manifest — not the assembly — which is why the two are made to agree here rather than
|
||||
assumed to.
|
||||
@@ -179,7 +202,7 @@ assumed to.
|
||||
```
|
||||
cmake --build --preset x64-release
|
||||
dotnet publish src/FrameLedger.App -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:FrameLedgerSourceRef={tag} -o out/app
|
||||
dotnet publish src/FrameLedger.Agent -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -o out/app
|
||||
dotnet publish src/FrameLedger.Agent -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:FrameLedgerSourceRef={tag} -o out/app
|
||||
vpk download github --repoUrl https://github.com/poli0981/frameledger --channel win --pre --outputDir out/release # beta.13: the previous release, for a delta
|
||||
vpk pack --packId FrameLedger.App --packVersion {ver} --packDir out/app --mainExe FrameLedger.exe --packTitle FrameLedger --packAuthors FrameLedger --releaseNotes out/notes.md --outputDir out/release
|
||||
```
|
||||
@@ -189,7 +212,9 @@ vpk pack --packId FrameLedger.App --packVersion {ver} --packDir out/app --mainEx
|
||||
> take `-p:Version=<tag>` (§Version). No `--icon`: `assets/icon.ico` does not exist, and this line named it
|
||||
> for six weeks. **Since beta.12 the App also takes `-p:FrameLedgerSourceRef`** — the tag, or for a rehearsal the
|
||||
> commit — stamped as assembly metadata so its links into the repository open THIS version's documents
|
||||
> (`Services/RepositoryLinks`); a build without it links to `main`.
|
||||
> (`Services/RepositoryLinks`); a build without it links to `main`. **Since beta.14 the Agent takes it too**, because
|
||||
> `Directory.Build.props` stamps it on every assembly and both publishes build the same libraries into `out/app` (§Version,
|
||||
> *Identity*).
|
||||
>
|
||||
> **The package id is `FrameLedger.App`, and this line said `FrameLedger` until 2026-09-14 — which would have
|
||||
> deleted every user's ledger on uninstall.** Velopack installs into `%LOCALAPPDATA%\<packId>` and removes that
|
||||
@@ -256,7 +281,7 @@ document the app displays for acceptance (FR-11) is a defect, not a template.
|
||||
7. `tools/coverage-gate.ps1` — reads this run's cobertura reports; self-arming, and armed today for
|
||||
`FrameLedger.Domain` and `FrameLedger.Application`
|
||||
8. `tools/rules-validate.ps1` (schema + `anticheat` block sanity — a malformed or empty blocklist is a safety bug)
|
||||
9. `tools/versioninfo-check.ps1` — reads the built binary, because what ships is what an anti-cheat vendor sees; since P4 PR-5 it also compares every `FileVersion` against the `VERSION` file (§Version)
|
||||
9. `tools/versioninfo-check.ps1` — reads the built binary, because what ships is what an anti-cheat vendor sees; since P4 PR-5 it also compares every `FileVersion` against the `VERSION` file (§Version); **since beta.14 (D50) both halves run — the self-test, then the native five and the managed eight from the App's and the Agent's build output** (`-ManagedDir`, `-ExpectedProductVersion` = `VERSION`), one copyright across all of them (§Version, *Identity*). Under `-SkipNative` the managed half still runs
|
||||
10. `tools/chokepoint-check.ps1` — injection and evasion primitives confined to one file, native **and** managed, plus the `FL_GUARD_TESTABLE` symbol check against the shipped artifacts
|
||||
11. **`tools/hookinventory-check.ps1`** — three passes: A resolves every vendor symbol the Overlay names against `docs/vendor-exports.json`, B sweeps for stray literals, C reads the BUILT Overlay's import table and asserts it imports no vendor module. C skips loudly under `-SkipNative`. **Missing from this list until 2026-08-28**, which is §R10 happening again
|
||||
12. **`tools/package-closure-check.ps1`** — both halves: the self-test (5 cases, 4 of which must go RED) **and** a live pass over this repository. It walks the transitive `ProjectReference` closure of the two publish roots below and fails on anything outside the allowlist, naming the reference edge. `FrameLedger.CaptureHost` is an injecting entry point kept out of the package by construction, and `20_OPEN_QUESTIONS` §S27 is closed on exactly that basis
|
||||
|
||||
+4
-1
@@ -135,7 +135,10 @@ FrameLedger uses the **`poli0981/.github` ops repo** where its templates fit, an
|
||||
- **The published tree asserted by name**: `FrameLedger.exe`, `FrameLedger.Agent.exe`, the ~~four~~ five shipped natives
|
||||
`versioninfo-check` lists (`FrameLedger.ProcessStats.dll` since beta.12 — corrected 2026-10-04), `rules/detection-rules.json`; `FrameLedger.CaptureHost.exe` absent (`12_BUILD`:
|
||||
exactly two roots — `package-closure-check` proves it statically, this reads the directory); `versioninfo-check`
|
||||
run again over `out/app`, because a `.targets`-staged DLL that failed to copy is a warning to `dotnet publish`.
|
||||
run again over `out/app`, because a `.targets`-staged DLL that failed to copy is a warning to `dotnet publish` —
|
||||
**since beta.14 (D50) with its managed half** (`-ManagedDir out/app -ExpectedProductVersion <tag>`): the eight managed
|
||||
binaries name FrameLedger, carry the tag's full version and the native binaries' copyright line (`12_BUILD` §Version,
|
||||
*Identity*). Both publishes take `-p:FrameLedgerSourceRef` since beta.14.
|
||||
- **since beta.13, `vpk download github --pre` first**, so `vpk pack` finds the previous release's full package in
|
||||
`out/release` and writes a delta; after the pack, what `assets.win.json` names is kept and the rest (the previous full
|
||||
package) moves to `out/previous`, the feed and `RELEASES` are filtered to this build, and a downloaded previous package
|
||||
|
||||
@@ -22,7 +22,7 @@ These are permanently out of scope. A PR implementing any of them is rejected re
|
||||
- Reading or writing game memory outside the arguments of APIs we hooked
|
||||
- Kernel drivers of our own
|
||||
|
||||
The DLL ships with its real filename, a populated VERSIONINFO block (`CompanyName`, `ProductName=FrameLedger`, version), and named kernel objects that clearly say `FrameLedger`. Being identifiable is a feature.
|
||||
The DLL ships with its real filename, a populated VERSIONINFO block (`CompanyName`, `ProductName=FrameLedger`, version), and named kernel objects that clearly say `FrameLedger`. Being identifiable is a feature. Since beta.14 (D50) the Agent — the process that injects — and the App say the same about themselves: `FrameLedger` as company and product, *FrameLedger Agent* as the Agent's description, the native binaries' copyright line (`12_BUILD` §Version, *Identity*; `tools/versioninfo-check.ps1` reads both kinds).
|
||||
|
||||
## The anti-cheat guard (hard gate)
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<AssemblyName>FrameLedger.Agent</AssemblyName>
|
||||
<RootNamespace>FrameLedger.Agent</RootNamespace>
|
||||
<!-- beta.14 (D50): Task Manager lists a process by its file description, and until beta.14 this one read
|
||||
"FrameLedger.Agent" - the SDK's default, the assembly name - with the same as its company and product. -->
|
||||
<AssemblyTitle>FrameLedger Agent</AssemblyTitle>
|
||||
<Description>FrameLedger Agent: watches the games you added and records their sessions. Identifies itself deliberately; see https://github.com/poli0981/frameledger</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
<!-- 11_UPDATER (P4 PR-5): Velopack must run before any window exists, so the
|
||||
entry point is Program.Main rather than the generated App.Main. -->
|
||||
<StartupObject>FrameLedger.App.Program</StartupObject>
|
||||
<!-- beta.14 (D50): the file description Explorer and Task Manager show, and the Comments line. The company, product
|
||||
and copyright are every assembly's (Directory.Build.props). -->
|
||||
<AssemblyTitle>FrameLedger</AssemblyTitle>
|
||||
<Description>FrameLedger: records game performance sessions and shows them over time. Identifies itself deliberately; see https://github.com/poli0981/frameledger</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -57,13 +61,6 @@
|
||||
<EmbeddedResource Include="..\..\guide\*.md" LogicalName="guide/%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- beta.12: the source this build was made from, so the App's links into the repository open THIS version's documents
|
||||
(Services/RepositoryLinks.cs). release.yml passes the tag (a rehearsal, its commit); a local build has none and links
|
||||
to main. -->
|
||||
<ItemGroup Condition="'$(FrameLedgerSourceRef)' != ''">
|
||||
<AssemblyMetadata Include="FrameLedgerSourceRef" Value="$(FrameLedgerSourceRef)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- P4 PR-6: the licence texts travel with the package (legal/THIRD_PARTY_NOTICES.md: "Full license texts must be
|
||||
shipped in legal/licenses/ in release packages"). PUBLISH ONLY: a build output has no recipient, and copying
|
||||
|
||||
@@ -8,13 +8,13 @@ namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Links into the repository at the source THIS build was made from (beta.12): <c>release.yml</c> passes the release's tag
|
||||
/// (<c>-p:FrameLedgerSourceRef=v0.1.0-beta.12</c>, a rehearsal its commit), which the App csproj stamps as assembly
|
||||
/// metadata; a local build carries none and links to <c>main</c>. Until beta.12 every link said <c>blob/main</c>, so an
|
||||
/// (<c>-p:FrameLedgerSourceRef=v0.1.0-beta.12</c>, a rehearsal its commit), which <c>Directory.Build.props</c> stamps as
|
||||
/// assembly metadata (the App csproj until beta.14); a local build carries none and links to <c>main</c>. Until beta.12 every link said <c>blob/main</c>, so an
|
||||
/// installed release opened documents that had moved on since it was built — a different EULA from the one it showed.
|
||||
/// </summary>
|
||||
public static partial class RepositoryLinks
|
||||
{
|
||||
/// <summary>The metadata key the App csproj writes.</summary>
|
||||
/// <summary>The metadata key <c>Directory.Build.props</c> writes.</summary>
|
||||
public const string MetadataKey = "FrameLedgerSourceRef";
|
||||
|
||||
/// <summary>The branch a build without a stamped source links to.</summary>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Agent.Composition;
|
||||
|
||||
namespace FrameLedger.Agent.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// beta.14 (D50): Task Manager lists a process by its file description, and until beta.14 the Agent's read
|
||||
/// "FrameLedger.Agent" — the SDK's default, the assembly name, with the same company and product and no copyright. The
|
||||
/// Agent is the process that injects; it says plainly what it is and who wrote it, as the native binaries always have.
|
||||
/// </summary>
|
||||
public sealed class AssemblyIdentityTests
|
||||
{
|
||||
private static string RepoRoot()
|
||||
{
|
||||
for (DirectoryInfo? dir = new(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
|
||||
{
|
||||
if (File.Exists(Path.Combine(dir.FullName, "FrameLedger.slnx")))
|
||||
{
|
||||
return dir.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("the repository root (FrameLedger.slnx) is not above " + AppContext.BaseDirectory);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheAgentNamesItselfAndCarriesTheNativeCopyright()
|
||||
{
|
||||
Assembly agent = typeof(AgentIdentityFactory).Assembly;
|
||||
FileVersionInfo block = FileVersionInfo.GetVersionInfo(agent.Location);
|
||||
Match native = Regex.Match(File.ReadAllText(Path.Combine(RepoRoot(), "src", "native", "CMakeLists.txt")),
|
||||
"^set\\(FL_COPYRIGHT\\s+\"(?<text>[^\"]+)\"\\)", RegexOptions.Multiline | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant, TimeSpan.FromSeconds(1));
|
||||
|
||||
(block.FileDescription, block.CompanyName, block.ProductName).Should().Be(("FrameLedger Agent", "FrameLedger", "FrameLedger"),
|
||||
"the apphost FrameLedger.Agent.exe carries a copy of this block, and Task Manager shows its description");
|
||||
native.Success.Should().BeTrue("src/native/CMakeLists.txt sets FL_COPYRIGHT");
|
||||
block.LegalCopyright.Should().Be(native.Groups["text"].Value, "one product, one copyright");
|
||||
(agent.GetCustomAttribute<AssemblyDescriptionAttribute>()?.Description).Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using FrameLedger.App.Services;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// beta.14 (D50): every managed assembly the package ships names the product, says what it is and carries the copyright
|
||||
/// the native binaries carry. Until beta.14 the SDK's defaults stood — each library's company and product were its own
|
||||
/// assembly name, the Agent's "FrameLedger.Agent" — and no managed binary had a copyright; Explorer's Properties ▸
|
||||
/// Details and Task Manager read these. <c>tools/versioninfo-check.ps1</c> reads the same from the built and the
|
||||
/// published binaries; this pins the source, against the native <c>FL_COPYRIGHT</c> word for word.
|
||||
/// </summary>
|
||||
public sealed class AssemblyIdentityTests
|
||||
{
|
||||
private static readonly Assembly[] _shipped =
|
||||
[
|
||||
typeof(UiIdentity).Assembly,
|
||||
typeof(Domain.Sessions.ExitStatus).Assembly,
|
||||
typeof(Application.Recording.ExitStatusMapper).Assembly,
|
||||
typeof(Infrastructure.Persistence.LedgerPaths).Assembly,
|
||||
typeof(Shared.Ipc.IpcProtocol).Assembly,
|
||||
];
|
||||
|
||||
private static string RepoRoot()
|
||||
{
|
||||
for (DirectoryInfo? dir = new(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
|
||||
{
|
||||
if (File.Exists(Path.Combine(dir.FullName, "FrameLedger.slnx")))
|
||||
{
|
||||
return dir.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("the repository root (FrameLedger.slnx) is not above " + AppContext.BaseDirectory);
|
||||
}
|
||||
|
||||
/// <summary>The native version blocks' copyright line, as <c>src/native/CMakeLists.txt</c> sets it.</summary>
|
||||
private static string NativeCopyright()
|
||||
{
|
||||
string cmake = File.ReadAllText(Path.Combine(RepoRoot(), "src", "native", "CMakeLists.txt"));
|
||||
Match line = Regex.Match(cmake, "^set\\(FL_COPYRIGHT\\s+\"(?<text>[^\"]+)\"\\)", RegexOptions.Multiline | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant, TimeSpan.FromSeconds(1));
|
||||
line.Success.Should().BeTrue("src/native/CMakeLists.txt sets FL_COPYRIGHT");
|
||||
return line.Groups["text"].Value;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EveryShippedAssemblyNamesTheProductAndCarriesTheNativeCopyright()
|
||||
{
|
||||
string copyright = NativeCopyright();
|
||||
|
||||
using var scope = new AssertionScope();
|
||||
foreach (Assembly assembly in _shipped)
|
||||
{
|
||||
string name = assembly.GetName().Name!;
|
||||
(assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company).Should().Be("FrameLedger", name);
|
||||
(assembly.GetCustomAttribute<AssemblyProductAttribute>()?.Product).Should().Be("FrameLedger", name);
|
||||
(assembly.GetCustomAttribute<AssemblyCopyrightAttribute>()?.Copyright).Should().Be(copyright, name);
|
||||
(assembly.GetCustomAttribute<AssemblyDescriptionAttribute>()?.Description).Should().NotBeNullOrWhiteSpace(name);
|
||||
// The repository every assembly names is the one the App sends issues and document links to.
|
||||
(assembly.GetCustomAttributes<AssemblyMetadataAttribute>().FirstOrDefault(static a => string.Equals(a.Key, "RepositoryUrl", StringComparison.Ordinal))?.Value)
|
||||
.Should().Be(IssueLink.Repository, name);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheAppsVersionBlockIsWhatExplorerShows()
|
||||
{
|
||||
Assembly app = typeof(UiIdentity).Assembly;
|
||||
FileVersionInfo block = FileVersionInfo.GetVersionInfo(app.Location);
|
||||
|
||||
(block.FileDescription, block.CompanyName, block.ProductName).Should().Be(("FrameLedger", "FrameLedger", "FrameLedger"),
|
||||
"the apphost FrameLedger.exe carries a copy of this block");
|
||||
block.LegalCopyright.Should().Be(NativeCopyright(), "one product, one copyright");
|
||||
}
|
||||
}
|
||||
+260
-46
@@ -4,7 +4,8 @@
|
||||
#Requires -Version 7.0
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Asserts every shipped native binary carries a populated VERSIONINFO block.
|
||||
Asserts every shipped binary carries a populated version block that names
|
||||
FrameLedger: the native ones, and since beta.14 the managed ones.
|
||||
|
||||
.DESCRIPTION
|
||||
docs/19_SAFETY_AND_ANTICHEAT.md §What we will never build: the DLL ships
|
||||
@@ -22,94 +23,307 @@
|
||||
Reads the BUILT BINARY rather than the .rc source: what ships is what
|
||||
matters, and a resource that fails to compile in would leave the source
|
||||
looking correct.
|
||||
|
||||
THE MANAGED HALF (beta.14, D50). Until beta.14 this read the five native
|
||||
binaries and nothing else, and the managed ones carried the SDK's defaults:
|
||||
the Agent's CompanyName and ProductName read "FrameLedger.Agent", each
|
||||
library's its own assembly name, and no managed binary had a copyright.
|
||||
Explorer's Properties > Details and Task Manager show these blocks, and the
|
||||
Agent is the process that injects. -ManagedDir names where the shipped
|
||||
managed binaries are (build.ps1: the App's and the Agent's build output;
|
||||
release.yml: out/app) and -ExpectedProductVersion the version they must
|
||||
carry (the VERSION file's in the gate, the tag's in a release) — required,
|
||||
because a comparison with nothing passes everything. Every binary one run
|
||||
reads must carry the SAME LegalCopyright, so the managed copyright
|
||||
(Directory.Build.props) and the native one (FL_COPYRIGHT in
|
||||
src/native/CMakeLists.txt) cannot drift apart.
|
||||
|
||||
A managed .exe is the SDK's apphost, which carries a COPY of its assembly's
|
||||
block: its OriginalFilename is the assembly's (FrameLedger.dll), and that is
|
||||
what is asserted. An apphost the block was never copied into carries the
|
||||
host template's block or none, and is red.
|
||||
|
||||
TWO INVOCATIONS, BOTH WIRED IN build.ps1. -SelfTest runs the rules against
|
||||
synthetic blocks — ten cases, nine of which must come back RED, each for the
|
||||
reason it names — and the live pass reads the binaries.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(DefaultParameterSetName = 'Live')]
|
||||
param(
|
||||
[Parameter(ParameterSetName = 'Live')]
|
||||
[string]$BuildDir = (Join-Path (Split-Path $PSScriptRoot -Parent) 'build/native/x64-release'),
|
||||
|
||||
# P4 PR-5: the one version source (docs/12_BUILD.md §Version). Every binary's
|
||||
# FileVersion must be this, with the fourth component the .rc template adds.
|
||||
# Default: the repository's VERSION file; an empty string skips the comparison.
|
||||
[Parameter(ParameterSetName = 'Live')]
|
||||
[string]$ExpectedVersion = $(
|
||||
$f = Join-Path (Split-Path $PSScriptRoot -Parent) 'VERSION'
|
||||
if (Test-Path $f) { (Get-Content $f -Raw).Trim() } else { '' }
|
||||
)
|
||||
),
|
||||
|
||||
# beta.14 (D50): the directories that hold the shipped managed binaries,
|
||||
# searched recursively, the newest copy of each name read. None: the native
|
||||
# half only, as before beta.14.
|
||||
[Parameter(ParameterSetName = 'Live')]
|
||||
[string[]]$ManagedDir = @(),
|
||||
|
||||
# beta.14: the ProductVersion every managed binary must carry — the full
|
||||
# version, a pre-release's tag included. The managed half is red without one.
|
||||
[Parameter(ParameterSetName = 'Live')]
|
||||
[string]$ExpectedProductVersion = '',
|
||||
|
||||
# beta.14: the managed half alone, for build.ps1 -SkipNative, which builds no
|
||||
# native binary to read.
|
||||
[Parameter(ParameterSetName = 'Live')]
|
||||
[switch]$ManagedOnly,
|
||||
|
||||
[Parameter(Mandatory, ParameterSetName = 'SelfTest')]
|
||||
[switch]$SelfTest
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Every binary that can end up inside a process we do not own.
|
||||
$required = @('FrameLedger.Overlay.dll', 'FrameLedger.VkLayer.dll', 'FrameLedger.Guard.dll', 'FrameLedger.NvapiBridge.dll', 'FrameLedger.ProcessStats.dll')
|
||||
$nativeBinaries = @('FrameLedger.Overlay.dll', 'FrameLedger.VkLayer.dll', 'FrameLedger.Guard.dll', 'FrameLedger.NvapiBridge.dll', 'FrameLedger.ProcessStats.dll')
|
||||
|
||||
if (-not (Test-Path $BuildDir)) {
|
||||
Write-Host "VERSIONINFO CHECK FAILED: no native build at $BuildDir" -ForegroundColor Red
|
||||
Write-Host ' Build first: ./build.ps1 native' -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
# beta.14 (D50): the managed binaries out/app ships — both entry points, apphost
|
||||
# and assembly, and the four libraries they load.
|
||||
$managedBinaries = @('FrameLedger.exe', 'FrameLedger.dll', 'FrameLedger.Agent.exe', 'FrameLedger.Agent.dll',
|
||||
'FrameLedger.Domain.dll', 'FrameLedger.Application.dll', 'FrameLedger.Infrastructure.dll', 'FrameLedger.Shared.dll')
|
||||
|
||||
$errors = [System.Collections.Generic.List[string]]::new()
|
||||
$checked = 0
|
||||
# The rules for ONE block. Every string it emits is a problem; none is a pass.
|
||||
# $Block carries FileVersionInfo's field names: a real FileVersionInfo in the
|
||||
# live pass, a [pscustomobject] in the self-test.
|
||||
function Test-Block {
|
||||
param([string]$Name, [ValidateSet('native', 'managed')][string]$Kind, $Block, [string]$ExpectedVersion, [string]$ExpectedProductVersion)
|
||||
|
||||
foreach ($name in $required) {
|
||||
$file = Get-ChildItem -Path $BuildDir -Filter $name -Recurse -File -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
if (-not $file) {
|
||||
$errors.Add("$name was not produced by the native build — cannot verify it is identifiable")
|
||||
continue
|
||||
}
|
||||
|
||||
$vi = $file.VersionInfo
|
||||
# A missing resource yields an object whose fields are all null/empty, not
|
||||
# an exception. "No version block" and "a version block full of blanks" are
|
||||
# the same failure for our purposes: neither identifies the binary.
|
||||
$fields = [ordered]@{
|
||||
CompanyName = $vi.CompanyName
|
||||
ProductName = $vi.ProductName
|
||||
FileDescription = $vi.FileDescription
|
||||
FileVersion = $vi.FileVersion
|
||||
}
|
||||
$missing = @($fields.GetEnumerator() | Where-Object { [string]::IsNullOrWhiteSpace($_.Value) } |
|
||||
ForEach-Object { $_.Key })
|
||||
|
||||
if ($missing.Count -gt 0) {
|
||||
$errors.Add("$name has no usable VERSIONINFO — empty: $($missing -join ', ')")
|
||||
continue
|
||||
# the same failure for our purposes: neither identifies the binary. A
|
||||
# copyright of one space is what every managed binary carried until beta.14.
|
||||
$empty = @('CompanyName', 'ProductName', 'FileDescription', 'FileVersion', 'LegalCopyright' |
|
||||
Where-Object { [string]::IsNullOrWhiteSpace($Block.$_) })
|
||||
if ($empty.Count -gt 0) {
|
||||
"$Name has no usable version block — empty: $($empty -join ', ')"
|
||||
return
|
||||
}
|
||||
|
||||
# The product name is the one an anti-cheat vendor greps for. A binary that
|
||||
# calls itself something else is the beginning of hiding.
|
||||
if ($vi.ProductName -ne 'FrameLedger') {
|
||||
$errors.Add("$name ProductName is '$($vi.ProductName)', expected 'FrameLedger' — the binary must name the project it belongs to")
|
||||
# calls itself something else is the beginning of hiding. The company is the
|
||||
# same name (FL_COMPANY_NAME, Directory.Build.props).
|
||||
foreach ($field in 'CompanyName', 'ProductName') {
|
||||
if ($Block.$field -cne 'FrameLedger') {
|
||||
"$Name $field is '$($Block.$field)', expected 'FrameLedger' — the binary must name the project it belongs to"
|
||||
}
|
||||
}
|
||||
|
||||
# ABSENT is the case this check exists for, and it used to be the one case
|
||||
# that passed. `if ($vi.OriginalFilename -and ...)` short-circuits on an empty
|
||||
# field, so a binary carrying NO OriginalFilename at all — the least
|
||||
# identifiable state there is — sailed through a gate whose whole purpose is
|
||||
# that our binaries name themselves.
|
||||
if ([string]::IsNullOrWhiteSpace($vi.OriginalFilename)) {
|
||||
$errors.Add("$name carries no OriginalFilename — an unnamed binary is the state this check exists to prevent")
|
||||
} elseif ($vi.OriginalFilename -ne $name) {
|
||||
$errors.Add("$name OriginalFilename is '$($vi.OriginalFilename)' — a renamed binary is harder to identify, which is the wrong direction")
|
||||
$apphost = $Kind -eq 'managed' -and $Name.EndsWith('.exe', [StringComparison]::OrdinalIgnoreCase)
|
||||
$original = if ($apphost) { [IO.Path]::ChangeExtension($Name, '.dll') } else { $Name }
|
||||
if ([string]::IsNullOrWhiteSpace($Block.OriginalFilename)) {
|
||||
"$Name carries no OriginalFilename — an unnamed binary is the state this check exists to prevent"
|
||||
}
|
||||
elseif ($Block.OriginalFilename -ne $original) {
|
||||
if ($apphost) {
|
||||
"$Name OriginalFilename is '$($Block.OriginalFilename)', expected '$original' — an apphost carries a copy of its own assembly's block, so any other is not this binary's"
|
||||
}
|
||||
else {
|
||||
"$Name OriginalFilename is '$($Block.OriginalFilename)' — a renamed binary is harder to identify, which is the wrong direction"
|
||||
}
|
||||
}
|
||||
|
||||
# The version the binary says is the version the repository says (P4 PR-5). A
|
||||
# native block reading 0.0.0 beside a managed assembly reading 0.1.0 is two
|
||||
# products claiming to be one, and the release workflow would ship it.
|
||||
if ($ExpectedVersion -and $vi.FileVersion.Trim() -ne "$ExpectedVersion.0") {
|
||||
$errors.Add("$name FileVersion is '$($vi.FileVersion)', expected '$ExpectedVersion.0' — the VERSION file is the one source (12_BUILD §Version)")
|
||||
if ($ExpectedVersion -and $Block.FileVersion.Trim() -ne "$ExpectedVersion.0") {
|
||||
"$Name FileVersion is '$($Block.FileVersion)', expected '$ExpectedVersion.0' — the VERSION file is the one source (12_BUILD §Version)"
|
||||
}
|
||||
|
||||
++$checked
|
||||
Write-Host (" {0,-28} {1} / {2} / v{3}" -f $name, $vi.CompanyName, $vi.ProductName, $vi.FileVersion) -ForegroundColor DarkGray
|
||||
# The managed ProductVersion is the full version About, Hello and the bug
|
||||
# bundle print — a pre-release's tag included (12_BUILD §Version).
|
||||
if ($Kind -eq 'managed') {
|
||||
if ([string]::IsNullOrWhiteSpace($ExpectedProductVersion)) {
|
||||
"$Name has no -ExpectedProductVersion to compare its ProductVersion with — a comparison with nothing passes everything"
|
||||
}
|
||||
elseif ($Block.ProductVersion -cne $ExpectedProductVersion) {
|
||||
"$Name ProductVersion is '$($Block.ProductVersion)', expected '$ExpectedProductVersion'"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# One product, one copyright (D50): every block one run read carries the same line.
|
||||
function Test-OneCopyright {
|
||||
param([System.Collections.IDictionary]$Blocks)
|
||||
$lines = [System.Collections.Generic.Dictionary[string, System.Collections.Generic.List[string]]]::new([StringComparer]::Ordinal)
|
||||
foreach ($e in $Blocks.GetEnumerator()) {
|
||||
$line = [string]$e.Value.LegalCopyright
|
||||
if ([string]::IsNullOrWhiteSpace($line)) { continue } # Test-Block reported it
|
||||
if (-not $lines.ContainsKey($line)) { $lines[$line] = [System.Collections.Generic.List[string]]::new() }
|
||||
$lines[$line].Add([string]$e.Key)
|
||||
}
|
||||
if ($lines.Count -gt 1) {
|
||||
"the binaries carry $($lines.Count) different copyright lines where one product has one (Directory.Build.props, FL_COPYRIGHT in src/native/CMakeLists.txt): " +
|
||||
(@($lines.GetEnumerator() | ForEach-Object { "'$($_.Key)' in $($_.Value -join ', ')" }) -join '; ')
|
||||
}
|
||||
}
|
||||
|
||||
if ($SelfTest) {
|
||||
$copyright = 'Copyright (C) 2026 poli0981. GPL-3.0-only with additional terms: see NOTICE'
|
||||
$script:cases = 0
|
||||
$script:red = 0
|
||||
$failures = [System.Collections.Generic.List[string]]::new()
|
||||
|
||||
function New-Block([string]$Original, [string]$Description = 'FrameLedger', [string]$ProductVersion = '0.1.0-beta.14') {
|
||||
[pscustomobject][ordered]@{
|
||||
CompanyName = 'FrameLedger'; ProductName = 'FrameLedger'; FileDescription = $Description; FileVersion = '0.1.0.0'
|
||||
ProductVersion = $ProductVersion; OriginalFilename = $Original; LegalCopyright = $copyright
|
||||
}
|
||||
}
|
||||
|
||||
# A release's shape, each case changing one thing: a native binary, and both
|
||||
# entry points' apphost and assembly.
|
||||
function New-Tree {
|
||||
[ordered]@{
|
||||
'native:FrameLedger.Overlay.dll' = New-Block 'FrameLedger.Overlay.dll' 'FrameLedger Overlay' '0.1.0.0'
|
||||
'managed:FrameLedger.exe' = New-Block 'FrameLedger.dll'
|
||||
'managed:FrameLedger.dll' = New-Block 'FrameLedger.dll'
|
||||
'managed:FrameLedger.Agent.exe' = New-Block 'FrameLedger.Agent.dll' 'FrameLedger Agent'
|
||||
'managed:FrameLedger.Agent.dll' = New-Block 'FrameLedger.Agent.dll' 'FrameLedger Agent'
|
||||
}
|
||||
}
|
||||
|
||||
# RED must be red for the reason the case names: a fixture typo that empties a
|
||||
# field would otherwise make every RED case pass for the wrong one.
|
||||
function Invoke-Case([string]$Name, [string]$Because, [scriptblock]$Change, [string]$ProductVersion = '0.1.0-beta.14') {
|
||||
$script:cases++
|
||||
$tree = New-Tree
|
||||
& $Change $tree
|
||||
$blocks = [ordered]@{}
|
||||
$problems = @(foreach ($e in $tree.GetEnumerator()) {
|
||||
$kind, $binary = $e.Key -split ':', 2
|
||||
Test-Block $binary $kind $e.Value '0.1.0' $ProductVersion
|
||||
$blocks[$binary] = $e.Value
|
||||
})
|
||||
$problems += @(Test-OneCopyright $blocks)
|
||||
$expectRed = [bool]$Because
|
||||
$isRed = $problems.Count -gt 0
|
||||
if ($isRed) { $script:red++ }
|
||||
if ($isRed -ne $expectRed) {
|
||||
$failures.Add("$Name — expected $(if ($expectRed) { 'RED' } else { 'GREEN' }), got $(if ($isRed) { 'RED' } else { 'GREEN' }): $($problems -join '; ')")
|
||||
}
|
||||
elseif ($expectRed -and -not ($problems | Where-Object { $_.Contains($Because, [StringComparison]::Ordinal) })) {
|
||||
$failures.Add("$Name — RED, but not for '$Because': $($problems -join '; ')")
|
||||
}
|
||||
else {
|
||||
Write-Host " ok $Name $(if ($isRed) { 'FAILS' } else { 'passes' })" -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
|
||||
# GREEN FIRST: every RED case below is satisfied by a check that refuses
|
||||
# everything, so one arrangement must pass or the suite proves nothing works.
|
||||
Invoke-Case 'a release built as beta.14 builds it' '' { }
|
||||
Invoke-Case 'the Agent named as beta.13 named it' "CompanyName is 'FrameLedger.Agent'" {
|
||||
param($t)
|
||||
foreach ($k in 'managed:FrameLedger.Agent.exe', 'managed:FrameLedger.Agent.dll') {
|
||||
$t[$k].CompanyName = 'FrameLedger.Agent'; $t[$k].ProductName = 'FrameLedger.Agent'; $t[$k].FileDescription = 'FrameLedger.Agent'
|
||||
}
|
||||
}
|
||||
Invoke-Case 'a managed binary whose copyright is one space' 'empty: LegalCopyright' { param($t) $t['managed:FrameLedger.dll'].LegalCopyright = ' ' }
|
||||
Invoke-Case 'a managed copyright that is not the native one' 'different copyright lines' {
|
||||
param($t)
|
||||
$t['managed:FrameLedger.exe'].LegalCopyright = 'Copyright (C) 2026 poli0981'
|
||||
$t['managed:FrameLedger.dll'].LegalCopyright = 'Copyright (C) 2026 poli0981'
|
||||
}
|
||||
Invoke-Case 'a native company that is not FrameLedger' "CompanyName is 'poli0981'" { param($t) $t['native:FrameLedger.Overlay.dll'].CompanyName = 'poli0981' }
|
||||
Invoke-Case 'an apphost carrying another assembly''s block' "OriginalFilename is 'FrameLedger.dll', expected 'FrameLedger.Agent.dll'" {
|
||||
param($t) $t['managed:FrameLedger.Agent.exe'].OriginalFilename = 'FrameLedger.dll'
|
||||
}
|
||||
Invoke-Case 'an apphost its block was never copied into' 'no usable version block' {
|
||||
param($t)
|
||||
$b = $t['managed:FrameLedger.exe']
|
||||
foreach ($p in @($b.PSObject.Properties.Name)) { $b.$p = $null }
|
||||
}
|
||||
Invoke-Case 'a published assembly without the release''s version' "ProductVersion is '0.1.0', expected '0.1.0-beta.14'" { param($t) $t['managed:FrameLedger.dll'].ProductVersion = '0.1.0' }
|
||||
Invoke-Case 'a FileVersion that is not the VERSION file''s' "FileVersion is '0.0.0.0'" { param($t) $t['native:FrameLedger.Overlay.dll'].FileVersion = '0.0.0.0' }
|
||||
Invoke-Case 'a managed half with no version to compare with' 'no -ExpectedProductVersion' { } ''
|
||||
|
||||
if ($failures.Count -gt 0) {
|
||||
Write-Host 'VERSIONINFO SELF-TEST FAILED' -ForegroundColor Red
|
||||
$failures | ForEach-Object { Write-Host " - $_" -ForegroundColor Red }
|
||||
exit 1
|
||||
}
|
||||
Write-Host "versioninfo self-test: $($script:cases) cases, $($script:red) red, each for its own reason" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
|
||||
$errors = [System.Collections.Generic.List[string]]::new()
|
||||
$blocks = [ordered]@{}
|
||||
$nativeRead = 0
|
||||
$managedRead = 0
|
||||
|
||||
if (-not $ManagedOnly) {
|
||||
if (-not (Test-Path $BuildDir)) {
|
||||
Write-Host "VERSIONINFO CHECK FAILED: no native build at $BuildDir" -ForegroundColor Red
|
||||
Write-Host ' Build first: ./build.ps1 native' -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
foreach ($name in $nativeBinaries) {
|
||||
$file = Get-ChildItem -Path $BuildDir -Filter $name -Recurse -File -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
if (-not $file) {
|
||||
$errors.Add("$name was not produced by the native build — cannot verify it is identifiable")
|
||||
continue
|
||||
}
|
||||
|
||||
$vi = $file.VersionInfo
|
||||
@(Test-Block $name 'native' $vi $ExpectedVersion '') | ForEach-Object { $errors.Add($_) }
|
||||
$blocks[$name] = $vi
|
||||
++$nativeRead
|
||||
Write-Host (" {0,-32} {1} / {2} / v{3}" -f $name, $vi.CompanyName, $vi.ProductName, $vi.FileVersion) -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
|
||||
# `pwsh -File` hands `-ManagedDir a,b` over as ONE string; split it as the in-process call would have.
|
||||
$ManagedDir = @($ManagedDir | ForEach-Object { $_ -split ',' } | Where-Object { $_ })
|
||||
foreach ($dir in $ManagedDir | Where-Object { -not (Test-Path $_) }) {
|
||||
$errors.Add("no managed build at $dir — build first: ./build.ps1 managed")
|
||||
}
|
||||
|
||||
if ($ManagedDir.Count -gt 0) {
|
||||
foreach ($name in $managedBinaries) {
|
||||
$file = @($ManagedDir | Where-Object { Test-Path $_ } |
|
||||
ForEach-Object { Get-ChildItem -Path $_ -Filter $name -Recurse -File -ErrorAction SilentlyContinue }) |
|
||||
Sort-Object LastWriteTimeUtc -Descending | Select-Object -First 1
|
||||
if (-not $file) {
|
||||
$errors.Add("$name is not under $($ManagedDir -join ', ') — cannot verify it is identifiable")
|
||||
continue
|
||||
}
|
||||
|
||||
$vi = $file.VersionInfo
|
||||
@(Test-Block $name 'managed' $vi $ExpectedVersion $ExpectedProductVersion) | ForEach-Object { $errors.Add($_) }
|
||||
$blocks[$name] = $vi
|
||||
++$managedRead
|
||||
Write-Host (" {0,-32} {1} / {2} / v{3}" -f $name, $vi.FileDescription, $vi.ProductName, $vi.ProductVersion) -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
elseif ($ManagedOnly) {
|
||||
$errors.Add('-ManagedOnly without -ManagedDir reads nothing, and a check of nothing is not a pass')
|
||||
}
|
||||
|
||||
@(Test-OneCopyright $blocks) | ForEach-Object { $errors.Add($_) }
|
||||
|
||||
if ($errors.Count -gt 0) {
|
||||
Write-Host 'VERSIONINFO CHECK FAILED' -ForegroundColor Red
|
||||
$errors | ForEach-Object { Write-Host " - $_" -ForegroundColor Red }
|
||||
Write-Host ' docs/19_SAFETY_AND_ANTICHEAT.md requires every shipped native binary to identify itself.' -ForegroundColor Red
|
||||
Write-Host ' docs/19_SAFETY_AND_ANTICHEAT.md requires every shipped binary to identify itself (12_BUILD §Version).' -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "versioninfo OK — $checked native binary(ies) identify themselves" -ForegroundColor Green
|
||||
Write-Host "versioninfo OK — $nativeRead native and $managedRead managed binary(ies) identify themselves, one copyright" -ForegroundColor Green
|
||||
exit 0
|
||||
Reference in new issue
Block a user