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
This commit is contained in:
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stages every plugin, then runs samples/WindowDemo windowed. Extra args
|
||||
# are forwarded to `engine run` — e.g. ./run-sample.sh --screenshot out.png
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
CONFIG="${CONFIGURATION:-Debug}"
|
||||
STAGE_DIR="$REPO_ROOT/.stage/plugins"
|
||||
|
||||
"$REPO_ROOT/scripts/stage-plugins.sh" "$STAGE_DIR"
|
||||
|
||||
cd "$REPO_ROOT/samples/WindowDemo"
|
||||
exec dotnet "$REPO_ROOT/src/Engine.Host/bin/$CONFIG/net9.0/Engine.Host.dll" run --windowed \
|
||||
--plugins "$STAGE_DIR" --project project.json --scene scene.json "$@"
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user