Files
recordingtest/docs/guides/engine-bridge-deploy.md

98 lines
3.4 KiB
Markdown

# engine-bridge v2 Deployment Guide
This guide explains how to deploy `Recordingtest.EgPlugin.dll` into the SUT
(`EG-BIM Modeler`) so the recordingtest harness can read live HmEG state over
HTTP. Issue #10.
## 1. Build
```
dotnet publish src/Recordingtest.EgPlugin -c Release
```
Output: `src/Recordingtest.EgPlugin/bin/Release/net8.0-windows/publish/`
- `Recordingtest.EgPlugin.dll`
- `Recordingtest.EgPlugin.deps.json`
- `Recordingtest.EgPlugin.pdb`
`Editor03.PluginInterface.dll` and `HmEG.dll` are referenced with
`<Private>false</Private>`, so the plugin output **does not** include copies
of the SUT contracts. The plugin will bind to whatever the SUT loads at
runtime.
## 2. Copy into SUT Plugins folder
> **Important:** writing into `EG-BIM Modeler/` is normally blocked by the
> repo guard hook. Ask the operator before performing the copy step. The
> copy is intentionally a manual operation.
Create a per-plugin folder under `EG-BIM Modeler/Plugins/` and copy the
publish output:
```
mkdir "EG-BIM Modeler\Plugins\Recordingtest.EgPlugin"
copy src\Recordingtest.EgPlugin\bin\Release\net8.0-windows\publish\Recordingtest.EgPlugin.dll "EG-BIM Modeler\Plugins\Recordingtest.EgPlugin\"
copy src\Recordingtest.EgPlugin\bin\Release\net8.0-windows\publish\Recordingtest.EgPlugin.deps.json "EG-BIM Modeler\Plugins\Recordingtest.EgPlugin\"
```
`runtimeconfig.json` is not produced for class library projects; the SUT
hosts the CLR. If a future change makes the plugin executable, also copy
`Recordingtest.EgPlugin.runtimeconfig.json`.
## 3. Configure environment (optional)
The plugin listens on `http://localhost:38080/` by default. Override with:
```
set RECORDINGTEST_BRIDGE_PORT=38090
```
The variable is read once at plugin construction.
## 4. Launch SUT
Start `EG-BIM Modeler.exe` normally. The SUT's `HmEG.PluginLoader` walks
`Plugins/` at startup and loads any DLL whose type derives from
`HmEG.IPlugin` (our plugin inherits `Editor.PluginInterface.EditorPlugin`,
which implements `IPlugin`).
## 5. Verify
```
curl http://localhost:38080/health
```
Expected:
```
{"status":"ok","port":38080}
```
Other endpoints:
- `GET /selection` -> `{"selected_ids":[...]}`
- `GET /camera` -> `{"eye":[..],"target":[..],"up":[..],"fov":n}`
- `GET /scene` -> `{"object_count":n,"document_path":"..."}`
- `GET /render` -> `{"complete":true|false}`
The recordingtest client (`HmEgHttpSnapshot`) is the supported consumer.
## 6. Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| `curl` connection refused | port already in use OR plugin failed to load | check SUT log under `EG-BIM Modeler/hmlogs/`, set a different `RECORDINGTEST_BRIDGE_PORT` |
| `Could not load file or assembly Editor03.PluginInterface` | Wrong contract version dropped next to plugin | delete any local copy of `Editor03.PluginInterface.dll` from the plugin folder; the SUT must resolve it from its own folder |
| Plugin loaded but `/health` 404 | SUT started a different `Plugins/Recordingtest.EgPlugin/` build | clean the folder and re-copy publish output |
| `HttpListener` access denied (Windows) | URL ACL not registered | run SUT elevated once, or `netsh http add urlacl url=http://localhost:38080/ user=Everyone` |
SUT log location: `EG-BIM Modeler/hmlogs/` (Serilog rolling files).
## 7. Uninstall
```
rmdir /s /q "EG-BIM Modeler\Plugins\Recordingtest.EgPlugin"
```
No registry, no services, no env vars beyond optional `RECORDINGTEST_BRIDGE_PORT`.