-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
2388 lines (2063 loc) · 122 KB
/
Copy pathbuild.ps1
File metadata and controls
2388 lines (2063 loc) · 122 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) 2026 Nils Kopal
# SPDX-License-Identifier: Apache-2.0
# Build MiniQuake and run the selected source and runtime verification gates.
[CmdletBinding()]
param(
[string]$Compiler = "",
[Alias("StdLibPath", "ImportRoot")]
[string]$StdLib = "",
[string]$Python = "",
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release",
[switch]$SkipTests,
[switch]$SkipMilestoneTests,
[switch]$NoRunTests,
[switch]$NetworkTests,
[switch]$RebuildNative,
[switch]$Listings,
[switch]$SkipIcon,
[switch]$SkipPreflight
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
# Never let Python tools or the Python MiniLang compiler buffer their output.
$env:PYTHONUNBUFFERED = "1"
$Root = $PSScriptRoot
$Output = Join-Path $Root "build"
$Source = Join-Path $Root "src"
$Parent = Split-Path -Parent $Root
$IconToolSource = Join-Path $Root "tools\exe_icon_injector.ml"
$IconAsset = Join-Path $Root "icons\MiniQuake.ico"
$PackageId = "BP-094"
$ParentPackageId = "BP-093"
$NativeTextAbi = "caller_owned_bytes_v1"
$ProtocolTextAbi = "quake_latin1_cstring_v1"
$BlockId = "BP-090-094"
$BlockParentPackageId = "BP-085-089R8"
$ProtocolStatus = "protocol15_frozen_v1"
$QuakeCStatus = "quakec_109_frozen_v1"
$WorldPhysicsStatus = "world_physics_109_frozen_v1"
$HostLifecycleStatus = "host_lifecycle_109_frozen_v1"
$ClientRenderStatus = "client_render_109_frozen_v1"
$WorldRenderStatus = "world_render_109_frozen_v1"
$ModelUiRenderStatus = "model_ui_render_109_frozen_v1"
$RenderSpecialStatus = "render_special_109_frozen_v1"
$AudioStatus = "audio_109_frozen_v1"
$NetworkPlatformStatus = "network_platform_109_frozen_v1"
$FrontendStatus = "frontend_109_frozen_v1"
$CoreAssetsMemoryStatus = "core_assets_memory_109_frozen_v1"
$GameplayPresentationStatus = "gameplay_presentation_109_frozen_v1"
$BlackPortSourceStatus = "black_port_source_109_frozen_v1"
$GameProfileStatus = "game_profile_109_frozen_v1"
$ModRuntimeStatus = "mod_runtime_109_frozen_v1"
$ArtifactCompatStatus = "artifact_compat_109_frozen_v1"
$StabilityStatus = "stability_109_frozen_v1"
$CompatReleaseStatus = "compat_109_release_candidate_v1"
$OriginalReferenceStatus = "original_reference_109_candidate_v1"
$CompatFinalStatus = "compat_109_final_candidate_v1"
# Resolve a configured executable from a path or command name.
function Resolve-CommandOrFile {
param(
[Parameter(Mandatory = $true)]
[string]$Value,
[Parameter(Mandatory = $true)]
[string]$Label
)
if (Test-Path -LiteralPath $Value -PathType Leaf) {
return [System.IO.Path]::GetFullPath($Value)
}
$Command = Get-Command $Value -ErrorAction SilentlyContinue | Select-Object -First 1
if ($null -ne $Command -and -not [string]::IsNullOrWhiteSpace($Command.Path)) {
return $Command.Path
}
throw "$Label not found: $Value"
}
# Normalize a standard-library candidate to its import root.
function Normalize-StdImportRoot {
param(
[Parameter(Mandatory = $true)]
[string]$Candidate
)
if ([string]::IsNullOrWhiteSpace($Candidate)) {
return $null
}
$Full = [System.IO.Path]::GetFullPath($Candidate)
if (Test-Path -LiteralPath $Full -PathType Leaf) {
if ([System.IO.Path]::GetFileName($Full) -ieq "fs.ml") {
$StdDirectory = Split-Path -Parent $Full
if ((Split-Path -Leaf $StdDirectory) -ieq "std") {
return Split-Path -Parent $StdDirectory
}
}
return $null
}
if (-not (Test-Path -LiteralPath $Full -PathType Container)) {
return $null
}
# Preferred form: the import root that contains std\fs.ml.
if (Test-Path -LiteralPath (Join-Path $Full "std\fs.ml") -PathType Leaf) {
return $Full
}
# Friendly form: the std directory itself. The compiler still needs its parent
# as -I root because `import std.fs` resolves to std/fs.ml below that root.
if ((Split-Path -Leaf $Full) -ieq "std" -and
(Test-Path -LiteralPath (Join-Path $Full "fs.ml") -PathType Leaf)) {
return Split-Path -Parent $Full
}
return $null
}
# Locate a usable MiniLang standard-library import root.
function Find-StdImportRoot {
param(
[Parameter(Mandatory = $true)]
[string]$CompilerPath,
[string]$ExplicitPath
)
if (-not [string]::IsNullOrWhiteSpace($ExplicitPath)) {
$Resolved = Normalize-StdImportRoot $ExplicitPath
if ($null -eq $Resolved) {
throw "MiniLang stdlib not found at '$ExplicitPath'. Pass either the compiler repository root containing std\fs.ml, the std directory itself, or std\fs.ml."
}
return $Resolved
}
$CompilerDirectory = Split-Path -Parent $CompilerPath
$CompilerParent = Split-Path -Parent $CompilerDirectory
$CompilerGrandParent = Split-Path -Parent $CompilerParent
$Candidates = @()
if (-not [string]::IsNullOrWhiteSpace($env:MINILANG_STDLIB)) {
$Candidates += $env:MINILANG_STDLIB
}
if (-not [string]::IsNullOrWhiteSpace($env:MINILANG_HOME)) {
$Candidates += $env:MINILANG_HOME
}
$Candidates += @(
$CompilerDirectory,
$CompilerParent,
$CompilerGrandParent,
(Join-Path $Parent "MiniLangCompilerPy"),
(Join-Path $Parent "MiniLangCompilerML")
)
$Seen = @{}
foreach ($Candidate in $Candidates) {
if ([string]::IsNullOrWhiteSpace($Candidate)) {
continue
}
$Key = [System.IO.Path]::GetFullPath($Candidate).ToLowerInvariant()
if ($Seen.ContainsKey($Key)) {
continue
}
$Seen[$Key] = $true
$Resolved = Normalize-StdImportRoot $Candidate
if ($null -ne $Resolved) {
return $Resolved
}
}
throw @"
MiniLang stdlib was not found.
MiniQuake imports std.fs, so the compiler needs an additional import root that
contains std\fs.ml. Pass it explicitly, for example:
.\build.ps1 -Compiler C:\path\MiniLangCompilerPy\mlc_win64.py `
-StdLib C:\path\MiniLangCompilerPy
or:
.\build.ps1 -Compiler C:\path\MiniLangCompilerML\build\mlc_win64.exe `
-StdLib C:\path\MiniLangCompilerML
-StdLib may also point directly at the std directory.
"@
}
# With no explicit path, prefer the Python reference compiler. This gives the
# quickest diagnostics and mirrors the intended porting workflow. The native
# self-hosted compiler remains fully supported.
if ([string]::IsNullOrWhiteSpace($Compiler)) {
$CompilerCandidates = @(
(Join-Path $Parent "MiniLangCompilerPy\mlc_win64.py"),
(Join-Path $Parent "MiniLangCompilerML\build\mlc_win64.exe"),
(Join-Path $Output "mlc_win64.exe")
)
foreach ($Candidate in $CompilerCandidates) {
if (Test-Path -LiteralPath $Candidate -PathType Leaf) {
$Compiler = $Candidate
break
}
}
if ([string]::IsNullOrWhiteSpace($Compiler)) {
throw @"
No MiniLang compiler was found. Pass -Compiler explicitly.
Recommended reference compiler:
.\build.ps1 -Compiler ..\MiniLangCompilerPy\mlc_win64.py
Self-hosted compiler:
.\build.ps1 -Compiler ..\MiniLangCompilerML\build\mlc_win64.exe
"@
}
}
$Compiler = Resolve-CommandOrFile $Compiler "MiniLang compiler"
$CompilerIsPython = [System.IO.Path]::GetExtension($Compiler) -ieq ".py"
$StdImportRoot = Find-StdImportRoot $Compiler $StdLib
$PythonExe = $null
$PythonPrefixArgs = @()
if ($CompilerIsPython -or $RebuildNative -or -not [string]::IsNullOrWhiteSpace($Python)) {
if (-not [string]::IsNullOrWhiteSpace($Python)) {
$PythonExe = Resolve-CommandOrFile $Python "Python interpreter"
if ([System.IO.Path]::GetFileNameWithoutExtension($PythonExe) -ieq "py") {
$PythonPrefixArgs = @("-3")
}
} else {
$PyLauncher = Get-Command "py" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($null -ne $PyLauncher) {
$PythonExe = $PyLauncher.Path
$PythonPrefixArgs = @("-3")
} else {
$PythonCommand = Get-Command "python" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($null -eq $PythonCommand) {
throw "Python 3 is required for the Python MiniLang compiler or -RebuildNative. Pass -Python PATH if it is not on PATH."
}
$PythonExe = $PythonCommand.Path
}
}
}
# Run a process while streaming and retaining its diagnostic output.
function Invoke-LiveCapturedProcess {
param(
[Parameter(Mandatory = $true)]
[string]$Executable,
[string[]]$Arguments = @(),
[string]$LogPath = ""
)
$Lines = [System.Collections.Generic.List[string]]::new()
$Writer = $null
if (-not [string]::IsNullOrWhiteSpace($LogPath)) {
$Encoding = [System.Text.UTF8Encoding]::new($false)
$Writer = [System.IO.StreamWriter]::new($LogPath, $false, $Encoding)
}
$ExitCode = 1
try {
& $Executable @Arguments 2>&1 |
ForEach-Object {
$Line = [string]$_
$Lines.Add($Line)
if ($null -ne $Writer) {
$Writer.WriteLine($Line)
$Writer.Flush()
}
Write-Host $Line
}
$ExitCode = [int]$LASTEXITCODE
} finally {
if ($null -ne $Writer) {
$Writer.Flush()
$Writer.Dispose()
}
}
return [pscustomobject]@{
exit_code = $ExitCode
lines = $Lines.ToArray()
text = [string]::Join("`n", $Lines.ToArray())
}
}
# Compile one MiniLang target with the selected compiler interface.
function Invoke-MiniLangCompile {
param(
[Parameter(Mandatory = $true)]
[string]$InputFile,
[Parameter(Mandatory = $true)]
[string]$OutputFile,
[Parameter(Mandatory = $true)]
[string[]]$CompilerArguments,
[Parameter(Mandatory = $true)]
[string]$Label
)
$SafeLabel = ($Label -replace "[^A-Za-z0-9._-]", "-").Trim([char[]]@('-'))
if ([string]::IsNullOrWhiteSpace($SafeLabel)) { $SafeLabel = "target" }
$LogPath = Join-Path $Output ("compile-{0}.log" -f $SafeLabel)
$PartialFile = $OutputFile + ".partial.exe"
$EffectiveArguments = @($CompilerArguments)
if ($Listings -and -not ($EffectiveArguments -contains "--asm-out")) {
$ListingPath = [System.IO.Path]::ChangeExtension($OutputFile, ".asm")
$EffectiveArguments += @("--asm-out", $ListingPath)
}
# Never leave an older executable looking like the result of a failed build.
foreach ($StalePath in @($OutputFile, $PartialFile)) {
if (Test-Path -LiteralPath $StalePath -PathType Leaf) {
Remove-Item -Force -LiteralPath $StalePath
}
}
@(
"MiniQuake compile log",
"package=$PackageId",
"label=$Label",
"input=$InputFile",
"output=$OutputFile",
"compiler=$Compiler",
"started_utc=$([DateTime]::UtcNow.ToString('o'))",
"--- compiler output ---"
) | Set-Content -LiteralPath $LogPath -Encoding UTF8
if ($CompilerIsPython) {
& $PythonExe @PythonPrefixArgs $Compiler $InputFile $PartialFile @EffectiveArguments 2>&1 |
ForEach-Object {
$CompilerLine = [string]$_
Write-Host $CompilerLine
Add-Content -LiteralPath $LogPath -Encoding UTF8 -Value $CompilerLine
}
} else {
& $Compiler $InputFile $PartialFile @EffectiveArguments 2>&1 |
ForEach-Object {
$CompilerLine = [string]$_
Write-Host $CompilerLine
Add-Content -LiteralPath $LogPath -Encoding UTF8 -Value $CompilerLine
}
}
$CompileExitCode = [int]$LASTEXITCODE
Add-Content -LiteralPath $LogPath -Encoding UTF8 -Value @(
"--- compiler result ---",
"exit_code=$CompileExitCode",
"finished_utc=$([DateTime]::UtcNow.ToString('o'))"
)
if ($CompileExitCode -ne 0) {
if (Test-Path -LiteralPath $PartialFile -PathType Leaf) {
Remove-Item -Force -LiteralPath $PartialFile
}
Write-Host "ERROR: MiniLang compilation failed for '$Label' with exit code $CompileExitCode. Compiler log: $LogPath" -ForegroundColor Red
exit $CompileExitCode
}
if (-not (Test-Path -LiteralPath $PartialFile -PathType Leaf)) {
Write-Host "ERROR: MiniLang compilation reported success for '$Label' but did not create $PartialFile. Compiler log: $LogPath" -ForegroundColor Red
exit 1
}
Move-Item -Force -LiteralPath $PartialFile -Destination $OutputFile
}
New-Item -ItemType Directory -Force -Path $Output | Out-Null
# Remove all package targets before the first compile. If the game target
# fails, executables and compile logs from the parent package cannot be mistaken
# for current BP-044 products by the result collector.
$PackageBuildArtifacts = @(
"MiniQuake.exe",
"tools\exe_icon_injector.exe",
"MiniQuakeOPT001AContractTests.exe",
"MiniQuakeOPT001BCorrectnessTests.exe",
"MiniQuakeOPT001CAllocationTests.exe",
"MiniQuakeOPT001CR3HotpathTests.exe",
"MiniQuakeTests.exe",
"MiniQuakeMilestoneTests.exe",
"MiniQuakeCompatTraceTests.exe",
"MiniQuakeProtocol15WireTests.exe",
"MiniQuakeProtocol15CommandTests.exe",
"MiniQuakeProtocol15ServerDataTests.exe",
"MiniQuakeProtocol15EventTests.exe",
"MiniQuakeProtocol15RuntimeEventTests.exe",
"MiniQuakeProtocol15SignonTests.exe",
"MiniQuakeProtocol15DeliveryTests.exe",
"MiniQuakeProtocol15DatagramTests.exe",
"MiniQuakeProtocol15DemoTests.exe",
"MiniQuakeProtocol15ClosureTests.exe",
"MiniQuakeQuakeCProgsTests.exe",
"MiniQuakeQuakeCVMTests.exe",
"MiniQuakeQuakeCEdictTests.exe",
"MiniQuakeQuakeCBuiltinTests.exe",
"MiniQuakeQuakeCClosureTests.exe",
"MiniQuakeQuakeCStockTests.exe",
"MiniQuakeWorldHullTests.exe",
"MiniQuakeWorldTraceTests.exe",
"MiniQuakeWorldLinkTests.exe",
"MiniQuakeServerMoveTests.exe",
"MiniQuakeServerPhysicsTests.exe",
"MiniQuakeSvUserMovementTests.exe",
"MiniQuakeBackwardMovementRetailTests.exe",
"MiniQuakeCheatRetailTests.exe",
"MiniQuakePlayerCollisionTelefragRetailTests.exe",
"MiniQuakeServerUserTests.exe",
"MiniQuakeWorldPhysicsClosureTests.exe",
"MiniQuakeHostTimingTests.exe",
"MiniQuakeCommandCvarTests.exe",
"MiniQuakeHostCommandTests.exe",
"MiniQuakeDemoLifecycleTests.exe",
"MiniQuakeSavegameV5Tests.exe",
"MiniQuakeHostLifecycleClosureTests.exe",
"MiniQuakeClientStateRenderTests.exe",
"MiniQuakeViewStateTests.exe",
"MiniQuakeTemporaryBeamTests.exe",
"MiniQuakeParticleRuntimeTests.exe",
"MiniQuakeClientRenderClosureTests.exe",
"MiniQuakeWorldSurfaceRenderTests.exe",
"MiniQuakeLightmapAtlasTests.exe",
"MiniQuakeDynamicLightRenderTests.exe",
"MiniQuakeSkyWaterRenderTests.exe",
"MiniQuakeWorldRenderClosureTests.exe",
"MiniQuakeAliasModelTests.exe",
"MiniQuakeSpriteSyncTests.exe",
"MiniQuakeRenderUiHudTests.exe",
"MiniQuakeRenderEvidenceTests.exe",
"MiniQuakeModelUiRenderClosureTests.exe",
"MiniQuakeMirrorSpecialRenderTests.exe",
"MiniQuakeRenderClearSpecialTests.exe",
"MiniQuakeEnvmapTimeRefreshTests.exe",
"MiniQuakeRenderEvidenceCorpusTests.exe",
"MiniQuakeRenderSpecialClosureTests.exe",
"MiniQuakeAudioMemoryTests.exe",
"MiniQuakeAudioDmaTests.exe",
"MiniQuakeAudioMixerTests.exe",
"MiniQuakeAudioWinTests.exe",
"MiniQuakeAudioClosureTests.exe",
"MiniQuakeAudioRetailEvidence.exe",
"MiniQuakeNetworkMainTests.exe",
"MiniQuakeNetworkControlTests.exe",
"MiniQuakeNetworkWinsAddressTests.exe",
"MiniQuakeSystemPlatformTests.exe",
"MiniQuakeNetworkPlatformClosureTests.exe",
"MiniQuakeNetworkPlatformEvidence.exe",
"MiniQuakeKeyFocusTests.exe",
"MiniQuakeInputDeviceTests.exe",
"MiniQuakeConsoleScreenTests.exe",
"MiniQuakeMenuLifecycleTests.exe",
"MiniQuakeFrontendClosureTests.exe",
"MiniQuakeCommonCoreTests.exe",
"MiniQuakeFilesystemPackTests.exe",
"MiniQuakeWadGraphicsTests.exe",
"MiniQuakeModelAssetTests.exe",
"MiniQuakeCoreAssetsMemoryTests.exe",
"MiniQuakeCoreAssetRetailEvidence.exe",
"MiniQuakeGameplayMathChaseTests.exe",
"MiniQuakeGameplayViewTests.exe",
"MiniQuakeGameplayScreenTests.exe",
"MiniQuakeGameplayStatusbarTests.exe",
"MiniQuakeGameplayPresentationClosureTests.exe",
"MiniQuakeCvarSourceSurfaceTests.exe",
"MiniQuakeCdAudioSourceSurfaceTests.exe",
"MiniQuakeSourceFunctionInventoryTests.exe",
"MiniQuakeBlackPortCorpusTests.exe",
"MiniQuakeBlackPortSourceClosureTests.exe",
"MiniQuakeGameProfileTests.exe",
"MiniQuakeModRuntimeTests.exe",
"MiniQuakeArtifactCompatTests.exe",
"MiniQuakeStabilityTests.exe",
"MiniQuakeCompatibilityReleaseTests.exe",
"MiniQuakeOriginalReferenceTests.exe",
"MiniQuakeOriginalServerInteropTests.exe",
"MiniQuakeOriginalClientInteropTests.exe",
"MiniQuakeOriginalVisualReferenceTests.exe",
"MiniQuakeExternalCompatibilityClosureTests.exe",
"MiniQuakeArtifactRetailEvidence.exe"
)
foreach ($ArtifactName in $PackageBuildArtifacts) {
foreach ($Candidate in @(
(Join-Path $Output $ArtifactName),
((Join-Path $Output $ArtifactName) + ".partial.exe")
)) {
if (Test-Path -LiteralPath $Candidate -PathType Leaf) {
Remove-Item -Force -LiteralPath $Candidate
}
}
}
Get-ChildItem -LiteralPath $Output -File -Filter "compile-*.log" -ErrorAction SilentlyContinue |
Remove-Item -Force -ErrorAction SilentlyContinue
Write-Host "[MiniQuake] package: $PackageId"
Write-Host "[MiniQuake] compiler: $Compiler"
if ($CompilerIsPython) {
Write-Host "[MiniQuake] compiler kind: Python reference compiler"
Write-Host "[MiniQuake] python: $PythonExe $($PythonPrefixArgs -join ' ')"
} else {
Write-Host "[MiniQuake] compiler kind: native self-hosted compiler"
}
Write-Host "[MiniQuake] source root: $Source"
Write-Host "[MiniQuake] std import root: $StdImportRoot"
if (-not $SkipPreflight -and $null -ne $PythonExe) {
Write-Host "[MiniQuake] running $PackageId diagnostics preflight"
$Verifier = Join-Path $Root "tools\verify.py"
if (-not (Test-Path -LiteralPath $Verifier -PathType Leaf)) {
throw "Baseline verifier is missing: $Verifier"
}
& $PythonExe @PythonPrefixArgs $Verifier --root $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId diagnostics preflight failed. The source tree or manifest is inconsistent."
}
# Guard the native renderer resource lifetimes and texture bounds that are
# difficult to exercise deterministically on every build host.
$NativeRendererSafetyChecker = Join-Path $Root "tools\check_native_renderer_safety.py"
if (-not (Test-Path -LiteralPath $NativeRendererSafetyChecker -PathType Leaf)) {
throw "Native renderer safety checker is missing: $NativeRendererSafetyChecker"
}
& $PythonExe @PythonPrefixArgs $NativeRendererSafetyChecker --root $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId native renderer safety preflight failed."
}
$RuntimeTestLogChecker = Join-Path $Root "tools\check_runtime_test_log.py"
if (-not (Test-Path -LiteralPath $RuntimeTestLogChecker -PathType Leaf)) {
throw "Runtime-test log checker is missing: $RuntimeTestLogChecker"
}
& $PythonExe @PythonPrefixArgs $RuntimeTestLogChecker --self-test
if ($LASTEXITCODE -ne 0) {
throw "$PackageId runtime-test log checker self-test failed."
}
$ProtocolVectorChecker = Join-Path $Root "tools\check_protocol15_vectors.py"
if (-not (Test-Path -LiteralPath $ProtocolVectorChecker -PathType Leaf)) {
throw "Protocol 15 vector checker is missing: $ProtocolVectorChecker"
}
& $PythonExe @PythonPrefixArgs $ProtocolVectorChecker $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId Protocol 15 vector preflight failed."
}
$ProtocolCommandChecker = Join-Path $Root "tools\check_protocol15_commands.py"
if (-not (Test-Path -LiteralPath $ProtocolCommandChecker -PathType Leaf)) {
throw "Protocol 15 command checker is missing: $ProtocolCommandChecker"
}
& $PythonExe @PythonPrefixArgs $ProtocolCommandChecker $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId Protocol 15 command-stream preflight failed."
}
$ProtocolServerDataChecker = Join-Path $Root "tools\check_protocol15_serverdata.py"
& $PythonExe @PythonPrefixArgs $ProtocolServerDataChecker --root $Root
if ($LASTEXITCODE -ne 0) { throw "$PackageId Protocol 15 server-data preflight failed." }
$ProtocolEventChecker = Join-Path $Root "tools\check_protocol15_events.py"
& $PythonExe @PythonPrefixArgs $ProtocolEventChecker --root $Root
if ($LASTEXITCODE -ne 0) { throw "$PackageId Protocol 15 event preflight failed." }
$ProtocolRuntimeEventChecker = Join-Path $Root "tools\check_protocol15_runtime_events.py"
& $PythonExe @PythonPrefixArgs $ProtocolRuntimeEventChecker --root $Root
if ($LASTEXITCODE -ne 0) { throw "$PackageId Protocol 15 runtime-event preflight failed." }
$ProtocolSignonChecker = Join-Path $Root "tools\check_protocol15_signon.py"
if (-not (Test-Path -LiteralPath $ProtocolSignonChecker -PathType Leaf)) {
throw "Protocol 15 signon checker is missing: $ProtocolSignonChecker"
}
& $PythonExe @PythonPrefixArgs $ProtocolSignonChecker --root $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId Protocol 15 signon preflight failed."
}
$ProtocolDeliveryChecker = Join-Path $Root "tools\check_protocol15_delivery.py"
if (-not (Test-Path -LiteralPath $ProtocolDeliveryChecker -PathType Leaf)) {
throw "Protocol 15 delivery checker is missing: $ProtocolDeliveryChecker"
}
& $PythonExe @PythonPrefixArgs $ProtocolDeliveryChecker --root $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId Protocol 15 reliable/unreliable delivery preflight failed."
}
$ProtocolDatagramChecker = Join-Path $Root "tools\check_protocol15_datagram.py"
if (-not (Test-Path -LiteralPath $ProtocolDatagramChecker -PathType Leaf)) {
throw "Protocol 15 datagram checker is missing: $ProtocolDatagramChecker"
}
& $PythonExe @PythonPrefixArgs $ProtocolDatagramChecker --root $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId Protocol 15 datagram/ACK/retransmission preflight failed."
}
$ProtocolDemoChecker = Join-Path $Root "tools\check_protocol15_demo.py"
if (-not (Test-Path -LiteralPath $ProtocolDemoChecker -PathType Leaf)) {
throw "Protocol 15 demo checker is missing: $ProtocolDemoChecker"
}
& $PythonExe @PythonPrefixArgs $ProtocolDemoChecker --root $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId Protocol 15 demo framing/recording/playback preflight failed."
}
$ProtocolClosureChecker = Join-Path $Root "tools\check_protocol15_closure.py"
if (-not (Test-Path -LiteralPath $ProtocolClosureChecker -PathType Leaf)) {
throw "Protocol 15 closure checker is missing: $ProtocolClosureChecker"
}
& $PythonExe @PythonPrefixArgs $ProtocolClosureChecker --root $Root
if ($LASTEXITCODE -ne 0) {
throw "$PackageId cumulative Protocol 15 closure/freeze preflight failed."
}
$QuakeCProgsChecker = Join-Path $Root "tools\check_quakec_progs.py"
if (-not (Test-Path -LiteralPath $QuakeCProgsChecker -PathType Leaf)) {
throw "BP-020 QuakeC progs.dat checker is missing: $QuakeCProgsChecker"
}
& $PythonExe @PythonPrefixArgs $QuakeCProgsChecker --root $Root
if ($LASTEXITCODE -ne 0) { throw "$PackageId BP-020 QuakeC progs.dat preflight failed." }
$QuakeCVMChecker = Join-Path $Root "tools\check_quakec_vm.py"
if (-not (Test-Path -LiteralPath $QuakeCVMChecker -PathType Leaf)) {
throw "BP-021 QuakeC VM checker is missing: $QuakeCVMChecker"
}
& $PythonExe @PythonPrefixArgs $QuakeCVMChecker --root $Root
if ($LASTEXITCODE -ne 0) { throw "$PackageId BP-021 QuakeC VM preflight failed." }
$QuakeCEdictChecker = Join-Path $Root "tools\check_quakec_edict.py"
if (-not (Test-Path -LiteralPath $QuakeCEdictChecker -PathType Leaf)) {
throw "BP-022 QuakeC edict checker is missing: $QuakeCEdictChecker"
}
& $PythonExe @PythonPrefixArgs $QuakeCEdictChecker --root $Root --allow-downstream-package
if ($LASTEXITCODE -ne 0) { throw "$PackageId BP-022 QuakeC edict preflight failed." }
$QuakeCBuiltinChecker = Join-Path $Root "tools\check_quakec_builtins.py"
if (-not (Test-Path -LiteralPath $QuakeCBuiltinChecker -PathType Leaf)) {
throw "BP-023 QuakeC builtin checker is missing: $QuakeCBuiltinChecker"
}
& $PythonExe @PythonPrefixArgs $QuakeCBuiltinChecker --root $Root
if ($LASTEXITCODE -ne 0) { throw "$PackageId BP-023 QuakeC builtin preflight failed." }
$QuakeCClosureChecker = Join-Path $Root "tools\check_quakec_closure.py"
if (-not (Test-Path -LiteralPath $QuakeCClosureChecker -PathType Leaf)) {
throw "BP-024R3 QuakeC closure checker is missing: $QuakeCClosureChecker"
}
& $PythonExe @PythonPrefixArgs $QuakeCClosureChecker --root $Root --allow-downstream-package
if ($LASTEXITCODE -ne 0) { throw "$PackageId BP-024R3 frozen QuakeC contract preflight failed." }
$WorldPhysicsCheckers = @(
[ordered]@{ Name = "BP-025 world hull"; Path = "tools\check_world_hull.py" },
[ordered]@{ Name = "BP-025 world trace"; Path = "tools\check_world_trace.py" },
[ordered]@{ Name = "BP-026 world link/collision"; Path = "tools\check_world_link.py" },
[ordered]@{ Name = "BP-027 server movement"; Path = "tools\check_server_move.py" },
[ordered]@{ Name = "BP-028 server physics"; Path = "tools\check_server_physics.py" },
[ordered]@{ Name = "BP-028 sv_user movement"; Path = "tools\check_sv_user_movement.py" },
[ordered]@{ Name = "BP-029 server user"; Path = "tools\check_server_user.py" },
[ordered]@{ Name = "BP-029 world/physics closure"; Path = "tools\check_world_physics_closure.py" }
)
foreach ($Checker in $WorldPhysicsCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
$CheckerArguments = @($Root)
if ($Checker.Path -eq "tools\check_world_physics_closure.py") {
$CheckerArguments += "--allow-downstream-package"
}
& $PythonExe @PythonPrefixArgs $CheckerPath @CheckerArguments
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$HostLifecycleCheckers = @(
[ordered]@{ Name = "BP-030 host timing"; Path = "tools\check_host_timing.py" },
[ordered]@{ Name = "BP-031 command/cvar lifecycle"; Path = "tools\check_command_cvar.py" },
[ordered]@{ Name = "BP-032 demo lifecycle"; Path = "tools\check_demo_lifecycle.py" },
[ordered]@{ Name = "BP-033 savegame v5"; Path = "tools\check_savegame_v5.py" },
[ordered]@{ Name = "BP-034 host lifecycle closure"; Path = "tools\check_host_lifecycle_closure.py" }
)
foreach ($Checker in $HostLifecycleCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
$CheckerArguments = @("--root", $Root)
if ($Checker.Path -eq "tools\check_command_cvar.py" -or
$Checker.Path -eq "tools\check_savegame_v5.py") {
$CheckerArguments += "--allow-downstream-package"
}
& $PythonExe @PythonPrefixArgs $CheckerPath @CheckerArguments
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$ClientRenderCheckers = @(
[ordered]@{ Name = "BP-035 client state/render"; Path = "tools\check_client_render_035.py" },
[ordered]@{ Name = "BP-036 view state"; Path = "tools\check_client_render_036.py" },
[ordered]@{ Name = "BP-037 temporary beam render"; Path = "tools\check_client_render_037.py" },
[ordered]@{ Name = "BP-038 particle runtime"; Path = "tools\check_client_render_038.py" },
[ordered]@{ Name = "BP-039 client/render closure"; Path = "tools\check_client_render_039.py" }
)
foreach ($Checker in $ClientRenderCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
$CheckerArguments = @("--root", $Root)
if ($Checker.Path -eq "tools\check_client_render_036.py") {
$CheckerArguments += "--allow-downstream-package"
}
& $PythonExe @PythonPrefixArgs $CheckerPath @CheckerArguments
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$WorldRenderCheckers = @(
[ordered]@{ Name = "BP-040 world surfaces"; Path = "tools\check_world_render_040.py" },
[ordered]@{ Name = "BP-041 lightmap atlas"; Path = "tools\check_world_render_041.py" },
[ordered]@{ Name = "BP-042 dynamic lights"; Path = "tools\check_world_render_042.py" },
[ordered]@{ Name = "BP-043 sky/water"; Path = "tools\check_world_render_043.py" },
[ordered]@{ Name = "BP-044 world/render closure"; Path = "tools\check_world_render_044.py" }
)
foreach ($Checker in $WorldRenderCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
& $PythonExe @PythonPrefixArgs $CheckerPath --root $Root
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$ModelUiRenderCheckers = @(
[ordered]@{ Name = "BP-045 alias model"; Path = "tools\bp045_alias_model_checker.py" },
[ordered]@{ Name = "BP-046 sprite sync"; Path = "tools\bp046_sprite_sync_checker.py" },
[ordered]@{ Name = "BP-047 2D/HUD"; Path = "tools\bp047_render_ui_checker.py" },
[ordered]@{ Name = "BP-048 render evidence"; Path = "tools\bp048_render_evidence_checker.py" },
[ordered]@{ Name = "BP-049 model/UI/render closure"; Path = "tools\bp049_model_ui_render_checker.py" }
)
foreach ($Checker in $ModelUiRenderCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
& $PythonExe @PythonPrefixArgs $CheckerPath
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
& $PythonExe @PythonPrefixArgs (Join-Path $Root "tools\compare_render_evidence.py") --self-test
if ($LASTEXITCODE -ne 0) { throw "$PackageId render evidence comparator self-test failed." }
$RenderSpecialCheckers = @(
[ordered]@{ Name = "BP-050 mirror special render"; Path = "tools\check_render_special_050.py" },
[ordered]@{ Name = "BP-051 render clear special"; Path = "tools\check_render_special_051.py" },
[ordered]@{ Name = "BP-052 envmap/timerefresh"; Path = "tools\check_render_special_052.py" },
[ordered]@{ Name = "BP-053 render-evidence corpus"; Path = "tools\check_render_special_053.py" },
[ordered]@{ Name = "BP-054 render-special closure"; Path = "tools\check_render_special_054.py" }
)
foreach ($Checker in $RenderSpecialCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
$CheckerArguments = @($CheckerPath, "--root", $Root)
if ($Checker.Name -eq "BP-054 render-special closure") {
$CheckerArguments += "--allow-downstream-package"
}
& $PythonExe @PythonPrefixArgs @CheckerArguments
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
& $PythonExe @PythonPrefixArgs (Join-Path $Root "tools\compare_render_corpus.py") --root $Root --self-test
if ($LASTEXITCODE -ne 0) { throw "$PackageId render-evidence corpus comparator self-test failed." }
$AudioCheckers = @(
[ordered]@{ Name = "BP-055 audio memory"; Path = "tools\check_audio_055.py" },
[ordered]@{ Name = "BP-056 audio DMA"; Path = "tools\check_audio_056.py" },
[ordered]@{ Name = "BP-057 audio mixer"; Path = "tools\check_audio_057.py" },
[ordered]@{ Name = "BP-058 audio Win32"; Path = "tools\check_audio_058.py" },
[ordered]@{ Name = "BP-059 audio closure"; Path = "tools\check_audio_059.py" }
)
foreach ($Checker in $AudioCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
& $PythonExe @PythonPrefixArgs $CheckerPath --root $Root
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$NetworkPlatformCheckers = @(
[ordered]@{ Name = "BP-060 network main"; Path = "tools\check_network_060.py" },
[ordered]@{ Name = "BP-061 network control"; Path = "tools\check_network_061.py" },
[ordered]@{ Name = "BP-062 WinSock address"; Path = "tools\check_network_062.py" },
[ordered]@{ Name = "BP-063 system/platform"; Path = "tools\check_network_063.py" },
[ordered]@{ Name = "BP-064 network/platform closure"; Path = "tools\check_network_064.py" }
)
foreach ($Checker in $NetworkPlatformCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
& $PythonExe @PythonPrefixArgs $CheckerPath --root $Root
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$FrontendCheckers = @(
[ordered]@{ Name = "BP-065 key/focus"; Path = "tools\check_frontend_065.py"; Arguments = @() },
[ordered]@{ Name = "BP-066 input device"; Path = "tools\check_frontend_066.py"; Arguments = @() },
[ordered]@{ Name = "BP-067 console/screen"; Path = "tools\check_frontend_067.py"; Arguments = @() },
[ordered]@{ Name = "BP-068 menu lifecycle"; Path = "tools\check_frontend_068.py"; Arguments = @() },
[ordered]@{ Name = "BP-069 frontend closure"; Path = "tools\check_frontend_069.py"; Arguments = @("--allow-downstream-package") }
)
foreach ($Checker in $FrontendCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
$CheckerArguments = @($Checker.Arguments)
& $PythonExe @PythonPrefixArgs $CheckerPath --root $Root @CheckerArguments
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$CoreAssetCheckers = @(
[ordered]@{ Name = "BP-070 common/CRC"; Path = "tools\check_core_070.py" },
[ordered]@{ Name = "BP-071 filesystem/PACK"; Path = "tools\check_asset_071.py" },
[ordered]@{ Name = "BP-072 WAD/graphics"; Path = "tools\check_core_072.py" },
[ordered]@{ Name = "BP-073 model assets"; Path = "tools\check_core_073.py" },
[ordered]@{ Name = "BP-074 core assets/memory closure"; Path = "tools\check_core_074.py" }
)
foreach ($Checker in $CoreAssetCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
& $PythonExe @PythonPrefixArgs $CheckerPath --root $Root
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$GameplayPresentationCheckers = @(
[ordered]@{ Name = "BP-075 math/chase"; Path = "tools\check_gameplay_075.py" },
[ordered]@{ Name = "BP-076 view/palette"; Path = "tools\check_gameplay_076.py" },
[ordered]@{ Name = "BP-077 screen/loading"; Path = "tools\check_gameplay_077.py" },
[ordered]@{ Name = "BP-078 statusbar/scoreboard"; Path = "tools\check_gameplay_078.py" },
[ordered]@{ Name = "BP-079 gameplay/presentation closure"; Path = "tools\check_gameplay_079.py" }
)
foreach ($Checker in $GameplayPresentationCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
& $PythonExe @PythonPrefixArgs $CheckerPath --root $Root
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$SourceClosureCheckers = @(
[ordered]@{ Name = "BP-080 cvar source surface"; Path = "tools\check_source_080.py" },
[ordered]@{ Name = "BP-081 CD audio source surface"; Path = "tools\check_source_081.py" },
[ordered]@{ Name = "BP-082 source function inventory"; Path = "tools\check_source_082.py" },
[ordered]@{ Name = "BP-083 black-port corpus"; Path = "tools\check_source_083.py" },
[ordered]@{ Name = "BP-084 source black-port closure"; Path = "tools\check_source_084.py" }
)
foreach ($Checker in $SourceClosureCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) {
throw ($Checker.Name + " checker is missing: " + $CheckerPath)
}
$ReportName = ([IO.Path]::GetFileNameWithoutExtension($Checker.Path) + "-report.json")
$ReportPath = Join-Path $Output $ReportName
$CheckerArgs = @("--root", $Root, "--json", $ReportPath)
if ($Checker.Path -eq "tools\check_source_084.py") { $CheckerArgs += "--allow-downstream-package" }
& $PythonExe @PythonPrefixArgs $CheckerPath @CheckerArgs
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
$CompatibilityCheckers = @(
[ordered]@{ Name = "BP-085 game profile"; Path = "tools\check_compat_085.py" },
[ordered]@{ Name = "BP-086 mod runtime"; Path = "tools\check_compat_086.py" },
[ordered]@{ Name = "BP-087 artifact compatibility"; Path = "tools\check_compat_087.py" },
[ordered]@{ Name = "BP-088 stability"; Path = "tools\check_compat_088.py" },
[ordered]@{ Name = "BP-089 compatibility release"; Path = "tools\check_compat_089.py" }
)
foreach ($Checker in $CompatibilityCheckers) {
$CheckerPath = Join-Path $Root $Checker.Path
if (-not (Test-Path -LiteralPath $CheckerPath -PathType Leaf)) { throw ($Checker.Name + " checker is missing: " + $CheckerPath) }
$ReportName = ([IO.Path]::GetFileNameWithoutExtension($Checker.Path) + "-report.json")
$ReportPath = Join-Path $Output $ReportName
$CheckerArgs = @("--root", $Root, "--json", $ReportPath, "--allow-downstream-package")
& $PythonExe @PythonPrefixArgs $CheckerPath @CheckerArgs
if ($LASTEXITCODE -ne 0) { throw ($PackageId + " " + $Checker.Name + " preflight failed.") }
}
} elseif ($SkipPreflight) {
Write-Warning "$PackageId diagnostics preflight was explicitly skipped."
} else {
Write-Warning "$PackageId static diagnostics preflight requires Python and is skipped for the native compiler. Pass -Python PATH or run 'python tools\verify.py --root .' separately."
}
if ($RebuildNative) {
$VorbisSource = Join-Path $Root "third_party\stb\stb_vorbis.c"
if (Test-Path -LiteralPath $VorbisSource -PathType Leaf) {
Write-Host "[MiniQuake] rebuilding full native bridge"
& $PythonExe @PythonPrefixArgs (Join-Path $Root "native\build_bridge.py") "--clean"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
} else {
Write-Warning "The supplied baseline does not contain third_party\stb\stb_vorbis.c; retaining the verified prebuilt miniquake_native.dll."
}
Write-Host "[MiniQuake] rebuilding reproducible buffered text bridge"
& $PythonExe @PythonPrefixArgs (Join-Path $Root "native\build_text_bridge.py") "--clean"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
# Copy a rebuilt native bridge only when its bytes changed.
function Copy-NativeBridgeIfChanged {
param(
[Parameter(Mandatory = $true)]
[string]$FileName
)
$SourceBridge = Join-Path $Root ("native\" + $FileName)
if (-not (Test-Path -LiteralPath $SourceBridge -PathType Leaf)) {
throw "Native bridge is missing: $SourceBridge"
}
$OutputBridge = Join-Path $Output $FileName
$CopyBridge = $true
if (Test-Path -LiteralPath $OutputBridge -PathType Leaf) {
$SourceBridgeHash = (Get-FileHash -Algorithm SHA256 -LiteralPath $SourceBridge).Hash
$OutputBridgeHash = (Get-FileHash -Algorithm SHA256 -LiteralPath $OutputBridge).Hash
$CopyBridge = $SourceBridgeHash -ne $OutputBridgeHash
}
if ($CopyBridge) {
Copy-Item -Force -LiteralPath $SourceBridge -Destination $OutputBridge
}
}
Copy-NativeBridgeIfChanged "miniquake_native.dll"
Copy-NativeBridgeIfChanged "miniquake_text.dll"
$CommonArgs = @(
"-I", $Source,
"-I", $StdImportRoot,
"--keep-going", "--max-errors", "50",
# Retail maps keep the BSP, alias frames and renderer command caches live at
# once, so reserve a 2 GiB address range while committing only the 512 MiB
# normally needed by one loaded game. The heap can grow in 64 MiB steps for
# unusually large mods. Host_Init's bounded periodic collection prevents
# per-frame temporaries from consuming the complete reservation; committing
# all 2 GiB up front made two multiplayer windows exhaust the machine's
# commit budget and appear frozen immediately after joining.
"--heap-reserve", "2g",
"--heap-commit", "512m",
"--heap-grow", "64m",
"--gc-limit", "256m"
)
if ($Configuration -ieq "Debug") {
$CommonArgs += @("--trace-calls")
}
if ($Listings) {
$CommonArgs += @("--asm", "--asm-pe", "--asm-data")
}
$IconToolExe = Join-Path $Output "tools\exe_icon_injector.exe"
if (-not $SkipIcon) {
if (-not (Test-Path -LiteralPath $IconToolSource -PathType Leaf)) {
throw "MiniQuake icon injector source is missing: $IconToolSource"
}
if (-not (Test-Path -LiteralPath $IconAsset -PathType Leaf)) {
throw "MiniQuake icon is missing: $IconAsset"
}
# The injector is a standalone console utility. It deliberately uses the
# same compiler and standard library as the game so the complete branding
# step remains reproducible from source without an external resource editor.
$IconToolArgs = @(
"-I", $Source,
"-I", $StdImportRoot,
"--keep-going", "--max-errors", "50",
"--subsystem", "console"
)
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $IconToolExe) | Out-Null
Write-Host "[MiniQuake] compiling icon injector $IconToolExe"
Invoke-MiniLangCompile -InputFile $IconToolSource -OutputFile $IconToolExe -CompilerArguments $IconToolArgs -Label "icon-injector"
} else {