Skip to content

Commit 71e2451

Browse files
committed
Add build.sh to help claude. Add tmp to avoid polluting the main directory with issues claude is investigating
1 parent b578d62 commit 71e2451

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.perspective
88
*.perspectivev3
99
build/
10+
tmp/
1011
.DS_Store
1112
canary.xml
1213
testing.xml

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Don't create dependency cycles. Use delegates or closures instead.
99
- To run unit tests in ModernTests, use tools/run_tests.expect. It takes an argument naming the test or tests, such as `tools/run_tests.expect ModernTests/iTermScriptFunctionCallTest/testSignature`
1010
- When renaming a file tracked by git (and almost all of them are) use `git mv` instead of `mv`
11-
- To make a debug build run `make Development`
11+
- To make a debug build run `tools/build.sh` (or `tools/build.sh Development`). This saves logs to `tmp/build.log` and shows only errors/warnings on failure.
1212
- Little scripts or text files that are used for manual testing of features go in tests/
1313
- The deployment target for iTerm2 is macOS 12. You don't need to perform availability checks for older versions.
1414
- Don't replace curly quotes with straight quotes. Same for apostrophes and single quotes.

tools/build.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# Build script that filters output to show only errors and warnings
3+
# Usage: tools/build.sh [configuration]
4+
# Configuration defaults to Development
5+
6+
set -o pipefail
7+
8+
CONFIG="${1:-Development}"
9+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
10+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
11+
TMP_DIR="$PROJECT_DIR/tmp"
12+
LOG_FILE="$TMP_DIR/build.log"
13+
14+
# Create tmp directory if needed
15+
mkdir -p "$TMP_DIR"
16+
17+
echo "Building $CONFIG configuration..."
18+
echo "Full log: $LOG_FILE"
19+
20+
# Run the build and capture output
21+
cd "$PROJECT_DIR"
22+
make "$CONFIG" > "$LOG_FILE" 2>&1
23+
BUILD_STATUS=$?
24+
25+
if [ $BUILD_STATUS -eq 0 ]; then
26+
echo "Build succeeded."
27+
exit 0
28+
fi
29+
30+
echo ""
31+
echo "Build failed. Errors and warnings:"
32+
echo "-----------------------------------"
33+
34+
# Extract errors and warnings, filtering out noise
35+
# Look for compiler errors/warnings with file:line:column format
36+
grep -E "^/.*:\d+:\d+: (error|warning):" "$LOG_FILE" | head -50
37+
38+
# Also check for linker errors
39+
grep -E "^(ld|clang): error:" "$LOG_FILE" | head -10
40+
41+
# Check for Swift errors (different format)
42+
grep -E "error: " "$LOG_FILE" | grep -v "CLANG_WARN\|GCC_TREAT\|export " | head -20
43+
44+
# Show the failure summary
45+
echo ""
46+
echo "-----------------------------------"
47+
grep -E "\([0-9]+ (error|warning|failure)" "$LOG_FILE" | tail -5
48+
49+
exit $BUILD_STATUS

0 commit comments

Comments
 (0)