Files
Dreierpack-Manager/tools/modern/check_fork_calls.sh
T
ClaudeandClaude Opus 5.5 f2fcb28f65 Fork the Classic season core into src/modern and add the world layout (M1)
- src/modern/game: the season modules as bmh::modern, working on ModernState
  (a GameState). Data types stay shared with Classic; Modern code calls its
  season functions qualified (modern::...), so a missing Modern function is a
  compile error instead of a silent call into Classic.
- src/modern/app/modern_session: the session on the Modern core. It still uses
  the Classic UI projections until the Modern projections exist.
- SeasonHooks: the shared match core reaches player statistics and the table
  prediction of the season core that owns the game (Classic: unchanged).
- WorldLayout: team ranges, squad slots and pools of the running world. Shared
  code and the Modern fork read them; Classic keeps the original numbers.
- Transfer list views moved to game/transfer_offer_view.hpp (shared).
- tools/modern/check_fork_calls.sh, modern_season_sim and world_layout_tests.

Verified: Classic tests and replay regression unchanged; season_sim and
modern_season_sim produce identical output with Classic data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:08:54 +02:00

41 lines
1.9 KiB
Bash

#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-only
# check_fork_calls.sh BUILD_DIR - fails if a Modern library (LIBRARY, default bmh_season_modern)
# calls a Classic season
# function. Modern season code must call its own fork (namespace bmh::modern); a call that
# resolves to a function defined in one of the forked Classic sources means a Modern
# declaration is missing (see docs/new_engine). Windows/MSVC builds only (uses dumpbin).
#
# tools/modern/check_fork_calls.sh build
set -euo pipefail
build=${1:-build}
config=${CONFIG:-Release}
library=${LIBRARY:-bmh_season_modern}
dumpbin=${DUMPBIN:-$(ls -d "/c/Program Files/Microsoft Visual Studio/"*/*/VC/Tools/MSVC/*/bin/Hostx64/x64/dumpbin.exe 2>/dev/null | tail -1)}
[ -x "$dumpbin" ] || { echo "dumpbin not found (set DUMPBIN)" >&2; exit 2; }
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
symbols() { MSYS_NO_PATHCONV=1 "$dumpbin" /symbols "$1"; }
# Undefined external symbols of the Modern library.
symbols "$build/$config/$library.lib" |
awk '/External/ && /UNDEF/ { i = index($0, "| "); s = substr($0, i + 2); sub(/ \(.*/, "", s); print s }' |
sort -u > "$work/undef"
# Externals defined by the Classic objects that were forked (the Modern sources' names).
: > "$work/defs"
for source in src/modern/game/*.cpp; do
name=$(basename "$source" .cpp)
obj="$build/bmhcore.dir/$config/$name.obj"
[ -f "$obj" ] || continue
symbols "$obj" |
awk -v f="$name" '/External/ && !/UNDEF/ { i = index($0, "| "); s = substr($0, i + 2); d = s; sub(/ \(.*/, "", s); print s "\t" f "\t" d }' >> "$work/defs"
done
sort -t$'\t' -k1,1 -u "$work/defs" > "$work/defs.sorted"
join -t$'\t' "$work/undef" "$work/defs.sorted" > "$work/hits" || true
if [ -s "$work/hits" ]; then
echo "Modern season code calls Classic season functions:"
cut -f2,3 "$work/hits" | sed 's/^\([a-z_]*\)\t/\1: /'
exit 1
fi
echo "OK: $library calls no Classic season function."