|
| 1 | +#!/usr/bin/env bash |
| 2 | +# CI-Strict Build Script |
| 3 | +# This script matches the exact build process used in CI to catch issues locally |
| 4 | +# Usage: ./scripts/build-ci-strict.sh |
| 5 | + |
| 6 | +set -e |
| 7 | + |
| 8 | +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 9 | +ROOT_DIR="$(cd "$DIR/.." && pwd)" |
| 10 | + |
| 11 | +cd "$ROOT_DIR" |
| 12 | + |
| 13 | +echo "==========================================" |
| 14 | +echo "CI-Strict Build (matches GitHub Actions)" |
| 15 | +echo "==========================================" |
| 16 | + |
| 17 | +# Clean up any running processes |
| 18 | +echo "Cleaning up processes..." |
| 19 | +pkill -f "$(pwd)/out/main.js" || true |
| 20 | +pkill -f "$(pwd)/out-build/main.js" || true |
| 21 | + |
| 22 | +# Remove React build output to force fresh build (matches CI) |
| 23 | +echo "Removing old React build output..." |
| 24 | +if [[ -d "src/vs/workbench/contrib/void/browser/react/out" ]]; then |
| 25 | + echo "Removing void React build output..." |
| 26 | + rm -rf src/vs/workbench/contrib/void/browser/react/out |
| 27 | +fi |
| 28 | +if [[ -d "src/vs/workbench/contrib/cortexide/browser/react/out" ]]; then |
| 29 | + echo "Removing cortexide React build output..." |
| 30 | + rm -rf src/vs/workbench/contrib/cortexide/browser/react/out |
| 31 | +fi |
| 32 | + |
| 33 | +# Set memory limit (matches CI) |
| 34 | +export NODE_OPTIONS="--max-old-space-size=12288" |
| 35 | + |
| 36 | +# Build React components first (required for CortexIDE UI) |
| 37 | +echo "" |
| 38 | +echo "Building React components..." |
| 39 | +if ! npm run buildreact; then |
| 40 | + echo "ERROR: React build failed. This is required for TypeScript compilation." |
| 41 | + echo "Please check the React build output above for errors." |
| 42 | + exit 1 |
| 43 | +fi |
| 44 | + |
| 45 | +# Verify React build outputs exist before proceeding |
| 46 | +if [[ ! -d "src/vs/workbench/contrib/cortexide/browser/react/out" ]]; then |
| 47 | + echo "ERROR: React build outputs missing at src/vs/workbench/contrib/cortexide/browser/react/out" |
| 48 | + echo "Cannot proceed with TypeScript compilation." |
| 49 | + exit 1 |
| 50 | +fi |
| 51 | + |
| 52 | +echo "✓ React build completed successfully. Outputs verified." |
| 53 | + |
| 54 | +# Compile build directory TypeScript first (required for gulp tasks) |
| 55 | +echo "" |
| 56 | +echo "Compiling build directory TypeScript..." |
| 57 | +npm run --prefix build build-ts |
| 58 | + |
| 59 | +# Compile the main codebase using CI-strict compilation |
| 60 | +# This uses compile-build-without-mangling (same as CI) |
| 61 | +echo "" |
| 62 | +echo "Compiling TypeScript (CI-strict mode)..." |
| 63 | +npm run compile:ci |
| 64 | + |
| 65 | +# Compile extension media assets |
| 66 | +echo "" |
| 67 | +echo "Compiling extension media..." |
| 68 | +npm run gulp compile-extension-media |
| 69 | + |
| 70 | +echo "" |
| 71 | +echo "==========================================" |
| 72 | +echo "✓ CI-Strict build completed successfully!" |
| 73 | +echo "==========================================" |
| 74 | +echo "" |
| 75 | +echo "This build matches the CI process exactly." |
| 76 | +echo "If this passes, your code should build successfully in CI." |
| 77 | + |
0 commit comments