feat: Improve CMake configuration and build environment verification
- Enabled JSON support by default in CMake to resolve Windows build issues. - Added checks for the existence of the JSON library and its target, providing clear error messages if missing. - Updated README with instructions for building with AI features. - Enhanced the build environment verification script for better feedback on setup issues and added checks for agent folder structure. - Introduced new CMake presets for AI-enabled builds and collaboration support.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
# YAZE Build Environment Verification Script for macOS/Linux
|
||||
# YAZE Build Environment Verification Script for Unix/macOS
|
||||
# This script verifies the build environment is properly configured and ready to build
|
||||
# Run this before building to catch common configuration issues early
|
||||
|
||||
set -e
|
||||
|
||||
@@ -12,89 +13,82 @@ BLUE='\033[0;34m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Flags
|
||||
VERBOSE=0
|
||||
FIX_ISSUES=0
|
||||
CLEAN_CACHE=0
|
||||
|
||||
issues_found=()
|
||||
warnings=()
|
||||
successes=()
|
||||
# Counters
|
||||
ISSUES_FOUND=()
|
||||
WARNINGS=()
|
||||
SUCCESS=()
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--verbose|-v)
|
||||
VERBOSE=1
|
||||
shift
|
||||
;;
|
||||
--fix|-f)
|
||||
FIX_ISSUES=1
|
||||
shift
|
||||
;;
|
||||
--clean|-c)
|
||||
CLEAN_CACHE=1
|
||||
shift
|
||||
;;
|
||||
--help|-h)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --verbose, -v Show detailed output"
|
||||
echo " --fix, -f Automatically fix issues"
|
||||
echo " --clean, -c Clean CMake cache"
|
||||
echo " --help, -h Show this help message"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case $1 in
|
||||
-v|--verbose)
|
||||
VERBOSE=1
|
||||
shift
|
||||
;;
|
||||
-f|--fix)
|
||||
FIX_ISSUES=1
|
||||
shift
|
||||
;;
|
||||
-c|--clean)
|
||||
CLEAN_CACHE=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo "Options:"
|
||||
echo " -v, --verbose Verbose output"
|
||||
echo " -f, --fix Automatically fix issues"
|
||||
echo " -c, --clean Clean CMake cache"
|
||||
echo " -h, --help Show this help message"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
print_status() {
|
||||
local type=$1
|
||||
local message=$2
|
||||
function write_status() {
|
||||
local message="$1"
|
||||
local type="${2:-Info}"
|
||||
local timestamp=$(date +"%H:%M:%S")
|
||||
|
||||
case $type in
|
||||
success)
|
||||
case "$type" in
|
||||
Success)
|
||||
echo -e "[$timestamp] ${GREEN}✓${NC} $message"
|
||||
;;
|
||||
error)
|
||||
Error)
|
||||
echo -e "[$timestamp] ${RED}✗${NC} $message"
|
||||
;;
|
||||
warning)
|
||||
Warning)
|
||||
echo -e "[$timestamp] ${YELLOW}⚠${NC} $message"
|
||||
;;
|
||||
info)
|
||||
Info)
|
||||
echo -e "[$timestamp] ${CYAN}ℹ${NC} $message"
|
||||
;;
|
||||
step)
|
||||
echo ""
|
||||
echo -e "[$timestamp] ${BLUE}▶${NC} ${BLUE}$message${NC}"
|
||||
Step)
|
||||
echo -e "\n[$timestamp] ${BLUE}▶${NC} $message"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_command() {
|
||||
if command -v "$1" &> /dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
function test_command() {
|
||||
command -v "$1" &> /dev/null
|
||||
}
|
||||
|
||||
function get_cmake_version() {
|
||||
if test_command cmake; then
|
||||
cmake --version 2>&1 | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'
|
||||
fi
|
||||
}
|
||||
|
||||
get_cmake_version() {
|
||||
local version=$(cmake --version 2>/dev/null | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n1)
|
||||
if [ -n "$version" ]; then
|
||||
echo "$version"
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
check_git_submodules() {
|
||||
function test_git_submodules() {
|
||||
local submodules=(
|
||||
"src/lib/SDL"
|
||||
"src/lib/abseil-cpp"
|
||||
@@ -104,136 +98,159 @@ check_git_submodules() {
|
||||
"third_party/httplib"
|
||||
)
|
||||
|
||||
local all_present=0
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local root_dir="$(cd "$script_dir/.." && pwd)"
|
||||
|
||||
local all_present=1
|
||||
for submodule in "${submodules[@]}"; do
|
||||
if [ ! -d "$root_dir/$submodule" ] || [ -z "$(ls -A "$root_dir/$submodule")" ]; then
|
||||
print_status error "Submodule missing or empty: $submodule"
|
||||
issues_found+=("Missing submodule: $submodule")
|
||||
all_present=1
|
||||
elif [ $VERBOSE -eq 1 ]; then
|
||||
print_status success "Submodule found: $submodule"
|
||||
if [[ ! -d "$submodule" ]] || [[ -z "$(ls -A "$submodule" 2>/dev/null)" ]]; then
|
||||
write_status "Submodule missing or empty: $submodule" "Error"
|
||||
ISSUES_FOUND+=("Missing/empty submodule: $submodule")
|
||||
all_present=0
|
||||
elif [[ $VERBOSE -eq 1 ]]; then
|
||||
write_status "Submodule found: $submodule" "Success"
|
||||
fi
|
||||
done
|
||||
return $all_present
|
||||
}
|
||||
|
||||
function test_cmake_cache() {
|
||||
local build_dirs=("build" "build_test" "build-grpc-test" "build_rooms")
|
||||
local cache_issues=0
|
||||
|
||||
for dir in "${build_dirs[@]}"; do
|
||||
if [[ -f "$dir/CMakeCache.txt" ]]; then
|
||||
local cache_age=$(($(date +%s) - $(stat -f %m "$dir/CMakeCache.txt" 2>/dev/null || stat -c %Y "$dir/CMakeCache.txt" 2>/dev/null)))
|
||||
local days=$((cache_age / 86400))
|
||||
if [[ $days -gt 7 ]]; then
|
||||
write_status "CMake cache in '$dir' is $days days old" "Warning"
|
||||
WARNINGS+=("Old CMake cache in $dir (consider cleaning)")
|
||||
cache_issues=1
|
||||
elif [[ $VERBOSE -eq 1 ]]; then
|
||||
write_status "CMake cache in '$dir' is recent" "Success"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return $cache_issues
|
||||
}
|
||||
|
||||
function test_agent_folder_structure() {
|
||||
write_status "Verifying agent folder structure..." "Step"
|
||||
|
||||
local agent_files=(
|
||||
"src/app/editor/agent/agent_editor.h"
|
||||
"src/app/editor/agent/agent_editor.cc"
|
||||
"src/app/editor/agent/agent_chat_widget.h"
|
||||
"src/app/editor/agent/agent_chat_widget.cc"
|
||||
"src/app/editor/agent/agent_chat_history_codec.h"
|
||||
"src/app/editor/agent/agent_chat_history_codec.cc"
|
||||
"src/app/editor/agent/agent_collaboration_coordinator.h"
|
||||
"src/app/editor/agent/agent_collaboration_coordinator.cc"
|
||||
"src/app/editor/agent/network_collaboration_coordinator.h"
|
||||
"src/app/editor/agent/network_collaboration_coordinator.cc"
|
||||
)
|
||||
|
||||
local old_system_files=(
|
||||
"src/app/editor/system/agent_chat_widget.h"
|
||||
"src/app/editor/system/agent_collaboration_coordinator.h"
|
||||
)
|
||||
|
||||
local all_present=1
|
||||
local has_old_structure=0
|
||||
|
||||
for file in "${agent_files[@]}"; do
|
||||
if [[ ! -f "$file" ]]; then
|
||||
write_status "Agent file missing: $file" "Error"
|
||||
ISSUES_FOUND+=("Missing agent file: $file (may need to rebuild)")
|
||||
all_present=0
|
||||
elif [[ $VERBOSE -eq 1 ]]; then
|
||||
write_status "Agent file found: $file" "Success"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for old structure (indicates stale cache)
|
||||
for file in "${old_system_files[@]}"; do
|
||||
if [[ -f "$file" ]]; then
|
||||
write_status "Old agent file still present: $file" "Warning"
|
||||
WARNINGS+=("Old agent structure detected (CMake cache needs cleaning)")
|
||||
has_old_structure=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $all_present -eq 1 && $has_old_structure -eq 0 ]]; then
|
||||
write_status "Agent folder structure is correct" "Success"
|
||||
SUCCESS+=("Agent refactoring structure verified")
|
||||
return 0
|
||||
elif [[ $has_old_structure -eq 1 ]]; then
|
||||
write_status "Stale agent files detected - CMake cache should be cleaned" "Warning"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return $all_present
|
||||
}
|
||||
|
||||
check_cmake_cache() {
|
||||
local build_dirs=("build" "build_test" "build-grpc-test")
|
||||
local cache_issues=0
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local root_dir="$(cd "$script_dir/.." && pwd)"
|
||||
function clean_cmake_cache() {
|
||||
write_status "Cleaning CMake cache and build directories..." "Step"
|
||||
|
||||
local build_dirs=("build" "build_test" "build-grpc-test" "build_rooms")
|
||||
local cleaned=0
|
||||
|
||||
for dir in "${build_dirs[@]}"; do
|
||||
local cache_path="$root_dir/$dir/CMakeCache.txt"
|
||||
if [ -f "$cache_path" ]; then
|
||||
local cache_age=$(($(date +%s) - $(stat -f %m "$cache_path" 2>/dev/null || stat -c %Y "$cache_path")))
|
||||
local cache_days=$((cache_age / 86400))
|
||||
|
||||
if [ $cache_days -gt 7 ]; then
|
||||
print_status warning "CMake cache in '$dir' is $cache_days days old"
|
||||
warnings+=("Old CMake cache in $dir (consider cleaning)")
|
||||
cache_issues=1
|
||||
elif [ $VERBOSE -eq 1 ]; then
|
||||
print_status success "CMake cache in '$dir' is recent"
|
||||
if [[ -d "$dir" ]]; then
|
||||
write_status "Removing $dir..." "Info"
|
||||
if rm -rf "$dir" 2>/dev/null; then
|
||||
cleaned=1
|
||||
write_status " ✓ Removed $dir" "Success"
|
||||
else
|
||||
write_status " ✗ Failed to remove $dir" "Error"
|
||||
WARNINGS+=("Could not fully clean $dir")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
return $cache_issues
|
||||
}
|
||||
|
||||
check_dependency_compatibility() {
|
||||
print_status step "Testing dependency configuration..."
|
||||
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local root_dir="$(cd "$script_dir/.." && pwd)"
|
||||
|
||||
# Check gRPC configuration
|
||||
local grpc_path="$root_dir/cmake/grpc.cmake"
|
||||
if [ -f "$grpc_path" ]; then
|
||||
if grep -q "CMAKE_DISABLE_FIND_PACKAGE_Protobuf TRUE" "$grpc_path"; then
|
||||
print_status success "gRPC isolation configured correctly"
|
||||
else
|
||||
print_status warning "gRPC may conflict with system protobuf"
|
||||
warnings+=("gRPC not properly isolated from system packages")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check httplib
|
||||
if [ -d "$root_dir/third_party/httplib" ]; then
|
||||
print_status success "httplib found in third_party"
|
||||
successes+=("httplib header-only library available")
|
||||
fi
|
||||
|
||||
# Check json library
|
||||
if [ -d "$root_dir/third_party/json/include" ]; then
|
||||
print_status success "nlohmann/json found in third_party"
|
||||
successes+=("nlohmann/json header-only library available")
|
||||
fi
|
||||
}
|
||||
|
||||
clean_cmake_cache() {
|
||||
print_status step "Cleaning CMake cache..."
|
||||
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local root_dir="$(cd "$script_dir/.." && pwd)"
|
||||
local build_dirs=("build" "build_test" "build-grpc-test")
|
||||
|
||||
for dir in "${build_dirs[@]}"; do
|
||||
if [ -d "$root_dir/$dir" ]; then
|
||||
print_status info "Removing $dir..."
|
||||
rm -rf "$root_dir/$dir"
|
||||
# Clean CMake generated files in root
|
||||
local cmake_files=("CMakeCache.txt" "cmake_install.cmake" "compile_commands.json")
|
||||
for file in "${cmake_files[@]}"; do
|
||||
if [[ -f "$file" ]]; then
|
||||
write_status "Removing root $file..." "Info"
|
||||
rm -f "$file" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
print_status success "CMake cache cleaned"
|
||||
}
|
||||
|
||||
sync_git_submodules() {
|
||||
print_status step "Syncing git submodules..."
|
||||
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local root_dir="$(cd "$script_dir/.." && pwd)"
|
||||
|
||||
cd "$root_dir"
|
||||
|
||||
print_status info "Running: git submodule sync --recursive"
|
||||
git submodule sync --recursive
|
||||
|
||||
print_status info "Running: git submodule update --init --recursive"
|
||||
git submodule update --init --recursive
|
||||
|
||||
print_status success "Submodules synced successfully"
|
||||
}
|
||||
|
||||
test_cmake_configuration() {
|
||||
print_status step "Testing CMake configuration..."
|
||||
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local root_dir="$(cd "$script_dir/.." && pwd)"
|
||||
local test_build_dir="$root_dir/build_test_config"
|
||||
|
||||
print_status info "Configuring CMake (this may take a moment)..."
|
||||
|
||||
if cmake -B "$test_build_dir" -S "$root_dir" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DYAZE_MINIMAL_BUILD=ON \
|
||||
-DYAZE_BUILD_TESTS=OFF &>/dev/null; then
|
||||
|
||||
print_status success "CMake configuration successful"
|
||||
successes+=("CMake configuration test passed")
|
||||
|
||||
# Cleanup test build
|
||||
rm -rf "$test_build_dir"
|
||||
return 0
|
||||
if [[ $cleaned -eq 1 ]]; then
|
||||
write_status "CMake cache cleaned successfully" "Success"
|
||||
SUCCESS+=("Build directories cleaned - fresh build recommended")
|
||||
else
|
||||
print_status error "CMake configuration failed"
|
||||
issues_found+=("CMake configuration test failed")
|
||||
return 1
|
||||
write_status "No build directories found to clean" "Info"
|
||||
fi
|
||||
}
|
||||
|
||||
function sync_git_submodules() {
|
||||
write_status "Syncing git submodules..." "Step"
|
||||
|
||||
write_status "Running: git submodule sync --recursive" "Info"
|
||||
if git submodule sync --recursive &> /dev/null; then
|
||||
write_status "Running: git submodule update --init --recursive" "Info"
|
||||
if git submodule update --init --recursive; then
|
||||
write_status "Submodules synced successfully" "Success"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
write_status "Failed to sync submodules" "Error"
|
||||
return 1
|
||||
}
|
||||
|
||||
function test_dependency_compatibility() {
|
||||
write_status "Testing dependency configuration..." "Step"
|
||||
|
||||
# Check httplib configuration
|
||||
if [[ -f "third_party/httplib/CMakeLists.txt" ]]; then
|
||||
write_status "httplib found in third_party" "Success"
|
||||
SUCCESS+=("httplib header-only library available")
|
||||
fi
|
||||
|
||||
# Check json library
|
||||
if [[ -d "third_party/json/include" ]]; then
|
||||
write_status "nlohmann/json found in third_party" "Success"
|
||||
SUCCESS+=("nlohmann/json header-only library available")
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -243,182 +260,164 @@ test_cmake_configuration() {
|
||||
|
||||
echo ""
|
||||
echo -e "${CYAN}╔════════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${CYAN}║ YAZE Build Environment Verification (macOS/Linux) ║${NC}"
|
||||
echo -e "${CYAN}║ YAZE Build Environment Verification for Unix/macOS/Linux ║${NC}"
|
||||
echo -e "${CYAN}╚════════════════════════════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
|
||||
start_time=$(date +%s)
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# Change to script directory
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Step 1: Check CMake
|
||||
print_status step "Checking CMake installation..."
|
||||
if check_command cmake; then
|
||||
write_status "Checking CMake installation..." "Step"
|
||||
if test_command cmake; then
|
||||
cmake_version=$(get_cmake_version)
|
||||
write_status "CMake found: version $cmake_version" "Success"
|
||||
|
||||
if [ "$cmake_version" != "unknown" ]; then
|
||||
print_status success "CMake found: version $cmake_version"
|
||||
|
||||
# Check version
|
||||
major=$(echo "$cmake_version" | cut -d. -f1)
|
||||
minor=$(echo "$cmake_version" | cut -d. -f2)
|
||||
|
||||
# Validate that we got numeric values
|
||||
if [[ "$major" =~ ^[0-9]+$ ]] && [[ "$minor" =~ ^[0-9]+$ ]]; then
|
||||
if [ "$major" -lt 3 ] || ([ "$major" -eq 3 ] && [ "$minor" -lt 16 ]); then
|
||||
print_status error "CMake version too old (need 3.16+)"
|
||||
issues_found+=("CMake version $cmake_version is below minimum 3.16")
|
||||
fi
|
||||
else
|
||||
print_status warning "Could not parse CMake version: $cmake_version"
|
||||
warnings+=("Unable to verify CMake version requirement (need 3.16+)")
|
||||
fi
|
||||
else
|
||||
print_status warning "CMake found but version could not be determined"
|
||||
warnings+=("CMake version could not be parsed - ensure version 3.16+ is installed")
|
||||
# Parse version
|
||||
IFS='.' read -ra VERSION_PARTS <<< "$cmake_version"
|
||||
major=${VERSION_PARTS[0]}
|
||||
minor=${VERSION_PARTS[1]}
|
||||
|
||||
if [[ $major -lt 3 ]] || [[ $major -eq 3 && $minor -lt 16 ]]; then
|
||||
write_status "CMake version too old (need 3.16+)" "Error"
|
||||
ISSUES_FOUND+=("CMake version $cmake_version is below minimum 3.16")
|
||||
fi
|
||||
else
|
||||
print_status error "CMake not found in PATH"
|
||||
issues_found+=("CMake not installed or not in PATH")
|
||||
write_status "CMake not found in PATH" "Error"
|
||||
ISSUES_FOUND+=("CMake not installed or not in PATH")
|
||||
fi
|
||||
|
||||
# Step 2: Check Git
|
||||
print_status step "Checking Git installation..."
|
||||
if check_command git; then
|
||||
write_status "Checking Git installation..." "Step"
|
||||
if test_command git; then
|
||||
git_version=$(git --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
||||
print_status success "Git found: version $git_version"
|
||||
write_status "Git found: version $git_version" "Success"
|
||||
else
|
||||
print_status error "Git not found in PATH"
|
||||
issues_found+=("Git not installed or not in PATH")
|
||||
write_status "Git not found in PATH" "Error"
|
||||
ISSUES_FOUND+=("Git not installed or not in PATH")
|
||||
fi
|
||||
|
||||
# Step 3: Check Platform-Specific Tools
|
||||
print_status step "Checking platform-specific tools..."
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
if check_command xcodebuild; then
|
||||
xcode_version=$(xcodebuild -version | head -n1)
|
||||
print_status success "Xcode found: $xcode_version"
|
||||
else
|
||||
print_status warning "Xcode not found (optional but recommended)"
|
||||
warnings+=("Xcode Command Line Tools not installed")
|
||||
fi
|
||||
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
if check_command gcc || check_command clang; then
|
||||
print_status success "C++ compiler found"
|
||||
else
|
||||
print_status error "No C++ compiler found"
|
||||
issues_found+=("Install build-essential or clang")
|
||||
fi
|
||||
|
||||
# Check for GTK (needed for NFD on Linux)
|
||||
if pkg-config --exists gtk+-3.0; then
|
||||
print_status success "GTK+3 found"
|
||||
else
|
||||
print_status warning "GTK+3 not found (needed for file dialogs)"
|
||||
warnings+=("Install libgtk-3-dev for native file dialogs")
|
||||
fi
|
||||
# Step 3: Check Build Tools
|
||||
write_status "Checking build tools..." "Step"
|
||||
if test_command make; then
|
||||
write_status "Make found" "Success"
|
||||
elif test_command ninja; then
|
||||
write_status "Ninja found" "Success"
|
||||
else
|
||||
write_status "No build tool found (make or ninja)" "Warning"
|
||||
WARNINGS+=("Neither make nor ninja found")
|
||||
fi
|
||||
|
||||
# Step 4: Check Git Submodules
|
||||
print_status step "Checking git submodules..."
|
||||
if check_git_submodules; then
|
||||
print_status success "All required submodules present"
|
||||
# Step 4: Check Compiler
|
||||
if test_command clang++; then
|
||||
clang_version=$(clang++ --version | head -n1)
|
||||
write_status "Clang++ found: $clang_version" "Success"
|
||||
elif test_command g++; then
|
||||
gpp_version=$(g++ --version | head -n1)
|
||||
write_status "G++ found: $gpp_version" "Success"
|
||||
else
|
||||
print_status error "Some submodules are missing or empty"
|
||||
if [ $FIX_ISSUES -eq 1 ]; then
|
||||
write_status "No C++ compiler found" "Error"
|
||||
ISSUES_FOUND+=("No C++ compiler (clang++ or g++) found")
|
||||
fi
|
||||
|
||||
# Step 5: Check Git Submodules
|
||||
write_status "Checking git submodules..." "Step"
|
||||
if test_git_submodules; then
|
||||
write_status "All required submodules present" "Success"
|
||||
else
|
||||
write_status "Some submodules are missing or empty" "Error"
|
||||
if [[ $FIX_ISSUES -eq 1 ]]; then
|
||||
sync_git_submodules
|
||||
# Re-check after sync
|
||||
if ! check_git_submodules; then
|
||||
print_status warning "Submodule sync completed but some issues remain"
|
||||
fi
|
||||
test_git_submodules
|
||||
else
|
||||
# Auto-fix without confirmation
|
||||
print_status info "Automatically syncing submodules..."
|
||||
write_status "Automatically syncing submodules..." "Info"
|
||||
if sync_git_submodules; then
|
||||
print_status success "Submodules synced successfully"
|
||||
# Re-check after sync
|
||||
check_git_submodules
|
||||
test_git_submodules
|
||||
else
|
||||
print_status error "Failed to sync submodules automatically"
|
||||
print_status info "Run with --fix to try again, or manually run: git submodule update --init --recursive"
|
||||
write_status "Run with --fix to try again, or manually: git submodule update --init --recursive" "Info"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Step 5: Check CMake Cache
|
||||
print_status step "Checking CMake cache..."
|
||||
if check_cmake_cache; then
|
||||
print_status success "CMake cache is up to date"
|
||||
# Step 6: Check CMake Cache
|
||||
write_status "Checking CMake cache..." "Step"
|
||||
if test_cmake_cache; then
|
||||
write_status "CMake cache is up to date" "Success"
|
||||
else
|
||||
if [ $CLEAN_CACHE -eq 1 ]; then
|
||||
if [[ $CLEAN_CACHE -eq 1 ]]; then
|
||||
clean_cmake_cache
|
||||
elif [ $FIX_ISSUES -eq 1 ]; then
|
||||
# Ask for confirmation before cleaning cache
|
||||
echo ""
|
||||
echo -e "${YELLOW}CMake cache is older than 7 days. Clean it?${NC}"
|
||||
echo -e "${CYAN}This will remove build/, build_test/, and build-grpc-test/ directories.${NC}"
|
||||
read -p "Continue? (Y/n) " -n 1 -r
|
||||
echo ""
|
||||
elif [[ $FIX_ISSUES -eq 1 ]]; then
|
||||
read -p "CMake cache is old. Clean it? (Y/n): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
|
||||
clean_cmake_cache
|
||||
else
|
||||
print_status info "Skipping cache clean"
|
||||
fi
|
||||
else
|
||||
print_status warning "CMake cache is older than 7 days (consider cleaning)"
|
||||
print_status info "Run with --clean to remove old cache files"
|
||||
write_status "Run with --clean to remove old cache files" "Info"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Step 6: Check Dependencies
|
||||
check_dependency_compatibility
|
||||
# Step 7: Check Dependencies
|
||||
test_dependency_compatibility
|
||||
|
||||
# Step 7: Test CMake Configuration (if requested)
|
||||
if [ $VERBOSE -eq 1 ] || [ $FIX_ISSUES -eq 1 ]; then
|
||||
test_cmake_configuration
|
||||
# Step 8: Check Agent Folder Structure
|
||||
if test_agent_folder_structure; then
|
||||
: # Structure is OK
|
||||
else
|
||||
write_status "Agent folder structure has issues" "Warning"
|
||||
if [[ $CLEAN_CACHE -eq 1 ]] || [[ $FIX_ISSUES -eq 1 ]]; then
|
||||
write_status "Cleaning CMake cache due to structural changes..." "Info"
|
||||
clean_cmake_cache
|
||||
write_status "Please rebuild the project after cache cleaning" "Info"
|
||||
else
|
||||
write_status "Run with --clean to fix structural issues" "Info"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ============================================================================
|
||||
# Summary Report
|
||||
# ============================================================================
|
||||
|
||||
end_time=$(date +%s)
|
||||
duration=$((end_time - start_time))
|
||||
END_TIME=$(date +%s)
|
||||
DURATION=$((END_TIME - START_TIME))
|
||||
|
||||
echo ""
|
||||
echo -e "${CYAN}╔════════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${CYAN}║ Verification Summary ║${NC}"
|
||||
echo -e "${CYAN}╚════════════════════════════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
|
||||
echo "Duration: $duration seconds"
|
||||
echo "Duration: ${DURATION} seconds"
|
||||
echo ""
|
||||
|
||||
if [ ${#successes[@]} -gt 0 ]; then
|
||||
echo -e "${GREEN}✓ Successes (${#successes[@]}):${NC}"
|
||||
for item in "${successes[@]}"; do
|
||||
if [[ ${#SUCCESS[@]} -gt 0 ]]; then
|
||||
echo -e "${GREEN}✓ Successes (${#SUCCESS[@]}):${NC}"
|
||||
for item in "${SUCCESS[@]}"; do
|
||||
echo -e " ${GREEN}•${NC} $item"
|
||||
done
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ ${#warnings[@]} -gt 0 ]; then
|
||||
echo -e "${YELLOW}⚠ Warnings (${#warnings[@]}):${NC}"
|
||||
for item in "${warnings[@]}"; do
|
||||
if [[ ${#WARNINGS[@]} -gt 0 ]]; then
|
||||
echo -e "${YELLOW}⚠ Warnings (${#WARNINGS[@]}):${NC}"
|
||||
for item in "${WARNINGS[@]}"; do
|
||||
echo -e " ${YELLOW}•${NC} $item"
|
||||
done
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ ${#issues_found[@]} -gt 0 ]; then
|
||||
echo -e "${RED}✗ Issues Found (${#issues_found[@]}):${NC}"
|
||||
for item in "${issues_found[@]}"; do
|
||||
if [[ ${#ISSUES_FOUND[@]} -gt 0 ]]; then
|
||||
echo -e "${RED}✗ Issues Found (${#ISSUES_FOUND[@]}):${NC}"
|
||||
for item in "${ISSUES_FOUND[@]}"; do
|
||||
echo -e " ${RED}•${NC} $item"
|
||||
done
|
||||
echo ""
|
||||
|
||||
echo -e "${YELLOW}Recommended Actions:${NC}"
|
||||
echo -e " 1. Run: ${CYAN}./scripts/verify-build-environment.sh --fix${NC}"
|
||||
echo -e " 2. Install missing dependencies"
|
||||
echo -e " 3. Check build instructions: ${CYAN}docs/02-build-instructions.md${NC}"
|
||||
echo -e " ${CYAN}1. Run: ./scripts/verify-build-environment.sh --fix${NC}"
|
||||
echo -e " ${CYAN}2. Install missing dependencies${NC}"
|
||||
echo -e " ${CYAN}3. Check build instructions: docs/02-build-instructions.md${NC}"
|
||||
echo ""
|
||||
|
||||
exit 1
|
||||
@@ -429,16 +428,10 @@ else
|
||||
echo ""
|
||||
|
||||
echo -e "${CYAN}Next Steps:${NC}"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo -e " ${BLUE}macOS:${NC}"
|
||||
echo " cmake --preset debug"
|
||||
echo " cmake --build build"
|
||||
else
|
||||
echo -e " ${BLUE}Linux:${NC}"
|
||||
echo " cmake -B build -DCMAKE_BUILD_TYPE=Debug"
|
||||
echo " cmake --build build"
|
||||
fi
|
||||
echo -e " ${CYAN}Command Line Workflow:${NC}"
|
||||
echo -e " ${NC}cmake -B build -DCMAKE_BUILD_TYPE=Debug${NC}"
|
||||
echo -e " ${NC}cmake --build build --parallel \$(nproc)${NC}"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user