diff --git a/Backend/CaseConversionAPI/CppLib/Scripts/Dockerfile b/Backend/CaseConversionAPI/CppLib/Scripts/Dockerfile deleted file mode 100644 index c0a75d9..0000000 --- a/Backend/CaseConversionAPI/CppLib/Scripts/Dockerfile +++ /dev/null @@ -1,85 +0,0 @@ -# ----------------------------------------------------------------------------- -# Microsoft Azure Container Registry / .NET Microservices Template -# Project: Hardware-Aware Case Conversion Engine -# Component: Multi-Platform Native Orchestrator (Linux + Windows) -# Documentation: https://github.com/nitishhsinghhh/case-conversion-api -# ----------------------------------------------------------------------------- -# VERSION HISTORY -# Version | Date | Author | Description -# --------|------------|--------------|---------------------------------------- -# 1.0.0 | 2026-05-14 | Nitish Singh | Initial Orchestration Layer. -# 1.1.0 | 2026-05-14 | Nitish Singh | Integrated MinGW-w64 for Windows cross-builds. -# 1.2.0 | 2026-05-30 | Nitish Singh | Added Wine + Xvfb validation pipeline for -# | Windows GoogleTest execution inside Linux -# | containers with cross-platform verification. -# ----------------------------------------------------------------------------- -# ARCHITECTURAL STRATEGY: -# * Headless Build Vessel: Designed to output binaries, not to run as a service. -# * Cross-Compilation: Leverages MinGW-w64 to target Windows from a Linux host. -# * Artifact Extraction: Exposes the build directory for host-side consumption. -# ----------------------------------------------------------------------------- - -ARG TARGET_PLATFORM=linux/amd64 -FROM --platform=${TARGET_PLATFORM} mcr.microsoft.com/dotnet/sdk:8.0 AS build-env - -# Install C++ Native Toolchains, Wine, and Xvfb for testing -RUN dpkg --add-architecture i386 && \ - apt-get update && apt-get install -y \ - build-essential \ - cmake \ - mingw-w64 \ - wine \ - wine32 \ - wine64 \ - xvfb \ - && rm -rf /var/lib/apt/lists/* - -WORKDIR /src - -# Copy the entire repo context -COPY . . - -# Ensure orchestrator script is executable -RUN chmod +x Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native.sh - -# --- STEP 1: Build Linux Artifacts (.so) --- -RUN ./Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native.sh ubuntu-latest - -# --- STEP 2: Build Windows Artifacts (.dll via MinGW) --- -RUN ./Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native.sh windows-latest - -# --- STEP 3: Verification Layer (Internal Tests) --- -WORKDIR /src/Backend/CaseConversionAPI/CppLib/build/windows-latest - -ENV WINEPREFIX=/root/.wine -ENV WINEARCH=win64 -ENV WINEDEBUG=-all -ENV WINEDLLOVERRIDES="mscoree,mshtml=" - -# Run Windows test suite via Wine -# Using absolute path to /usr/bin/xvfb-run ensures command execution -RUN echo "===== Running Windows GoogleTests via Wine =====" && \ - /usr/bin/xvfb-run --server-args="-screen 0 1024x768x24" \ - /usr/lib/wine/wine64 ./runTests.exe --gtest_color=yes 2>&1 | tee gtest_internal.log && \ - echo "===== Windows GoogleTests Passed =====" \ - || { \ - echo "=== WINDOWS GOOGLETEST CRASH LOG ==="; \ - cat gtest_internal.log; \ - exit 1; \ - } - -# Reset context for artifact extraction -WORKDIR /src - -# ----------------------------------------------------------------------------- -# STAGE 2: Export Layer (Minimal Delivery Vessel) -# ----------------------------------------------------------------------------- -# Re-import target architecture variable for the final runtime stage context -ARG TARGET_PLATFORM=linux/amd64 -FROM --platform=${TARGET_PLATFORM} mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime -WORKDIR /app - -# Export the raw C++ build artifacts for the host to extract via 'docker cp' -COPY --from=build-env /src/Backend/CaseConversionAPI/CppLib/build /src/Backend/CaseConversionAPI/CppLib/build - -# Note: No ENTRYPOINT defined as this container is utilized as an artifact source. \ No newline at end of file diff --git a/Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native-docker.sh b/Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native-docker.sh deleted file mode 100755 index a4f2c16..0000000 --- a/Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native-docker.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: Apache-2.0 -#*********************************************************************/ -# SYSTEM : CaseConversionAPI Infrastructure */ -# SUBSYSTEM : Native Processing Engine */ -# COMPONENT : orchestrate-native-docker */ -# VERSION : 1.3 */ -# */ -# DESCRIPTION : Coordinates local and containerized native build */ -# pipelines to produce a unified cross-platform */ -# binary distribution for the C++ conversion engine. */ -# */ -# Orchestrates native macOS compilation, Linux */ -# containerized validation, Windows cross-platform */ -# artifact extraction, and consolidated runtime */ -# synchronization for downstream consumers. */ -# */ -# FEATURES : */ -# * Native macOS build orchestration */ -# * Linux containerized compilation */ -# * Windows cross-platform artifact generation */ -# * Dockerized GoogleTest execution */ -# * Automated artifact extraction */ -# * Cross-platform binary synchronization */ -# * Unified distribution directory generation */ -# * Repository-aware path normalization */ -# */ -# SIDE EFFECTS: Creates Docker images and containers on the host. */ -# Generates platform-specific shared libraries and */ -# modifies build output directories during artifact */ -# synchronization and cleanup operations. */ -# */ -# LOCATION : Backend/CaseConversionAPI/CppLib/Scripts/ */ -# orchestrate-native-docker.sh */ -# */ -# LICENSE : Apache License, Version 2.0 */ -# Licensed under the Apache License, Version 2.0. */ -# You may obtain a copy of the License at */ -# http://www.apache.org/licenses/LICENSE-2.0 */ -# */ -# AUTHOR : Nitish Singh (nitishhsinghhh) */ -# CONTACT : me.singhnitish@yandex.com */ -# */ -# REVISION HISTORY: */ -# ------------------------------------------------------------------ */ -# Ver Date Author Description */ -# --- ---------- -------------- -------------------------------- */ -# 1.0 2026-05-14 Nitish Singh Initial native orchestration */ -# workflow with Docker artifact */ -# extraction support. */ -# 1.1 2026-05-16 Nitish Singh Added backend root path */ -# normalization and improved */ -# Docker context handling. */ -# 1.2 2026-05-20 Nitish Singh Added containerized GoogleTest */ -# execution and automated binary */ -# synchronization pipeline. */ -# 1.3 2026-05-30 Nitish Singh Infrastructure header */ -# normalization and subsystem */ -# classification alignment. */ -#*********************************************************************/ - -set -euo pipefail - -# --- PATH DISCOVERY --- -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -BACKEND_ROOT=$(realpath "$SCRIPT_DIR/../../../") -REPO_ROOT=$(realpath "$BACKEND_ROOT/..") - -# Configuration -DOCKERFILE_PATH="$BACKEND_ROOT/CaseConversionAPI/CppLib/Scripts/Dockerfile" -DIST_DIR="$BACKEND_ROOT/CaseConversionAPI/CppLib/build" -NATIVE_SCRIPT_REL="Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native.sh" - -log_info() { echo -e "\033[0;34m[$(date +'%T')] [INFO]\033[0m $1"; } -log_success() { echo -e "\033[0;32m[$(date +'%T')] [SUCCESS]\033[0m $1"; } -log_error() { echo -e "\033[0;31m[$(date +'%T')] [ERROR]\033[0m $1"; } - -# Move to REPO_ROOT for Docker context consistency -cd "$REPO_ROOT" - -# --- STEP 1: LOCAL MACOS BUILD --- -if [[ "$(uname)" == "Darwin" ]]; then - log_info "MacOS detected. Running local native build & tests..." - - if bash "$NATIVE_SCRIPT_REL" macos-latest; then - log_success "MacOS Local Build & Testing Complete." - else - log_error "MacOS Local Build failed. Check native logs." - exit 1 - fi -else - log_info "Non-MacOS environment. Skipping local macos-latest target." -fi - -# --- STEP 2: DOCKER CROSS-BUILD (LINUX & WINDOWS) --- -log_info "Initiating Docker Build for Linux (.so) and Windows (.dll)..." - -if docker build \ - --progress=plain \ - --platform linux/amd64 \ - -t cpp-native-cross \ - -f "$DOCKERFILE_PATH" .; then - - # 1. Run Linux Tests - log_info "Running C++ Core GoogleTest suite inside Linux Container Environment..." - if docker run --rm cpp-native-cross /src/Backend/CaseConversionAPI/CppLib/build/ubuntu-latest/runTests; then - log_success "Linux (Ubuntu) Container Core Tests Passed Successfully." - else - log_error "Linux Core Tests Failed within the container context." - exit 1 - fi - - # 3. Extract and Sync Artifacts - log_info "Extracting virtual artifacts from Docker..." - CONTAINER_ID=$(docker create cpp-native-cross) - TEMP_EXTRACT="$DIST_DIR/docker_temp" - mkdir -p "$TEMP_EXTRACT" - - docker cp "$CONTAINER_ID:/src/Backend/CaseConversionAPI/CppLib/build/." "$TEMP_EXTRACT/" - docker rm "$CONTAINER_ID" - - log_info "Syncing cross-platform target folders..." - - # Sync Linux - if [ -d "$TEMP_EXTRACT/ubuntu-latest" ]; then - mkdir -p "$DIST_DIR/ubuntu-latest" - cp "$TEMP_EXTRACT/ubuntu-latest/libProcessStringDLL.so" "$DIST_DIR/ubuntu-latest/" - log_success "Artifact Secured: ubuntu-latest/libProcessStringDLL.so" - fi - - # Sync Windows - if [ -d "$TEMP_EXTRACT/windows-latest" ]; then - mkdir -p "$DIST_DIR/windows-latest" - cp "$TEMP_EXTRACT/windows-latest/libProcessStringDLL.dll" "$DIST_DIR/windows-latest/" - log_success "Artifact Secured: windows-latest/libProcessStringDLL.dll" - fi - - # 4. Final Cleanup - rm -rf "$TEMP_EXTRACT" - docker rmi cpp-native-cross -else - log_error "Docker build failed. Check Dockerfile and native toolchains." - exit 1 -fi - -# --- FINAL STATUS REPORT --- -echo -e "\n\033[1;35m--- Build Status Summary ---\033[0m" -[ -f "$DIST_DIR/macos-latest/libProcessStringDLL.dylib" ] && echo -e " [✔] macos-latest (.dylib)" || echo -e " [ ] macos-latest (Skipped/Missing)" -[ -f "$DIST_DIR/ubuntu-latest/libProcessStringDLL.so" ] && echo -e " [✔] ubuntu-latest (.so)" || echo -e " [✘] ubuntu-latest (Missing)" -[ -f "$DIST_DIR/windows-latest/libProcessStringDLL.dll" ] && echo -e " [✔] windows-latest (.dll)" || echo -e " [✘] windows-latest (Missing)" -echo -e "\033[1;35m----------------------------\033[0m" - -log_info "All native artifacts are synchronized in: $DIST_DIR" \ No newline at end of file diff --git a/Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native.sh b/Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native.sh deleted file mode 100755 index 7fde2f9..0000000 --- a/Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native.sh +++ /dev/null @@ -1,220 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: Apache-2.0 -#*********************************************************************/ -# SYSTEM : CaseConversionAPI Infrastructure */ -# SUBSYSTEM : Native Processing Engine */ -# COMPONENT : orchestrate-native */ -# VERSION : 1.7 */ -# */ -# DESCRIPTION : Configures, builds, validates, and executes the */ -# native C++ conversion engine across supported */ -# target environments. */ -# */ -# Orchestrates platform-specific build configuration, */ -# automated source formatting, parallel compilation, */ -# GoogleTest validation, and artifact generation for */ -# local and CI/CD execution pipelines. */ -# */ -# FEATURES : */ -# * Matrix OS orchestration */ -# * Dynamic build path synchronization */ -# * MinGW Windows cross-compilation */ -# * Microsoft Visual Studio integration */ -# * Apple Silicon optimization support */ -# * Automated GoogleTest execution */ -# * Parallelized multi-core compilation */ -# * Pre-build clang-format automation */ -# * Dynamic CMake generator selection */ -# * Repository-aware workspace validation */ -# */ -# SIDE EFFECTS: Creates and modifies build output directories. */ -# Generates platform-specific binaries and test */ -# executables within the configured build tree. */ -# */ -# LOCATION : Backend/CaseConversionAPI/CppLib/Scripts/ */ -# orchestrate-native.sh */ -# */ -# LICENSE : Apache License, Version 2.0 */ -# Licensed under the Apache License, Version 2.0. */ -# You may obtain a copy of the License at */ -# http://www.apache.org/licenses/LICENSE-2.0 */ -# */ -# AUTHOR : Nitish Singh (nitishhsinghhh) */ -# CONTACT : me.singhnitish@yandex.com */ -# */ -# REVISION HISTORY: */ -# ------------------------------------------------------------------ */ -# Ver Date Author Description */ -# --- ---------- -------------- -------------------------------- */ -# 1.0 2026-04-14 Nitish Singh Initial C++ orchestration */ -# script implementation. */ -# 1.1 2026-04-15 Nitish Singh Updated backend path */ -# synchronization logic. */ -# 1.2 2026-04-16 Nitish Singh Added dynamic workspace */ -# context resolution. */ -# 1.3 2026-05-02 Nitish Singh Added matrix OS orchestration */ -# support. */ -# 1.4 2026-05-09 Nitish Singh Enhanced Apple Silicon */ -# optimization and versioning. */ -# 1.5 2026-05-16 Nitish Singh Standardized logging and */ -# execution context validation. */ -# 1.6 2026-05-28 Nitish Singh Added automated clang-format */ -# integration and fallback logic. */ -# 1.7 2026-05-30 Nitish Singh Infrastructure header */ -# normalization and subsystem */ -# classification alignment. */ -#*********************************************************************/ - -set -euo pipefail - -#*********************************************************************/ -# Logging Utilities */ -#*********************************************************************/ - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -timestamp() { date +"%Y-%m-%d %H:%M:%S"; } -log_info() { echo -e "${BLUE}[$(timestamp)] [INFO]${NC} $1"; } -log_warn() { echo -e "${YELLOW}[$(timestamp)] [WARN]${NC} $1"; } -log_error() { echo -e "${RED}[$(timestamp)] [ERROR]${NC} $1"; } -log_success() { echo -e "${GREEN}[$(timestamp)] [SUCCESS]${NC} $1"; } - -#*********************************************************************/ -# 1. Argument Handling (Matrix OS) */ -#*********************************************************************/ - -if [ "$#" -ne 1 ]; then - echo "Usage: $0 " - echo "Example: $0 macos-latest | ubuntu-latest | windows-latest" - exit 1 -fi - -OS_TARGET=$(echo "$1" | tr '[:upper:]' '[:lower:]') -echo "Targeting Matrix OS: $OS_TARGET" - -#*********************************************************************/ -# 2. Environment & Path Synchronization */ -#*********************************************************************/ - -log_info "Validating build environment..." - -if ! command -v cmake >/dev/null 2>&1; then - log_error "CMake is not installed. Please install CMake to proceed." - exit 1 -fi - -# FIX: Define SCRIPT_DIR and CPP_ROOT before using them -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -CPP_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" - -# Define the structured build path -readonly BUILD_DIR="$CPP_ROOT/build/$OS_TARGET" - -log_success "Workspace context set: $CPP_ROOT" -log_success "Build directory set: $BUILD_DIR" - -#*********************************************************************/ -# 3. OS-Specific Configuration */ -#*********************************************************************/ - -# Initialize CMAKE_ARGS as an array to handle spaces safely -CMAKE_ARGS=("-DCMAKE_BUILD_TYPE=Release") - -case "$OS_TARGET" in - *macos*) - log_info "Configuring for macOS optimization..." - CMAKE_ARGS+=("-DARCH_ARM64=ON" "-DUSE_PCORES=ON" "-DCMAKE_OSX_ARCHITECTURES=arm64") - ;; - *ubuntu*|*linux*) - log_info "Configuring for Linux optimization..." - CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS=-O3 -march=native" "-G" "Unix Makefiles") - ;; - *windows*) - if command -v x86_64-w64-mingw32-gcc &> /dev/null; then - log_info "Configuring for MinGW Windows cross-compilation..." - CMAKE_ARGS+=("-G" "Unix Makefiles") - CMAKE_ARGS+=("-DCMAKE_SYSTEM_NAME=Windows") - CMAKE_ARGS+=("-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc") - CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++") - else - log_info "Configuring for MSVC Windows optimization..." - CMAKE_ARGS+=("-G" "Visual Studio 17 2022" "-A" "x64") - fi - ;; - *) - log_warn "Unrecognized OS target. Using generic build flags." - ;; -esac - -#*********************************************************************/ -# 4. Compilation Layer */ -#*********************************************************************/ - -log_info "===== Building C++ Core ($OS_TARGET) =====" - -mkdir -p "$BUILD_DIR" - -# FIX: Define NUM_CORES for parallel build performance -if [[ "$OS_TARGET" == *"macos"* ]]; then - NUM_CORES=$(sysctl -n hw.perflevel0.logicalcpu 2>/dev/null || sysctl -n hw.ncpu || echo 4) -else - NUM_CORES=$(nproc 2>/dev/null || echo 2) -fi - -# Modern CMake build -cmake -S "$CPP_ROOT" -B "$BUILD_DIR" "${CMAKE_ARGS[@]}" - -# Temporarily drop strict exit tracking to execute target code formatting safely -set +e -log_info "Executing shared framework auto-formatting via clang-format..." -cmake --build "$BUILD_DIR" --target format -if [ $? -eq 0 ]; then - log_success "Workspace formatting complete." -else - log_warn "Formatting target encountered an initialization anomaly or was skipped; proceeding." -fi -set -e # Re-engage strict execution tracking for compilation safety - -log_info "Utilizing $NUM_CORES cores for parallel build..." -cmake --build "$BUILD_DIR" --config Release --parallel "$NUM_CORES" - -log_success "C++ Core built successfully." - -#*********************************************************************/ -# 5. Execution & Testing Layer */ -#*********************************************************************/ - -# Logic to determine if we can run the binary on the current host -CAN_RUN=false -[[ "$OS_TARGET" == *"macos"* && "$(uname)" == "Darwin" ]] && CAN_RUN=true -[[ "$OS_TARGET" == *"ubuntu"* && "$(uname)" == "Linux" ]] && CAN_RUN=true - -if [ "$CAN_RUN" = true ]; then - echo -e "\n===== Running Core Tests =====" - - # Search for test binary in the new structure - TEST_BIN=$(find "$BUILD_DIR" -maxdepth 3 \( -name "runTests" -o -name "runTests.exe" \) | head -n 1) - - if [[ -n "$TEST_BIN" && -f "$TEST_BIN" ]]; then - # Run from the binary's directory to ensure relative assets resolve - cd "$(dirname "$TEST_BIN")" - ./$(basename "$TEST_BIN") - log_success "Tests completed." - else - log_error "Test binary not found in $BUILD_DIR." - exit 1 - fi -else - log_warn "Target $OS_TARGET is not native to host $(uname). Skipping execution." -fi - -#*********************************************************************/ -# 6. Workspace Restoration -#*********************************************************************/ - -cd "$SCRIPT_DIR" -log_info "Returned to scripts directory." \ No newline at end of file diff --git a/Backend/CaseConversionAPI/CppLib/Scripts/run-local-context.sh b/Backend/CaseConversionAPI/CppLib/Scripts/run-local-context.sh deleted file mode 100755 index 6925361..0000000 --- a/Backend/CaseConversionAPI/CppLib/Scripts/run-local-context.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: Apache-2.0 -#*********************************************************************/ -# SYSTEM : CaseConversionAPI Infrastructure */ -# SUBSYSTEM : Native Processing Engine */ -# COMPONENT : run-local */ -# VERSION : 1.5 */ -# */ -# DESCRIPTION : Builds and executes the standalone native CLI */ -# application without altering the primary library */ -# architecture or repository workflow. */ -# */ -# Performs temporary build-context substitution, */ -# automated source formatting, optimized Apple */ -# Silicon compilation, and controlled restoration */ -# of the native project configuration. */ -# */ -# FEATURES : */ -# * Dynamic workspace synchronization */ -# * Safe CMakeLists backup and restore workflow */ -# * Apple Silicon (M-Series) optimization */ -# * Automated clang-format integration */ -# * Parallelized multi-core compilation */ -# * Execution context validation */ -# * Automated cleanup and restoration */ -# * Standalone CLI application execution */ -# */ -# SIDE EFFECTS: Temporarily replaces the active CMakeLists.txt */ -# configuration during execution. Generates build */ -# artifacts and modifies local build directories. */ -# */ -# LOCATION : Backend/CaseConversionAPI/CppLib/Scripts/ */ -# run-local.sh */ -# */ -# LICENSE : Apache License, Version 2.0 */ -# Licensed under the Apache License, Version 2.0. */ -# You may obtain a copy of the License at */ -# http://www.apache.org/licenses/LICENSE-2.0 */ -# */ -# AUTHOR : Nitish Singh (nitishhsinghhh) */ -# CONTACT : me.singhnitish@yandex.com */ -# */ -# REVISION HISTORY: */ -# ------------------------------------------------------------------ */ -# Ver Date Author Description */ -# --- ---------- -------------- -------------------------------- */ -# 1.0 2026-04-16 Nitish Singh Initial local application */ -# runner implementation. */ -# 1.1 2026-04-16 Nitish Singh Added absolute path handling */ -# and restoration safeguards. */ -# 1.2 2026-05-09 Nitish Singh Added Apple Silicon */ -# optimizations and cleanup. */ -# 1.3 2026-05-16 Nitish Singh Added execution context */ -# validation and path sync. */ -# 1.4 2026-05-28 Nitish Singh Added automated clang-format */ -# execution and fallback logic. */ -# 1.5 2026-05-30 Nitish Singh Infrastructure header */ -# normalization and subsystem */ -# classification alignment. */ -#*********************************************************************/ - -set -euo pipefail - -#*********************************************************************/ -# Logging Utilities */ -#*********************************************************************/ - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -timestamp() { date +"%Y-%m-%d %H:%M:%S"; } -log_info() { echo -e "${BLUE}[$(timestamp)] [INFO]${NC} $1"; } -log_warn() { echo -e "${YELLOW}[$(timestamp)] [WARN]${NC} $1"; } -log_error() { echo -e "${RED}[$(timestamp)] [ERROR]${NC} $1"; } -log_success() { echo -e "${GREEN}[$(timestamp)] [SUCCESS]${NC} $1"; } - -#*********************************************************************/ -# 1. Environment & Path Synchronization */ -#*********************************************************************/ - -log_info "Synchronizing workspace context..." - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -CPP_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" -cd "$CPP_ROOT" - -if [ ! -f "CMakeListsLocalApp.txt" ]; then - log_error "Critical file missing: CMakeListsLocalApp.txt not found in $CPP_ROOT" - exit 1 -fi - -readonly BUILD_DIR="$CPP_ROOT/build/macos-latest" - -log_success "Workspace synchronized: $(pwd)" - -#*********************************************************************/ -# 2. Safety Backup & Context Swap */ -#*********************************************************************/ - -log_info "Swapping to Local App Configuration..." - -# Create a backup of the original C++ library CMakeLists -cp CMakeLists.txt CMakeLists.txt.bak - -# Overwrite with the standalone CLI App configuration -cp CMakeListsLocalApp.txt CMakeLists.txt - -cleanup() { - if [ -f "$CPP_ROOT/CMakeLists.txt.bak" ]; then - mv "$CPP_ROOT/CMakeLists.txt.bak" "$CPP_ROOT/CMakeLists.txt" - log_success "Configuration context restored." - fi -} -trap cleanup EXIT - -#*********************************************************************/ -# 3. Build Phase (M2 Optimization) */ -#*********************************************************************/ - -log_info "===== Building CLI Application =====" - -mkdir -p "$BUILD_DIR" - -# Corrected M2 P-Core detection -NUM_CORES=$(sysctl -n hw.perflevel0.logicalcpu 2>/dev/null || sysctl -n hw.ncpu || echo 2) - -# FIX: Changed -arch arm6 to -arch arm64 -cmake -S "$CPP_ROOT" -B "$BUILD_DIR" \ - -DCMAKE_BUILD_TYPE=Release \ - -DARCH_ARM64=ON \ - -DUSE_PCORES=ON \ - -DCMAKE_OSX_ARCHITECTURES=arm64 - -# Temporarily disable strict exit-on-error for the formatter target -set +e -log_info "Executing source workspace auto-formatting via clang-format..." -cmake --build "$BUILD_DIR" --target format -if [ $? -eq 0 ]; then - log_success "Workspace formatting complete." -else - log_warn "Formatting target encountered an initialization anomaly; proceeding to compilation." -fi -set -e # Re-enable strict error tracking for compilation safety - -log_info "Utilizing $NUM_CORES cores for parallel compilation..." -cmake --build "$BUILD_DIR" --config Release --parallel "$NUM_CORES" - -log_success "CLI App built successfully." - -#*********************************************************************/ -# 4. Execution Phase */ -#*********************************************************************/ - -echo -e "\n===== Running CLI App (sourcecode.cpp) =====" - -APP_BIN=$(find "$BUILD_DIR" -maxdepth 2 \( -name "app" -o -name "app.exe" \) | head -n 1) - -if [[ -n "$APP_BIN" && -f "$APP_BIN" ]]; then - cd "$(dirname "$APP_BIN")" - ./$(basename "$APP_BIN") - log_success "Execution completed." -else - log_error "Binary 'app' not found." - exit 1 -fi - -#*********************************************************************/ -# 5. Workspace Restoration */ -#*********************************************************************/ - -# The trap handles the CMakeLists restoration. -cd "$SCRIPT_DIR" -log_info "Returned to scripts directory." \ No newline at end of file diff --git a/README.md b/README.md index c5208b8..042f5fa 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,7 @@ The native engine serves as the high-performance execution core of the platform, To maintain deterministic CI/CD behavior across platforms, the project uses a centralized orchestration script. The workflow performs native compilation on macOS while delegating Linux and Windows builds to containerized toolchains. -[Orchestrator Script](Backend/CaseConversionAPI/Scripts/orchestrate-native-docker.sh) +[Orchestrator Script](Backend/CaseConversionAPI/CppLib/Scripts/orchestrate-native-docker.sh) ```Bash # LOCAL MACOS BUILD ---