W17: extract ai_common shared module + fix anthropic data race + brace bugs
- New plugins_upper/ai_common/ static library: shared PluginConfig, ToolCallAccum, StreamContext, secure_zero, extract_host_port, serialize_tool_calls, free_chat_result - Refactored openai/anthropic plugins to use dstalk_ai:: namespace from ai_common - Fixed anthropic g_config raw pointer → std::atomic (data race) - Added SSE parse error counter with threshold abort (kMaxSseParseErrors=5) - Fixed missing closing brace in both plugins' error-body catch block - Updated test targets: ai_common include path + link, using namespace dstalk_ai - plugin_loader_test: added stub_unreg + service_registry.cpp for unregister_service - Includes pre-existing uncommitted changes from prior waves Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,17 +7,80 @@ set BUILD_DIR=%PROJECT_DIR%\build
|
||||
echo === dstalk CI Build ===
|
||||
echo Project: %PROJECT_DIR%
|
||||
|
||||
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
|
||||
cd /d "%BUILD_DIR%"
|
||||
|
||||
echo --- CMake Configure ---
|
||||
cmake "%PROJECT_DIR%" -G Ninja -DCMAKE_BUILD_TYPE=Release -DDSTALK_BUILD_TESTS=ON -DDSTALK_BUILD_GUI=OFF
|
||||
:: --- Find vcvarsall.bat for MSVC environment ---
|
||||
set VCVARSALL=
|
||||
for %%d in (
|
||||
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
|
||||
"C:\Program Files\Microsoft Visual Studio\2022\Professional"
|
||||
"C:\Program Files\Microsoft Visual Studio\2022\Community"
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
|
||||
) do (
|
||||
if exist "%%~d\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
set "VCVARSALL=%%~d\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
goto :found_vcvars
|
||||
)
|
||||
)
|
||||
:found_vcvars
|
||||
if "%VCVARSALL%"=="" (
|
||||
echo ERROR: vcvarsall.bat not found - install Visual Studio or set VCVARSALL
|
||||
exit /b 1
|
||||
)
|
||||
echo Using vcvarsall: %VCVARSALL%
|
||||
call "%VCVARSALL%" x64
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
:: --- Find conan: prefer tools\ local install, fallback to PATH ---
|
||||
set CONAN=
|
||||
if exist "%PROJECT_DIR%\tools\.venv\Scripts\conan.exe" (
|
||||
set "CONAN=%PROJECT_DIR%\tools\.venv\Scripts\conan.exe"
|
||||
) else (
|
||||
where conan >nul 2>&1
|
||||
if not errorlevel 1 set "CONAN=conan"
|
||||
)
|
||||
if "%CONAN%"=="" (
|
||||
echo ERROR: conan not found in tools\ or PATH
|
||||
exit /b 1
|
||||
)
|
||||
echo Using conan: %CONAN%
|
||||
|
||||
:: --- Detect conan profile ---
|
||||
echo --- Conan Profile Detect ---
|
||||
"%CONAN%" profile detect --force
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
:: --- Install dependencies ---
|
||||
echo --- Conan Install ---
|
||||
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
|
||||
cd /d "%BUILD_DIR%"
|
||||
"%CONAN%" install "%PROJECT_DIR%\deps\" --build=missing -s build_type=Release
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
:: --- Find conan toolchain ---
|
||||
set TOOLCHAIN=
|
||||
if exist "%BUILD_DIR%\build\Release\generators\conan_toolchain.cmake" (
|
||||
set "TOOLCHAIN=%BUILD_DIR%\build\Release\generators\conan_toolchain.cmake"
|
||||
) else if exist "%BUILD_DIR%\Release\generators\conan_toolchain.cmake" (
|
||||
set "TOOLCHAIN=%BUILD_DIR%\Release\generators\conan_toolchain.cmake"
|
||||
)
|
||||
if "%TOOLCHAIN%"=="" (
|
||||
echo ERROR: conan_toolchain.cmake not found
|
||||
exit /b 1
|
||||
)
|
||||
echo Toolchain: %TOOLCHAIN%
|
||||
|
||||
:: --- CMake configure ---
|
||||
echo --- CMake Configure ---
|
||||
cmake "%PROJECT_DIR%" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="%TOOLCHAIN%" -DDSTALK_BUILD_TESTS=ON -DDSTALK_BUILD_GUI=OFF
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
:: --- Build ---
|
||||
echo --- Build ---
|
||||
cmake --build . --parallel
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
:: --- Test ---
|
||||
echo --- Test ---
|
||||
ctest --output-on-failure --parallel 4
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
@@ -7,22 +7,65 @@ BUILD_DIR="${PROJECT_DIR}/build"
|
||||
echo "=== dstalk CI Build ==="
|
||||
echo "Project: ${PROJECT_DIR}"
|
||||
|
||||
# 创建构建目录
|
||||
# --- Find conan: prefer tools/ local install, fallback to PATH ---
|
||||
CONAN=""
|
||||
for candidate in \
|
||||
"${PROJECT_DIR}/tools/.venv/bin/conan" \
|
||||
"${PROJECT_DIR}/tools/.venv/Scripts/conan" \
|
||||
"${PROJECT_DIR}/tools/.venv/Scripts/conan.exe"; do
|
||||
if [ -x "${candidate}" ]; then
|
||||
CONAN="${candidate}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "${CONAN}" ] && command -v conan &>/dev/null; then
|
||||
CONAN="conan"
|
||||
fi
|
||||
if [ -z "${CONAN}" ]; then
|
||||
echo "ERROR: conan not found in tools/ or PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Using conan: ${CONAN}"
|
||||
|
||||
# --- Detect conan profile ---
|
||||
echo "--- Conan Profile Detect ---"
|
||||
"${CONAN}" profile detect --force
|
||||
|
||||
# --- Install dependencies ---
|
||||
echo "--- Conan Install ---"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
"${CONAN}" install "${PROJECT_DIR}/deps/" --build=missing -s build_type=Release
|
||||
|
||||
# CMake 配置
|
||||
# --- Find conan toolchain ---
|
||||
TOOLCHAIN=""
|
||||
for candidate in \
|
||||
"Release/generators/conan_toolchain.cmake" \
|
||||
"build/Release/generators/conan_toolchain.cmake"; do
|
||||
if [ -f "${candidate}" ]; then
|
||||
TOOLCHAIN="$(pwd)/${candidate}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "${TOOLCHAIN}" ]; then
|
||||
echo "ERROR: conan_toolchain.cmake not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Toolchain: ${TOOLCHAIN}"
|
||||
|
||||
# --- CMake configure ---
|
||||
echo "--- CMake Configure ---"
|
||||
cmake "${PROJECT_DIR}" -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN}" \
|
||||
-DDSTALK_BUILD_TESTS=ON \
|
||||
-DDSTALK_BUILD_GUI=OFF
|
||||
|
||||
# 编译
|
||||
# --- Build ---
|
||||
echo "--- Build ---"
|
||||
cmake --build . --parallel
|
||||
|
||||
# 运行测试
|
||||
# --- Test ---
|
||||
echo "--- Test ---"
|
||||
ctest --output-on-failure --parallel 4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user