48 lines
1.4 KiB
Bash
48 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||
|
||
build_rps () {
|
||
local RPS_SRC="$ROOT/Server/games-src/RPS"
|
||
local RPS_BIN="$RPS_SRC/RPS.Server/bin/Release/netstandard2.1"
|
||
local TG="$ROOT/Server/Server.Host.Tests/TestGames/rps"
|
||
|
||
# 不使用 -o:-o 会绕过 Private=false,把 Framework.Shared.dll 也拷进来。
|
||
dotnet build "$RPS_SRC/RPS.Server/RPS.Server.csproj" -c Release --no-incremental >/dev/null
|
||
|
||
# 断言框架程序集未进入构建输出(Private=false 回归保险)
|
||
if [ -f "$RPS_BIN/XWorld.Framework.Shared.dll" ]; then
|
||
echo "ERROR: Framework.Shared.dll 出现在构建输出 $RPS_BIN —— Private=false 可能被破坏" >&2
|
||
exit 1
|
||
fi
|
||
for dll in RPS.Core.dll RPS.Server.dll; do
|
||
if [ ! -f "$RPS_BIN/$dll" ]; then
|
||
echo "ERROR: 构建后缺少 $dll" >&2
|
||
exit 1
|
||
fi
|
||
done
|
||
|
||
# rps/1 = 真实版本;rps/2 = 同一批 IL(仅 version 字段不同),供版本号/淘汰/refcount 测试
|
||
for ver in 1 2; do
|
||
local out="$TG/$ver"
|
||
rm -rf "$out"; mkdir -p "$out"
|
||
cp "$RPS_BIN/RPS.Core.dll" "$out/RPS.Core.dll"
|
||
cp "$RPS_BIN/RPS.Server.dll" "$out/RPS.Server.dll"
|
||
cat > "$out/game.json" <<EOF
|
||
{
|
||
"gameId": "rps",
|
||
"version": $ver,
|
||
"serverAssembly": "RPS.Server.dll",
|
||
"serverEntryType": "RPS.Server.RpsServerRoom",
|
||
"minFrameworkVersion": 1,
|
||
"playerCount": 2,
|
||
"tickRateHz": 10
|
||
}
|
||
EOF
|
||
echo "built rps v$ver -> $out"
|
||
done
|
||
}
|
||
|
||
build_rps
|
||
echo "TestGames ready."
|