Restore elementtracker.h and add build logging

- Restore missing elementtracker.h in wxWidgets (required for E2E tests)
- Add automatic log file redirection for build scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-01-03 11:55:54 +01:00
commit ea5dc26a96
5 changed files with 58 additions and 1 deletions

View file

@ -1,5 +1,8 @@
#!/bin/bash
# Build KiCad WASM inside Docker container, then apply asyncify on host
# Redirect all output to a log file (re-execs script with redirection)
source "$(dirname "$0")/../scripts/common/logging.sh"
#
# The build is split into two phases:
# 1. Docker: Compile KiCad to WASM (without asyncify)

View file

@ -1,5 +1,8 @@
#!/bin/bash
# Build the wxWidgets WASM test applications
# Redirect all output to a log file (re-execs script with redirection)
source "$(dirname "$0")/common/logging.sh"
# This script creates library symlinks and builds the test apps
#
# Usage:

View file

@ -1,5 +1,8 @@
#!/bin/bash
# Build wxWidgets with wxUniversal for WebAssembly
# Redirect all output to a log file (re-execs script with redirection)
source "$(dirname "$0")/common/logging.sh"
# This builds the GUI-enabled wxWidgets needed for KiCad
#
# Prerequisites:

48
scripts/common/logging.sh Normal file
View file

@ -0,0 +1,48 @@
#!/bin/bash
# Automatic log file redirection for build scripts
#
# Source this at the top of build scripts to redirect all output to a log file.
# Uses self-re-exec pattern: the script re-launches itself with external redirection,
# which reliably captures ALL output including docker compose TTY output.
#
# Detection logic:
# - If KICAD_LOG_NESTED=1 (re-exec'd or nested call) → output normally
# - If inside Docker (/workspace exists) → output normally
# - Otherwise → re-exec with output redirected to logs/<script>/<timestamp>.log
# Skip if already logging (re-exec'd or nested call)
if [[ "${KICAD_LOG_NESTED:-0}" == "1" ]]; then
return 0 2>/dev/null || exit 0
fi
# Skip if inside Docker container
if [[ -d "/workspace" ]]; then
return 0 2>/dev/null || exit 0
fi
# Get the calling script's absolute path
_CALLER_DIR="$(cd "$(dirname "${BASH_SOURCE[1]}")" && pwd)"
_CALLER_SCRIPT="${_CALLER_DIR}/$(basename "${BASH_SOURCE[1]}")"
_SCRIPT_NAME="$(basename "${_CALLER_SCRIPT}" .sh)"
# Find project root (walk up looking for .git)
_PROJECT_ROOT="${_CALLER_DIR}"
while [[ ! -d "${_PROJECT_ROOT}/.git" ]] && [[ "${_PROJECT_ROOT}" != "/" ]]; do
_PROJECT_ROOT="$(dirname "${_PROJECT_ROOT}")"
done
# Set up log file
_LOGS_DIR="${_PROJECT_ROOT}/logs/${_SCRIPT_NAME}"
_TIMESTAMP="$(date +%Y%m%d-%H%M%S)"
_LOG_FILE="${_LOGS_DIR}/${_TIMESTAMP}.log"
mkdir -p "${_LOGS_DIR}"
# Show log path before re-exec
echo "Logging to: ${_LOG_FILE}"
# Re-exec the calling script with output redirected
# This is equivalent to: ./script.sh > logfile 2>&1
# and reliably captures ALL output including docker compose TTY messages
export KICAD_LOG_NESTED=1
exec "${_CALLER_SCRIPT}" "$@" > "${_LOG_FILE}" 2>&1

@ -1 +1 @@
Subproject commit a63f35f88dc4039d979455876f7837adbfc089b2
Subproject commit 4c8ef179b8539f24b3c2ddd8bf2dc8bf1af1cc1a