Files
lingua-engine/scripts/stage-plugins.sh
T
EmilandClaude Sonnet 5 c6d9ff1a26 Add scripts/stage-plugins.sh and run-sample.sh for running the engine locally
Contracts and Implementation build into two separate bin/ folders, so
there's nowhere valid to point --plugins at without a staging step first
— every manual verification this session has done that staging by hand.
stage-plugins.sh does it for every plugin in one pass; run-sample.sh
stages then runs samples/WindowDemo windowed, forwarding extra args to
`engine run` (e.g. --screenshot).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1qPfzq8TDCUMFMV3UwV5N
2026-09-02 17:16:24 +03:00

38 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds every plugin and lays each one out into a single flat directory
# per id — plugin.json alongside its built DLLs — which is the layout
# PluginHost.Load actually expects. Needed because Contracts and
# Implementation build into two separate bin/ folders; without this step
# there's nowhere valid to point --plugins at.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
STAGE_DIR="${1:-$REPO_ROOT/.stage/plugins}"
CONFIG="${CONFIGURATION:-Debug}"
echo "Building solution ($CONFIG)..."
dotnet build "$REPO_ROOT/LinguaEngine.sln" -c "$CONFIG" >/dev/null
rm -rf "$STAGE_DIR"
mkdir -p "$STAGE_DIR"
for plugin_dir in "$REPO_ROOT"/plugins/*/; do
id="$(basename "$plugin_dir")"
[ -f "$plugin_dir/plugin.json" ] || continue
# engine.foo -> Engine.Foo (the Implementation project's folder name)
impl_name="$(awk -F. '{for(i=1;i<=NF;i++){$i=toupper(substr($i,1,1)) substr($i,2)}}1' OFS=. <<<"$id")"
impl_out="$plugin_dir/$impl_name/bin/$CONFIG/net9.0"
if [ ! -d "$impl_out" ]; then
echo "warning: no build output for '$id' at $impl_out, skipping" >&2
continue
fi
mkdir -p "$STAGE_DIR/$id"
cp -r "$impl_out/." "$STAGE_DIR/$id/"
cp "$plugin_dir/plugin.json" "$STAGE_DIR/$id/"
done
echo "Staged plugins into: $STAGE_DIR"