From b4e04314a728133357e44aa6883760acc09a1aa2 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 6 Dec 2024 15:56:13 -0500 Subject: [PATCH] Add gated program downloads to publish scripts --- CHANGELIST.md | 1 + publish-nix.sh | 42 +++++++++++++++++++++ publish-win.ps1 | 97 +++++++++++++++++++++++++++++++++++-------------- 3 files changed, 112 insertions(+), 28 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index bb38149b8..a052d786a 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -57,6 +57,7 @@ - Remove unnecessary namespace prefixes - Clean up original Drive tests - Add debug flag to publish scripts +- Add gated program downloads to publish scripts ### 3.2.4 (2024-11-24) diff --git a/publish-nix.sh b/publish-nix.sh index c93268508..91a7fe73d 100755 --- a/publish-nix.sh +++ b/publish-nix.sh @@ -3,6 +3,7 @@ # This batch file assumes the following: # - .NET 9.0 (or newer) SDK is installed and in PATH # - zip is installed and in PATH +# - wget is installed an in PATH # - Git is installed and in PATH # - The relevant commandline programs are already downloaded # and put into their respective folders @@ -203,6 +204,47 @@ fi # Only create archives if requested if [ $NO_ARCHIVE = false ]; then + # Download and extract, if needed + if [ $INCLUDE_PROGRAMS = true ]; then + echo "===== Downloading Required Programs =====" + + # Aaru + # --- Skipped for now --- + + # DiscImageCreator + wget https://github.com/user-attachments/files/17211434/DiscImageCreator_20241001.zip + unzip -u DiscImageCreator_20241001.zip + + # Redumper + wget https://github.com/superg/redumper/releases/download/build_438/redumper-2024.11.03_build438-win64.zip + unzip redumper-2024.11.03_build438-win64.zip + + # Create directories and copy data + for FRAMEWORK in "${UI_FRAMEWORKS[@]}"; do + for RUNTIME in "${UI_RUNTIMES[@]}"; do + if [ $INCLUDE_DEBUG = true ]; then + mkdir -p MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator + cp -rf Release_ANSI/* MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/ + + mkdir -p MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper + cp -rf redumper-2024.11.03_build438-win64/bin/redumper.exe MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/ + fi + + mkdir -p MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator + cp -rf Release_ANSI/* MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/ + + mkdir -p MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper + cp -rf redumper-2024.11.03_build438-win64/bin/redumper.exe MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/ + done + done + + # Clean up the odownloaded files and directories + rm DiscImageCreator_20241001.zip + rm -r Release_ANSI + rm redumper-2024.11.03_build438-win64.zip + rm -r redumper-2024.11.03_build438-win64 + fi + # Create UI archives for FRAMEWORK in "${UI_FRAMEWORKS[@]}"; do for RUNTIME in "${UI_RUNTIMES[@]}"; do diff --git a/publish-win.ps1 b/publish-win.ps1 index f84ecbb31..d5c41292e 100644 --- a/publish-win.ps1 +++ b/publish-win.ps1 @@ -71,8 +71,8 @@ if (!$NO_BUILD.IsPresent) { dotnet restore # Create Nuget Packages - dotnet pack MPF.ExecutionContexts\MPF.ExecutionContexts.csproj --output $BUILD_FOLDER - dotnet pack MPF.Processors\MPF.Processors.csproj --output $BUILD_FOLDER + dotnet pack MPF.ExecutionContexts/MPF.ExecutionContexts.csproj --output $BUILD_FOLDER + dotnet pack MPF.Processors/MPF.Processors.csproj --output $BUILD_FOLDER # Build UI foreach ($FRAMEWORK in $UI_FRAMEWORKS) { @@ -96,16 +96,16 @@ if (!$NO_BUILD.IsPresent) { if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true + dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true } - dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false } else { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT + dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT } - dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false } } } @@ -132,16 +132,16 @@ if (!$NO_BUILD.IsPresent) { if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true + dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true } - dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false } else { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT + dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT } - dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false } } } @@ -168,16 +168,16 @@ if (!$NO_BUILD.IsPresent) { if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true + dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true } - dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false } else { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT + dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT } - dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false } } } @@ -185,6 +185,47 @@ if (!$NO_BUILD.IsPresent) { # Only create archives if requested if (!$NO_ARCHIVE.IsPresent) { + # Download and extract, if needed + if ($INCLUDE_PROGRAMS.IsPresent) { + Write-Host "===== Downloading Required Programs =====" + + # Aaru + # --- Skipped for now --- + + # DiscImageCreator + Invoke-WebRequest -Uri https://github.com/user-attachments/files/17211434/DiscImageCreator_20241001.zip -OutFile DiscImageCreator_20241001.zip + Expand-Archive -LiteralPath "DiscImageCreator_20241001.zip" -DestinationPath "$BUILD_FOLDER/Creator" + + # Redumper + Invoke-WebRequest -Uri https://github.com/superg/redumper/releases/download/build_438/redumper-2024.11.03_build438-win64.zip -OutFile redumper-2024.11.03_build438-win64.zip + Expand-Archive -LiteralPath "redumper-2024.11.03_build438-win64.zip" -DestinationPath "$BUILD_FOLDER/Redumper" + + # Create directories and copy data + foreach ($FRAMEWORK in $UI_FRAMEWORKS) { + foreach ($RUNTIME in $UI_RUNTIMES) { + if ($INCLUDE_DEBUG.IsPresent) { + New-Item -Name "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator" -Type Directory -ErrorAction SilentlyContinue + Copy-Item -Path "Creator/Release_ANSI/*" -Destination "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/" -Recurse -Force + + New-Item -Name "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper" -Type Directory -ErrorAction SilentlyContinue + Copy-Item -Path "Redumper/redumper-2024.11.03_build438-win64/bin/redumper.exe" -Destination "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/" -Force + } + + New-Item -Name "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator" -Type Directory -ErrorAction SilentlyContinue + Copy-Item -Path "Creator/Release_ANSI/*" -Destination "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/" -Recurse -Force + + New-Item -Name "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper" -Type Directory -ErrorAction SilentlyContinue + Copy-Item -Path "Redumper/redumper-2024.11.03_build438-win64/bin/redumper.exe" -Destination "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/" -Force + } + } + + # Clean up the odownloaded files and directories + Remove-Item -Path "DiscImageCreator_20241001.zip" + Remove-Item -Path "Creator" -Recurse + Remove-Item -Path "redumper-2024.11.03_build438-win64.zip" + Remove-Item -Path "Redumper" -Recurse + } + # Create UI archives foreach ($FRAMEWORK in $UI_FRAMEWORKS) { foreach ($RUNTIME in $UI_RUNTIMES) { @@ -205,21 +246,21 @@ if (!$NO_ARCHIVE.IsPresent) { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - Set-Location -Path $BUILD_FOLDER\MPF.UI\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\ + Set-Location -Path $BUILD_FOLDER/MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/ if ($INCLUDE_PROGRAMS.IsPresent) { - 7z a -tzip $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip * + 7z a -tzip $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip * } else { - 7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip * + 7z a -tzip -x!Programs/* $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip * } } - Set-Location -Path $BUILD_FOLDER\MPF.UI\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ + Set-Location -Path $BUILD_FOLDER/MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ if ($INCLUDE_PROGRAMS.IsPresent) { - 7z a -tzip $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip * + 7z a -tzip $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip * } else { - 7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip * + 7z a -tzip -x!Programs/* $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip * } } } @@ -244,11 +285,11 @@ if (!$NO_ARCHIVE.IsPresent) { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - Set-Location -Path $BUILD_FOLDER\MPF.CLI\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\ - 7z a -tzip $BUILD_FOLDER\MPF.CLI_${FRAMEWORK}_${RUNTIME}_debug.zip * + Set-Location -Path $BUILD_FOLDER/MPF.CLI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/ + 7z a -tzip $BUILD_FOLDER/MPF.CLI_${FRAMEWORK}_${RUNTIME}_debug.zip * } - Set-Location -Path $BUILD_FOLDER\MPF.CLI\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ - 7z a -tzip $BUILD_FOLDER\MPF.CLI_${FRAMEWORK}_${RUNTIME}_release.zip * + Set-Location -Path $BUILD_FOLDER/MPF.CLI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ + 7z a -tzip $BUILD_FOLDER/MPF.CLI_${FRAMEWORK}_${RUNTIME}_release.zip * } } @@ -272,11 +313,11 @@ if (!$NO_ARCHIVE.IsPresent) { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { - Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\ - 7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_debug.zip * + Set-Location -Path $BUILD_FOLDER/MPF.Check/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/ + 7z a -tzip $BUILD_FOLDER/MPF.Check_${FRAMEWORK}_${RUNTIME}_debug.zip * } - Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ - 7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_release.zip * + Set-Location -Path $BUILD_FOLDER/MPF.Check/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ + 7z a -tzip $BUILD_FOLDER/MPF.Check_${FRAMEWORK}_${RUNTIME}_release.zip * } }