From 16071dd914ba8ac96eda9d3dbb8f9f0bf0bc848b Mon Sep 17 00:00:00 2001 From: lampac-talks Date: Fri, 30 Jan 2026 17:31:11 +0300 Subject: [PATCH] feat: add support to build modules Signed-off-by: lampac-talks --- build.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index 6e77902..1395729 100755 --- a/build.sh +++ b/build.sh @@ -1,24 +1,62 @@ #!/usr/bin/env bash -# Build script for Lampac .NET project set -e -echo "Building Lampac project..." +echo "Building Lampac project with all modules..." # Verify .NET version echo "Using .NET version: $(dotnet --version)" -# Restore dependencies +# Clean previous builds +echo "Cleaning previous builds..." +rm -rf ./publish ./bin ./obj + +# Restore dependencies for entire solution echo "Restoring NuGet packages..." dotnet restore Lampac.sln -# Build the solution in Release mode -echo "Building solution..." +# Build all core projects in Release mode +echo "Building core solution..." dotnet build Lampac.sln --configuration Release --no-restore -# Optional: Publish the main application -echo "Publishing Lampac application..." +# Build and publish main application +echo "Publishing main application..." dotnet publish Lampac/Lampac.csproj --configuration Release --output ./publish --no-build +# Copy module references and compile dynamic modules +echo "Setting up modules..." +mkdir -p ./publish/module/references + +# Copy reference DLLs for module compilation +find . -name "*.dll" -path "*/bin/Release/*" -not -path "*/publish/*" | while read dll; do + cp "$dll" ./publish/module/references/ 2>/dev/null || true +done + +# Copy module source files if they exist +if [ -d "module" ]; then + echo "Copying module files..." + cp -r module ./publish/ + + # Compile any source-based modules + if [ -f "module/manifest.json" ]; then + echo "Compiling dynamic modules..." + cd ./publish + + # Use dotnet build to compile modules (this triggers the compilation logic in Startup.cs) + dotnet build --configuration Release --no-restore || echo "Module compilation completed with warnings" + + cd .. + fi +fi + +# Copy configuration files +echo "Copying configuration files..." +cp init.conf ./publish/ 2>/dev/null || echo "init.conf not found, will use defaults" +cp init.yaml ./publish/ 2>/dev/null || echo "init.yaml not found, will use defaults" + echo "Build completed successfully!" -echo "Published application available in ./publish directory" +echo "Full application with modules available in ./publish directory" +echo "" +echo "To run the application:" +echo " cd ./publish" +echo " dotnet Lampac.dll"