From 78b5b3dbc1ebcdc1f1cd0b1e5ba28fd6106150f7 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 25 Oct 2023 23:51:07 -0400 Subject: [PATCH] Add publish scripts for easier distribution --- BinaryObjectScanner.sln | 2 ++ publish-nix.sh | 69 ++++++++++++++++++++++++++++++++++++++++ publish-win.bat | 70 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 publish-nix.sh create mode 100644 publish-win.bat diff --git a/BinaryObjectScanner.sln b/BinaryObjectScanner.sln index 03d486d2..336df1bc 100644 --- a/BinaryObjectScanner.sln +++ b/BinaryObjectScanner.sln @@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Coding Guide.md = Coding Guide.md Developer Guide.md = Developer Guide.md LICENSE = LICENSE + publish-nix.sh = publish-nix.sh + publish-win.bat = publish-win.bat README.md = README.md EndProjectSection EndProject diff --git a/publish-nix.sh b/publish-nix.sh new file mode 100644 index 00000000..dae88518 --- /dev/null +++ b/publish-nix.sh @@ -0,0 +1,69 @@ +#! /bin/bash + +# This batch file assumes the following: +# - .NET 7.0 (or newer) SDK is installed and in PATH +# - zip is installed and in PATH +# - The relevant commandline programs are already downloaded +# and put into their respective folders +# +# If any of these are not satisfied, the operation may fail +# in an unpredictable way and result in an incomplete output. + +# Set the current directory as a variable +BUILD_FOLDER=$PWD + +# Restore Nuget packages for all builds +echo "Restoring Nuget packages" +dotnet restore + +# .NET 6.0 Debug +echo "Building .NET 6.0 debug" +dotnet publish Test/Test.csproj -f net6.0 -r win-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test/Test.csproj -f net6.0 -r linux-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test/Test.csproj -f net6.0 -r osx-x64 -c Debug --self-contained true -p:PublishSingleFile=true + +# .NET 6.0 Release +echo "Building .NET 6.0 release" +dotnet publish Test/Test.csproj -f net6.0 -r win-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test/Test.csproj -f net6.0 -r linux-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test/Test.csproj -f net6.0 -r osx-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebugType=None -p:DebugSymbols=false + +# .NET 7.0 Debug +echo "Building .NET 7.0 debug" +dotnet publish Test/Test.csproj -f net7.0 -r win-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test/Test.csproj -f net7.0 -r linux-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test/Test.csproj -f net7.0 -r osx-x64 -c Debug --self-contained true -p:PublishSingleFile=true + +# .NET 7.0 Release +echo "Building .NET 7.0 release" +dotnet publish Test/Test.csproj -f net7.0 -r win-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test/Test.csproj -f net7.0 -r linux-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test/Test.csproj -f net7.0 -r osx-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebugType=None -p:DebugSymbols=false + +# Create Test Debug archives +cd $BUILD_FOLDER/Test/bin/Debug/net6.0/win-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net6.0_win-x64_debug.zip . +cd $BUILD_FOLDER/Test/bin/Debug/net6.0/linux-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net6.0_linux-x64_debug.zip . +cd $BUILD_FOLDER/Test/bin/Debug/net6.0/osx-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net6.0_osx-x64_debug.zip . +cd $BUILD_FOLDER/Test/bin/Debug/net7.0/win-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net7.0_win-x64_debug.zip . +cd $BUILD_FOLDER/Test/bin/Debug/net7.0/linux-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net7.0_linux-x64_debug.zip . +cd $BUILD_FOLDER/Test/bin/Debug/net7.0/osx-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net7.0_osx-x64_debug.zip . + +# Create Test Release archives +cd $BUILD_FOLDER/Test/bin/Release/net6.0/win-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net6.0_win-x64_release.zip . +cd $BUILD_FOLDER/Test/bin/Release/net6.0/linux-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net6.0_linux-x64_release.zip . +cd $BUILD_FOLDER/Test/bin/Release/net6.0/osx-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net6.0_osx-x64_release.zip . +cd $BUILD_FOLDER/Test/bin/Release/net7.0/win-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net7.0_win-x64_release.zip . +cd $BUILD_FOLDER/Test/bin/Release/net7.0/linux-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net7.0_linux-x64_release.zip . +cd $BUILD_FOLDER/Test/bin/Release/net7.0/osx-x64/publish/ +zip -r $BUILD_FOLDER/BinaryObjectScanner_net7.0_osx-x64_release.zip . diff --git a/publish-win.bat b/publish-win.bat new file mode 100644 index 00000000..abb2d0c6 --- /dev/null +++ b/publish-win.bat @@ -0,0 +1,70 @@ +@echo OFF + +REM This batch file assumes the following: +REM - .NET Framework 4.8 SDK is installed and in PATH +REM - .NET 7.0 (or newer) SDK is installed and in PATH +REM - 7-zip commandline (7z.exe) is installed and in PATH +REM - The relevant commandline programs are already downloaded +REM and put into their respective folders +REM +REM If any of these are not satisfied, the operation may fail +REM in an unpredictable way and result in an incomplete output. + +REM Set the current directory as a variable +set BUILD_FOLDER=%~dp0 + +REM Restore Nuget packages for all builds +echo Restoring Nuget packages +dotnet restore + +REM Debug +echo Building debug +dotnet publish Test\Test.csproj -f net48 -r win7-x64 -c Debug --self-contained true +dotnet publish Test\Test.csproj -f net6.0 -r win-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test\Test.csproj -f net6.0 -r linux-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test\Test.csproj -f net6.0 -r osx-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test\Test.csproj -f net7.0 -r win-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test\Test.csproj -f net7.0 -r linux-x64 -c Debug --self-contained true -p:PublishSingleFile=true +dotnet publish Test\Test.csproj -f net7.0 -r osx-x64 -c Debug --self-contained true -p:PublishSingleFile=true + +REM Release +echo Building release +dotnet publish Test\Test.csproj -f net48 -r win7-x64 -c Release --self-contained true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test\Test.csproj -f net6.0 -r win-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test\Test.csproj -f net6.0 -r linux-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test\Test.csproj -f net6.0 -r osx-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test\Test.csproj -f net7.0 -r win-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test\Test.csproj -f net7.0 -r linux-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false +dotnet publish Test\Test.csproj -f net7.0 -r osx-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + +REM Create Test Debug archives +cd %BUILD_FOLDER%\Test\bin\Debug\net48\win7-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net48_debug.zip * +cd %BUILD_FOLDER%\Test\bin\Debug\net6.0\win-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net6.0_win-x64_debug.zip * +cd %BUILD_FOLDER%\Test\bin\Debug\net6.0\linux-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net6.0_linux-x64_debug.zip * +cd %BUILD_FOLDER%\Test\bin\Debug\net6.0\osx-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net6.0_osx-x64_debug.zip * +cd %BUILD_FOLDER%\Test\bin\Debug\net7.0\win-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net7.0_win-x64_debug.zip * +cd %BUILD_FOLDER%\Test\bin\Debug\net7.0\linux-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net7.0_linux-x64_debug.zip * +cd %BUILD_FOLDER%\Test\bin\Debug\net7.0\osx-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net7.0_osx-x64_debug.zip * + +REM Create Test Release archives +cd %BUILD_FOLDER%\Test\bin\Release\net48\win7-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net48_release.zip * +cd %BUILD_FOLDER%\Test\bin\Release\net6.0\win-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net6.0_win-x64_release.zip * +cd %BUILD_FOLDER%\Test\bin\Release\net6.0\linux-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net6.0_linux-x64_release.zip * +cd %BUILD_FOLDER%\Test\bin\Release\net6.0\osx-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net6.0_osx-x64_release.zip * +cd %BUILD_FOLDER%\Test\bin\Release\net7.0\win-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net7.0_win-x64_release.zip * +cd %BUILD_FOLDER%\Test\bin\Release\net7.0\linux-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net7.0_linux-x64_release.zip * +cd %BUILD_FOLDER%\Test\bin\Release\net7.0\osx-x64\publish\ +7z a -tzip %BUILD_FOLDER%\BinaryObjectScanner_net7.0_osx-x64_release.zip *