refactor(engines): move plugin engines into an Engines/ subfolder

Plugin engines (Opus55, Qwen, Terra) each add two projects at the repo
root, and more are coming; at a dozen they would outnumber the core
projects. They are also a different kind of thing: out-of-solution,
runtime-loaded plugins. Grouping them under Engines/ keeps the root
readable.

Engines/Directory.Build.props now holds the shared TFM, nullable and
implicit-usings settings and the OpenNest.Engine reference, so a new
engine's csproj is nearly empty. The tests/ compile exclusion lives in
Directory.Build.targets because a removal in .props runs before the SDK
adds its default Compile glob and has no effect.

Build-Engines.ps1 replaces the per-README manual build-and-copy steps
for deploying engines into the benchmark's runtime Engines/ folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
aj
2026-09-23 11:34:18 -04:00
co-authored by Claude Opus 5.5
parent cbef2f5e41
commit d42d7d0aab
12 changed files with 84 additions and 53 deletions
+40
View File
@@ -0,0 +1,40 @@
<#
.SYNOPSIS
Builds every plugin engine under Engines/ and deploys it to the benchmark.
.DESCRIPTION
OpenNest.Benchmark loads plugin engines from an Engines/ folder next to its own
build output. This builds the benchmark plus each Engines/OpenNest.Engine.*/ project
(test subprojects are skipped) and copies each engine DLL into that folder.
.EXAMPLE
./Engines/Build-Engines.ps1
./Engines/Build-Engines.ps1 -Engines Opus55,Terra -Configuration Debug
#>
param(
[string]$Configuration = 'Release',
# Engine names without the OpenNest.Engine. prefix; default is all of them.
[string[]]$Engines
)
$ErrorActionPreference = 'Stop'
$repoRoot = Split-Path $PSScriptRoot -Parent
dotnet build (Join-Path $repoRoot 'OpenNest.Benchmark/OpenNest.Benchmark.csproj') -c $Configuration
if ($LASTEXITCODE -ne 0) { throw 'OpenNest.Benchmark build failed.' }
$deployDir = Join-Path $repoRoot "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
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"
}
+15
View File
@@ -0,0 +1,15 @@
<Project>
<!--
Shared settings for out-of-solution nesting engine plugins. Each engine lives in
Engines/OpenNest.Engine.<Name>/ with an optional tests/ subproject; both import this.
AssemblyName and RootNamespace default to the project file name.
-->
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup>
</Project>
+10
View File
@@ -0,0 +1,10 @@
<Project>
<!--
Each engine's tests/ subproject sits inside the engine folder. This must live in a
.targets file: removals in Directory.Build.props run before the SDK adds its default
Compile glob, so they would have no effect.
-->
<ItemGroup>
<Compile Remove="tests/**/*.cs" />
</ItemGroup>
</Project>
@@ -1,14 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <!-- Shared settings and the OpenNest.Engine reference come from Engines/Directory.Build.props. -->
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>OpenNest.Engine.Opus55</RootNamespace>
<AssemblyName>OpenNest.Engine.Opus55</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="tests/**/*.cs" />
<InternalsVisibleTo Include="OpenNest.Engine.Opus55.Tests" /> <InternalsVisibleTo Include="OpenNest.Engine.Opus55.Tests" />
<ProjectReference Include="../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+5 -3
View File
@@ -61,8 +61,8 @@ Every placement decision (which part, which rotation, where, on which sheet) com
## Build / test ## Build / test
```bash ```bash
dotnet build OpenNest.Engine.Opus55/OpenNest.Engine.Opus55.csproj -c Release dotnet build Engines/OpenNest.Engine.Opus55/OpenNest.Engine.Opus55.csproj -c Release
dotnet test OpenNest.Engine.Opus55/tests/OpenNest.Engine.Opus55.Tests.csproj dotnet test Engines/OpenNest.Engine.Opus55/tests/OpenNest.Engine.Opus55.Tests.csproj
``` ```
This project is intentionally **outside** `OpenNest.sln`, the same pattern as the This project is intentionally **outside** `OpenNest.sln`, the same pattern as the
@@ -73,10 +73,12 @@ This project is intentionally **outside** `OpenNest.sln`, the same pattern as th
```bash ```bash
dotnet build OpenNest.Benchmark/OpenNest.Benchmark.csproj -c Release dotnet build OpenNest.Benchmark/OpenNest.Benchmark.csproj -c Release
mkdir -p OpenNest.Benchmark/bin/Release/net8.0/Engines mkdir -p OpenNest.Benchmark/bin/Release/net8.0/Engines
cp OpenNest.Engine.Opus55/bin/Release/net8.0/OpenNest.Engine.Opus55.dll OpenNest.Benchmark/bin/Release/net8.0/Engines/ cp Engines/OpenNest.Engine.Opus55/bin/Release/net8.0/OpenNest.Engine.Opus55.dll OpenNest.Benchmark/bin/Release/net8.0/Engines/
dotnet OpenNest.Benchmark/bin/Release/net8.0/OpenNest.Benchmark.dll <path-to-.nest-or-manifest-or-folder> dotnet OpenNest.Benchmark/bin/Release/net8.0/OpenNest.Benchmark.dll <path-to-.nest-or-manifest-or-folder>
``` ```
Or build and deploy in one step with `./Engines/Build-Engines.ps1 -Engines Opus55`.
The engine reports as `Opus55NestingEngine`. The engine reports as `Opus55NestingEngine`.
## Known limitations ## Known limitations
@@ -1,8 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject> <IsTestProject>true</IsTestProject>
</PropertyGroup> </PropertyGroup>
@@ -14,8 +11,7 @@
<ItemGroup> <ItemGroup>
<Using Include="Xunit" /> <Using Include="Xunit" />
<ProjectReference Include="../OpenNest.Engine.Opus55.csproj" /> <ProjectReference Include="../OpenNest.Engine.Opus55.csproj" />
<ProjectReference Include="../../OpenNest.Engine/OpenNest.Engine.csproj" />
<!-- The benchmark's NestValidator is the arbiter the engine is scored by. --> <!-- The benchmark's NestValidator is the arbiter the engine is scored by. -->
<ProjectReference Include="../../OpenNest.Benchmark/OpenNest.Benchmark.csproj" /> <ProjectReference Include="../../../OpenNest.Benchmark/OpenNest.Benchmark.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -1,13 +1,3 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <!-- Shared settings and the OpenNest.Engine reference come from Engines/Directory.Build.props. -->
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>OpenNest.Engine.Qwen</RootNamespace>
<AssemblyName>OpenNest.Engine.Qwen</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="tests/**/*.cs" />
<ProjectReference Include="../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup>
</Project> </Project>
+5 -3
View File
@@ -31,7 +31,7 @@ engines to start; it must not be the same algorithm re-derived through indirecti
## Build ## Build
```bash ```bash
dotnet build OpenNest.Engine.Qwen/OpenNest.Engine.Qwen.csproj dotnet build Engines/OpenNest.Engine.Qwen/OpenNest.Engine.Qwen.csproj
``` ```
This project is intentionally **outside** `OpenNest.sln` (same pattern as the This project is intentionally **outside** `OpenNest.sln` (same pattern as the
@@ -44,14 +44,16 @@ as part of the main solution.
own build output: own build output:
```bash ```bash
dotnet build OpenNest.Engine.Qwen/OpenNest.Engine.Qwen.csproj -c Release dotnet build Engines/OpenNest.Engine.Qwen/OpenNest.Engine.Qwen.csproj -c Release
dotnet build OpenNest.Benchmark/OpenNest.Benchmark.csproj -c Release dotnet build OpenNest.Benchmark/OpenNest.Benchmark.csproj -c Release
mkdir -p OpenNest.Benchmark/bin/Release/net8.0/Engines mkdir -p OpenNest.Benchmark/bin/Release/net8.0/Engines
cp OpenNest.Engine.Qwen/bin/Release/net8.0/OpenNest.Engine.Qwen.dll OpenNest.Benchmark/bin/Release/net8.0/Engines/ cp Engines/OpenNest.Engine.Qwen/bin/Release/net8.0/OpenNest.Engine.Qwen.dll OpenNest.Benchmark/bin/Release/net8.0/Engines/
dotnet OpenNest.Benchmark/bin/Release/net8.0/OpenNest.Benchmark.dll <path-to-.nest-or-folder> dotnet OpenNest.Benchmark/bin/Release/net8.0/OpenNest.Benchmark.dll <path-to-.nest-or-folder>
``` ```
Or build and deploy in one step with `./Engines/Build-Engines.ps1 -Engines Qwen`.
Your engine will show up in the report under its CLR type name (`QwenNestingEngine`), Your engine will show up in the report under its CLR type name (`QwenNestingEngine`),
competing on equal footing against the built-in engines. competing on equal footing against the built-in engines.
@@ -1,8 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject> <IsTestProject>true</IsTestProject>
</PropertyGroup> </PropertyGroup>
@@ -14,6 +11,5 @@
<ItemGroup> <ItemGroup>
<Using Include="Xunit" /> <Using Include="Xunit" />
<ProjectReference Include="../OpenNest.Engine.Qwen.csproj" /> <ProjectReference Include="../OpenNest.Engine.Qwen.csproj" />
<ProjectReference Include="../../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -1,13 +1,3 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <!-- Shared settings and the OpenNest.Engine reference come from Engines/Directory.Build.props. -->
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>OpenNest.Engine.Terra</RootNamespace>
<AssemblyName>OpenNest.Engine.Terra</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="tests/**/*.cs" />
<ProjectReference Include="../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup>
</Project> </Project>
+5 -3
View File
@@ -31,7 +31,7 @@ engines to start; it must not be the same algorithm re-derived through indirecti
## Build ## Build
```bash ```bash
dotnet build OpenNest.Engine.Terra/OpenNest.Engine.Terra.csproj dotnet build Engines/OpenNest.Engine.Terra/OpenNest.Engine.Terra.csproj
``` ```
This project is intentionally **outside** `OpenNest.sln` (same pattern as the This project is intentionally **outside** `OpenNest.sln` (same pattern as the
@@ -44,14 +44,16 @@ as part of the main solution.
own build output: own build output:
```bash ```bash
dotnet build OpenNest.Engine.Terra/OpenNest.Engine.Terra.csproj -c Release dotnet build Engines/OpenNest.Engine.Terra/OpenNest.Engine.Terra.csproj -c Release
dotnet build OpenNest.Benchmark/OpenNest.Benchmark.csproj -c Release dotnet build OpenNest.Benchmark/OpenNest.Benchmark.csproj -c Release
mkdir -p OpenNest.Benchmark/bin/Release/net8.0/Engines mkdir -p OpenNest.Benchmark/bin/Release/net8.0/Engines
cp OpenNest.Engine.Terra/bin/Release/net8.0/OpenNest.Engine.Terra.dll OpenNest.Benchmark/bin/Release/net8.0/Engines/ cp Engines/OpenNest.Engine.Terra/bin/Release/net8.0/OpenNest.Engine.Terra.dll OpenNest.Benchmark/bin/Release/net8.0/Engines/
dotnet OpenNest.Benchmark/bin/Release/net8.0/OpenNest.Benchmark.dll <path-to-.nest-or-folder> dotnet OpenNest.Benchmark/bin/Release/net8.0/OpenNest.Benchmark.dll <path-to-.nest-or-folder>
``` ```
Or build and deploy in one step with `./Engines/Build-Engines.ps1 -Engines Terra`.
Your engine will show up in the report under its CLR type name (`TerraNestingEngine`), Your engine will show up in the report under its CLR type name (`TerraNestingEngine`),
competing on equal footing against the built-in engines. competing on equal footing against the built-in engines.
@@ -1,8 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject> <IsTestProject>true</IsTestProject>
</PropertyGroup> </PropertyGroup>
@@ -14,6 +11,5 @@
<ItemGroup> <ItemGroup>
<Using Include="Xunit" /> <Using Include="Xunit" />
<ProjectReference Include="../OpenNest.Engine.Terra.csproj" /> <ProjectReference Include="../OpenNest.Engine.Terra.csproj" />
<ProjectReference Include="../../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>