Files
OpenNest-Engines/Build-Engines.ps1
T
ajandClaude Opus 5.5 cfce484952 build: stand alone from the OpenNest repo
Engines are moving out of OpenNest so they can be published on their own
and so OpenNest checkouts handed to a model for an engine-building run no
longer contain the competing engines. History for Engines/ (and the
pre-move root-level engine folders) was carried over with git filter-repo.

Engines now build against a sibling OpenNest clone via $(OpenNestRoot),
overridable with /p:OpenNestRoot, with a clear error when it is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 10:01:19 -04:00

48 lines
2.1 KiB
PowerShell

<#
.SYNOPSIS
Builds every plugin engine in this repo and deploys it to the OpenNest benchmark.
.DESCRIPTION
OpenNest.Benchmark loads plugin engines from an Engines/ folder next to its own
build output. This builds the benchmark in the OpenNest checkout plus each
OpenNest.Engine.*/ project here (test subprojects are skipped) and copies each
engine DLL into that folder.
.EXAMPLE
./Build-Engines.ps1
./Build-Engines.ps1 -Engines MyEngine -Configuration Debug
./Build-Engines.ps1 -OpenNestRoot D:/src/OpenNest
#>
param(
[string]$Configuration = 'Release',
# Engine names without the OpenNest.Engine. prefix; default is all of them.
[string[]]$Engines,
# OpenNest checkout to build against; defaults to a sibling clone (../OpenNest).
[string]$OpenNestRoot = (Join-Path (Split-Path $PSScriptRoot -Parent) 'OpenNest')
)
$ErrorActionPreference = 'Stop'
if (-not (Test-Path (Join-Path $OpenNestRoot 'OpenNest.Benchmark/OpenNest.Benchmark.csproj'))) {
throw "OpenNest checkout not found at '$OpenNestRoot'. Clone https://git.thecozycat.net/aj/OpenNest.git next to this repo or pass -OpenNestRoot."
}
$OpenNestRoot = (Resolve-Path $OpenNestRoot).Path
dotnet build (Join-Path $OpenNestRoot 'OpenNest.Benchmark/OpenNest.Benchmark.csproj') -c $Configuration
if ($LASTEXITCODE -ne 0) { throw 'OpenNest.Benchmark build failed.' }
$deployDir = Join-Path $OpenNestRoot "OpenNest.Benchmark/bin/$Configuration/net8.0/Engines"
New-Item -ItemType Directory -Force $deployDir | Out-Null
$projects = Get-ChildItem $PSScriptRoot -Directory -Filter 'OpenNest.Engine.*' |
Where-Object { -not $Engines -or $Engines -contains $_.Name.Substring('OpenNest.Engine.'.Length) }
foreach ($dir in $projects) {
$csproj = Join-Path $dir.FullName "$($dir.Name).csproj"
dotnet build $csproj -c $Configuration "-p:OpenNestRoot=$OpenNestRoot/"
if ($LASTEXITCODE -ne 0) { throw "$($dir.Name) build failed." }
$dll = Join-Path $dir.FullName "bin/$Configuration/net8.0/$($dir.Name).dll"
Copy-Item $dll $deployDir -Force
Write-Host "Deployed $($dir.Name) -> $deployDir"
}