From 09ee0d89dfd71c059db80ed93cd22b106ec8d478 Mon Sep 17 00:00:00 2001 From: Stan44 Date: Sat, 10 May 2025 05:11:35 -0500 Subject: [PATCH] fixed a bug of not building. Visual bug is known and annoying. --- .gitignore | 4 ++ build.bat | 105 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 65 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 372f0f8..1443cd3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ src/bindings/python/__pycache__/ /src/AdvChkSys.Benchmarks/bin /src/AdvChkSys.Benchmarks/obj +build/lib/AdvChkSys.dll +build/lib/AdvChkSys.xml +build/windows/AdvChkSys.dll +build/windows/AdvChkSys.xml diff --git a/build.bat b/build.bat index e656423..9f8b675 100644 --- a/build.bat +++ b/build.bat @@ -110,74 +110,84 @@ if %ERRORLEVEL% neq 0 ( echo %GREEN%✓ Packages restored%RESET% echo. -:: Build for Windows +:: Build the library (platform-agnostic) +echo %BRIGHT%%BLUE%Building AdvChkSys library...%RESET% +dotnet build "%PROJECT_DIR%\AdvChkSys.csproj" -c %CONFIG% --no-restore +if %ERRORLEVEL% neq 0 ( + echo %RED%✗ Library build failed%RESET% + exit /b 1 +) + +:: Copy library to output directories +if not exist "%OUTPUT_DIR%\lib" mkdir "%OUTPUT_DIR%\lib" +copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.dll" "%OUTPUT_DIR%\lib\" +copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.xml" "%OUTPUT_DIR%\lib\" + +:: Create platform-specific directories if "%BUILD_WINDOWS%"=="true" ( - echo %BRIGHT%%BLUE%Building for Windows...%RESET% - dotnet build "%PROJECT_DIR%\AdvChkSys.csproj" -c %CONFIG% -r win-x64 --no-restore - if %ERRORLEVEL% neq 0 ( - echo %RED%✗ Windows build failed%RESET% - exit /b 1 - ) - - :: Copy Windows build to output directory if not exist "%OUTPUT_DIR%\windows" mkdir "%OUTPUT_DIR%\windows" copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.dll" "%OUTPUT_DIR%\windows\" copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.xml" "%OUTPUT_DIR%\windows\" - echo %GREEN%✓ Windows build completed%RESET% - echo. ) -:: Build for Linux if "%BUILD_LINUX%"=="true" ( - echo %BRIGHT%%BLUE%Building for Linux...%RESET% - dotnet build "%PROJECT_DIR%\AdvChkSys.csproj" -c %CONFIG% -r linux-x64 --no-restore - if %ERRORLEVEL% neq 0 ( - echo %RED%✗ Linux build failed%RESET% - exit /b 1 - ) - - :: Copy Linux build to output directory if not exist "%OUTPUT_DIR%\linux" mkdir "%OUTPUT_DIR%\linux" copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.dll" "%OUTPUT_DIR%\linux\" copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.xml" "%OUTPUT_DIR%\linux\" - echo %GREEN%✓ Linux build completed%RESET% - echo. ) -:: Build for macOS if "%BUILD_MAC%"=="true" ( - echo %BRIGHT%%BLUE%Building for macOS...%RESET% - dotnet build "%PROJECT_DIR%\AdvChkSys.csproj" -c %CONFIG% -r osx-x64 --no-restore - if %ERRORLEVEL% neq 0 ( - echo %RED%✗ macOS build failed%RESET% - exit /b 1 - ) - - :: Copy macOS build to output directory if not exist "%OUTPUT_DIR%\macos" mkdir "%OUTPUT_DIR%\macos" copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.dll" "%OUTPUT_DIR%\macos\" copy "%PROJECT_DIR%\bin\%CONFIG%\netstandard2.1\AdvChkSys.xml" "%OUTPUT_DIR%\macos\" - echo %GREEN%✓ macOS build completed%RESET% - echo. ) +echo. :: Build benchmarks if "%BUILD_BENCHMARKS%"=="true" ( echo %BRIGHT%%BLUE%Building ChunkMark benchmarks...%RESET% - dotnet publish "%BENCHMARKS_DIR%\AdvChkSys.Benchmarks.csproj" -c %CONFIG% -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true - if %ERRORLEVEL% neq 0 ( - echo %RED%✗ Benchmark build failed%RESET% - exit /b 1 + + :: Restore benchmark packages + dotnet restore "%BENCHMARKS_DIR%\AdvChkSys.Benchmarks.csproj" + + :: Build for Windows + if "%BUILD_WINDOWS%"=="true" ( + dotnet publish "%BENCHMARKS_DIR%\AdvChkSys.Benchmarks.csproj" -c %CONFIG% -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true + if %ERRORLEVEL% neq 0 ( + echo %RED%✗ Windows benchmark build failed%RESET% + ) else ( + if not exist "%OUTPUT_DIR%\benchmarks\windows" mkdir "%OUTPUT_DIR%\benchmarks\windows" + copy "%BENCHMARKS_DIR%\bin\%CONFIG%\net6.0\win-x64\publish\ChunkMark.exe" "%OUTPUT_DIR%\benchmarks\windows\" + echo %GREEN%✓ Windows benchmarks built%RESET% + ) ) - :: Copy benchmark to output directory - if not exist "%OUTPUT_DIR%\benchmarks" mkdir "%OUTPUT_DIR%\benchmarks" - copy "%BENCHMARKS_DIR%\bin\%CONFIG%\net6.0\win-x64\publish\ChunkMark.exe" "%OUTPUT_DIR%\benchmarks\" + :: Build for Linux + if "%BUILD_LINUX%"=="true" ( + dotnet publish "%BENCHMARKS_DIR%\AdvChkSys.Benchmarks.csproj" -c %CONFIG% -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true + if %ERRORLEVEL% neq 0 ( + echo %RED%✗ Linux benchmark build failed%RESET% + ) else ( + if not exist "%OUTPUT_DIR%\benchmarks\linux" mkdir "%OUTPUT_DIR%\benchmarks\linux" + copy "%BENCHMARKS_DIR%\bin\%CONFIG%\net6.0\linux-x64\publish\ChunkMark" "%OUTPUT_DIR%\benchmarks\linux\" + echo %GREEN%✓ Linux benchmarks built%RESET% + ) + ) - echo %GREEN%✓ Benchmarks built%RESET% + :: Build for macOS + if "%BUILD_MAC%"=="true" ( + dotnet publish "%BENCHMARKS_DIR%\AdvChkSys.Benchmarks.csproj" -c %CONFIG% -r osx-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true + if %ERRORLEVEL% neq 0 ( + echo %RED%✗ macOS benchmark build failed%RESET% + ) else ( + if not exist "%OUTPUT_DIR%\benchmarks\macos" mkdir "%OUTPUT_DIR%\benchmarks\macos" + copy "%BENCHMARKS_DIR%\bin\%CONFIG%\net6.0\osx-x64\publish\ChunkMark" "%OUTPUT_DIR%\benchmarks\macos\" + echo %GREEN%✓ macOS benchmarks built%RESET% + ) + ) echo. ) @@ -208,18 +218,25 @@ echo. echo %BRIGHT%%GREEN%Build completed successfully!%RESET% echo. echo %BRIGHT%%WHITE%Output files:%RESET% +echo %WHITE%• Library: %OUTPUT_DIR%\lib\AdvChkSys.dll%RESET% if "%BUILD_WINDOWS%"=="true" ( echo %WHITE%• Windows: %OUTPUT_DIR%\windows\AdvChkSys.dll%RESET% + if "%BUILD_BENCHMARKS%"=="true" ( + echo %WHITE%• Windows Benchmark: %OUTPUT_DIR%\benchmarks\windows\ChunkMark.exe%RESET% + ) ) if "%BUILD_LINUX%"=="true" ( echo %WHITE%• Linux: %OUTPUT_DIR%\linux\AdvChkSys.dll%RESET% + if "%BUILD_BENCHMARKS%"=="true" ( + echo %WHITE%• Linux Benchmark: %OUTPUT_DIR%\benchmarks\linux\ChunkMark%RESET% + ) ) if "%BUILD_MAC%"=="true" ( echo %WHITE%• macOS: %OUTPUT_DIR%\macos\AdvChkSys.dll%RESET% -) -if "%BUILD_BENCHMARKS%"=="true" ( - echo %WHITE%• Benchmarks: %OUTPUT_DIR%\benchmarks\ChunkMark.exe%RESET% + if "%BUILD_BENCHMARKS%"=="true" ( + echo %WHITE%• macOS Benchmark: %OUTPUT_DIR%\benchmarks\macos\ChunkMark%RESET% + ) ) if "%BUILD_NUGET%"=="true" ( echo %WHITE%• NuGet: %OUTPUT_DIR%\nuget\AdvChkSys.%VERSION%.nupkg%RESET%