Merge branch 'refactor/engines-subfolder'

This commit is contained in:
aj
2026-09-23 11:42:39 -04:00
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">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>OpenNest.Engine.Opus55</RootNamespace>
<AssemblyName>OpenNest.Engine.Opus55</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- Shared settings and the OpenNest.Engine reference come from Engines/Directory.Build.props. -->
<ItemGroup>
<Compile Remove="tests/**/*.cs" />
<InternalsVisibleTo Include="OpenNest.Engine.Opus55.Tests" />
<ProjectReference Include="../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup>
</Project>
+5 -3
View File
@@ -61,8 +61,8 @@ Every placement decision (which part, which rotation, where, on which sheet) com
## Build / test
```bash
dotnet build OpenNest.Engine.Opus55/OpenNest.Engine.Opus55.csproj -c Release
dotnet test OpenNest.Engine.Opus55/tests/OpenNest.Engine.Opus55.Tests.csproj
dotnet build Engines/OpenNest.Engine.Opus55/OpenNest.Engine.Opus55.csproj -c Release
dotnet test Engines/OpenNest.Engine.Opus55/tests/OpenNest.Engine.Opus55.Tests.csproj
```
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
dotnet build OpenNest.Benchmark/OpenNest.Benchmark.csproj -c Release
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>
```
Or build and deploy in one step with `./Engines/Build-Engines.ps1 -Engines Opus55`.
The engine reports as `Opus55NestingEngine`.
## Known limitations
@@ -1,8 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
@@ -14,8 +11,7 @@
<ItemGroup>
<Using Include="Xunit" />
<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. -->
<ProjectReference Include="../../OpenNest.Benchmark/OpenNest.Benchmark.csproj" />
<ProjectReference Include="../../../OpenNest.Benchmark/OpenNest.Benchmark.csproj" />
</ItemGroup>
</Project>
@@ -1,13 +1,3 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<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>
<!-- Shared settings and the OpenNest.Engine reference come from Engines/Directory.Build.props. -->
</Project>
+5 -3
View File
@@ -31,7 +31,7 @@ engines to start; it must not be the same algorithm re-derived through indirecti
## Build
```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
@@ -44,14 +44,16 @@ as part of the main solution.
own build output:
```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
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>
```
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`),
competing on equal footing against the built-in engines.
@@ -1,8 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
@@ -14,6 +11,5 @@
<ItemGroup>
<Using Include="Xunit" />
<ProjectReference Include="../OpenNest.Engine.Qwen.csproj" />
<ProjectReference Include="../../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup>
</Project>
@@ -1,13 +1,3 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<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>
<!-- Shared settings and the OpenNest.Engine reference come from Engines/Directory.Build.props. -->
</Project>
+5 -3
View File
@@ -31,7 +31,7 @@ engines to start; it must not be the same algorithm re-derived through indirecti
## Build
```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
@@ -44,14 +44,16 @@ as part of the main solution.
own build output:
```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
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>
```
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`),
competing on equal footing against the built-in engines.
@@ -1,8 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
@@ -14,6 +11,5 @@
<ItemGroup>
<Using Include="Xunit" />
<ProjectReference Include="../OpenNest.Engine.Terra.csproj" />
<ProjectReference Include="../../OpenNest.Engine/OpenNest.Engine.csproj" />
</ItemGroup>
</Project>