diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-01 17:33:41 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-01 17:33:41 -0400 |
commit | 0e4aa65708df7ca4096b9019428d9fccabd37384 (patch) | |
tree | ada8be44425f93ee3d6fd0ac4283af2487b4b1e8 | |
parent | ea9324586d4aaafd9d18f09e0bf110e57d86c449 (diff) | |
download | SMAPI-0e4aa65708df7ca4096b9019428d9fccabd37384.tar.gz SMAPI-0e4aa65708df7ca4096b9019428d9fccabd37384.tar.bz2 SMAPI-0e4aa65708df7ca4096b9019428d9fccabd37384.zip |
fix crossplatform build scripts
-rwxr-xr-x | build/unix/prepare-install-package.sh | 22 | ||||
-rw-r--r-- | build/windows/prepare-install-package.ps1 | 66 | ||||
-rw-r--r-- | docs/technical/smapi.md | 3 |
3 files changed, 51 insertions, 40 deletions
diff --git a/build/unix/prepare-install-package.sh b/build/unix/prepare-install-package.sh index e9b413b4..9b195f37 100755 --- a/build/unix/prepare-install-package.sh +++ b/build/unix/prepare-install-package.sh @@ -9,7 +9,7 @@ ########## -## Constants +## Fetch values ########## # paths gamePath="/home/pathoschild/Stardew Valley" @@ -21,25 +21,18 @@ folders=("linux" "macOS" "windows") declare -A runtimes=(["linux"]="linux-x64" ["macOS"]="osx-x64" ["windows"]="win-x64") declare -A msBuildPlatformNames=(["linux"]="Unix" ["macOS"]="OSX" ["windows"]="Windows_NT") - -########## -## Move to SMAPI root -########## -cd "`dirname "$0"`/../.." - - -########## -## Set version -########## -# get version number +# version number version="$1" if [ $# -eq 0 ]; then echo "SMAPI release version (like '4.0.0'):" read version fi -# set version -. ${0%/*}/set-smapi-version.sh "$version" + +########## +## Move to SMAPI root +########## +cd "`dirname "$0"`/../.." ########## @@ -56,6 +49,7 @@ echo "" ########## ## Compile files ########## +. ${0%/*}/set-smapi-version.sh "$version" for folder in ${folders[@]}; do runtime=${runtimes[$folder]} msbuildPlatformName=${msBuildPlatformNames[$folder]} diff --git a/build/windows/prepare-install-package.ps1 b/build/windows/prepare-install-package.ps1 index 5a1e0bcc..5e116019 100644 --- a/build/windows/prepare-install-package.ps1 +++ b/build/windows/prepare-install-package.ps1 @@ -1,33 +1,19 @@ # # # This is the PowerShell equivalent of ../unix/prepare-install-package.sh, *except* that it doesn't -# set Linux permissions, create the install.dat files, or create the final zip. Due to limitations -# in PowerShell, the final changes are handled by the windows/finalize-install-package.sh file in -# WSL. +# set Linux permissions, create the install.dat files, or create the final zip (unless you specify +# --windows-only). Due to limitations in PowerShell, the final changes are handled by the +# windows/finalize-install-package.sh file in WSL. # # When making changes, make sure to update ../unix/prepare-install-package.ps1 too. # # - -. "$PSScriptRoot\lib\in-place-regex.ps1" +. "$PSScriptRoot/lib/in-place-regex.ps1" ########## -## Set version -########## -# get version number -$version = $args[0] -if (!$version) { - $version = Read-Host "SMAPI release version (like '4.0.0')" -} - -# set version -. "$PSScriptRoot/set-smapi-version.ps1" "$version" - - -########## -## Constants +## Fetch values ########## # paths $gamePath = "C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley" @@ -39,6 +25,23 @@ $folders = "linux", "macOS", "windows" $runtimes = @{ linux = "linux-x64"; macOS = "osx-x64"; windows = "win-x64" } $msBuildPlatformNames = @{ linux = "Unix"; macOS = "OSX"; windows = "Windows_NT" } +# version number +$version = $args[0] +if (!$version) { + $version = Read-Host "SMAPI release version (like '4.0.0')" +} + +# Windows-only build +$windowsOnly = $false +foreach ($arg in $args) { + if ($arg -eq "--windows-only") { + $windowsOnly = $true + $folders = "windows" + $runtimes = @{ windows = "win-x64" } + $msBuildPlatformNames = @{ windows = "Windows_NT" } + } +} + ########## ## Move to SMAPI root @@ -62,7 +65,8 @@ echo "" ########## ## Compile files ########## -ForEach ($folder in $folders) { +. "$PSScriptRoot/set-smapi-version.ps1" "$version" +foreach ($folder in $folders) { $runtime = $runtimes[$folder] $msbuildPlatformName = $msBuildPlatformNames[$folder] @@ -106,6 +110,10 @@ foreach ($folder in $folders) { # copy base installer files foreach ($name in @("install on Linux.sh", "install on macOS.command", "install on Windows.bat", "README.txt")) { + if ($windowsOnly -and ($name -eq "install on Linux.sh" -or $name -eq "install on macOS.command")) { + continue; + } + cp "$installAssets/$name" "$packagePath" } @@ -199,11 +207,14 @@ foreach ($folder in $folders) { In-Place-Regex -Path "$packagePath/internal/$folder/bundle/smapi-internal/config.json" -Search "`"DeveloperMode`": true" -Replace "`"DeveloperMode`": false" # convert bundle folder into final 'install.dat' files - foreach ($path in @("$packagePath/internal/$folder", "$packageDevPath/internal/$folder")) + if ($windowsOnly) { - Compress-Archive -Path "$path/bundle/*" -CompressionLevel Optimal -DestinationPath "$path/install.zip" - mv "$path/install.zip" "$path/install.dat" - rm -Recurse -Force "$path/bundle" + foreach ($path in @("$packagePath/internal/$folder", "$packageDevPath/internal/$folder")) + { + Compress-Archive -Path "$path/bundle/*" -CompressionLevel Optimal -DestinationPath "$path/install.zip" + mv "$path/install.zip" "$path/install.dat" + rm -Recurse -Force "$path/bundle" + } } } @@ -216,8 +227,11 @@ mv "$packagePath" "bin/SMAPI $version installer" mv "$packageDevPath" "bin/SMAPI $version installer for developers" # package files -Compress-Archive -Path "bin/SMAPI $version installer" -DestinationPath "bin/SMAPI $version installer.zip" -CompressionLevel Optimal -Compress-Archive -Path "bin/SMAPI $version installer for developers" -DestinationPath "bin/SMAPI $version installer for developers.zip" -CompressionLevel Optimal +if ($windowsOnly) +{ + Compress-Archive -Path "bin/SMAPI $version installer" -DestinationPath "bin/SMAPI $version installer.zip" -CompressionLevel Optimal + Compress-Archive -Path "bin/SMAPI $version installer for developers" -DestinationPath "bin/SMAPI $version installer for developers.zip" -CompressionLevel Optimal +} echo "" echo "Done! See docs/technical/smapi.md to create the release zips." diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md index 4d75aef2..44b6e49f 100644 --- a/docs/technical/smapi.md +++ b/docs/technical/smapi.md @@ -166,5 +166,8 @@ Windows](#on-windows)_ section below to create a build that retains the icon.** build/windows/finalize-install-package.sh "$version" "$binFolder" ``` +Note: to prepare a test Windows-only build, you can pass `--windows-only` in the first step and +skip the second one. + ## Release notes See [release notes](../release-notes.md). |