From c10685b03574e967c1bf48aafc814f60196812ec Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 1 Dec 2021 17:19:21 -0500 Subject: update mod build package release notes --- docs/technical/mod-package.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/technical/mod-package.md b/docs/technical/mod-package.md index 93e0009d..41f808a5 100644 --- a/docs/technical/mod-package.md +++ b/docs/technical/mod-package.md @@ -412,7 +412,9 @@ The NuGet package is generated automatically in `StardewModdingAPI.ModBuildConfi when you compile it. ## Release notes -## Upcoming release +## 4.0.0 +Released 30 November 2021. + * Updated for Stardew Valley 1.5.5 and SMAPI 3.13.0. (Older versions are no longer supported.) * Added `IgnoreModFilePaths` option to ignore literal paths. * Added `BundleExtraAssemblies` option to copy bundled DLLs into the mod zip/folder. -- cgit From bf5a9b87627b04523c7885b503e85ca2021c63a3 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 2 Dec 2021 20:48:00 -0500 Subject: switch to scripted release package process --- build/common.targets | 3 +- build/prepare-install-package.sh | 201 +++++++++++++++++++++++++++++ build/prepare-install-package.targets | 130 ------------------- docs/release-notes.md | 9 +- docs/technical/smapi.md | 58 ++++----- src/SMAPI.Installer/SMAPI.Installer.csproj | 1 - src/SMAPI.sln | 6 +- 7 files changed, 238 insertions(+), 170 deletions(-) create mode 100755 build/prepare-install-package.sh delete mode 100644 build/prepare-install-package.targets diff --git a/build/common.targets b/build/common.targets index 578076a9..c9a54763 100644 --- a/build/common.targets +++ b/build/common.targets @@ -8,6 +8,7 @@ $(DefineConstants);SMAPI_FOR_WINDOWS + true @@ -19,7 +20,7 @@ - + diff --git a/build/prepare-install-package.sh b/build/prepare-install-package.sh new file mode 100755 index 00000000..c16fcd5f --- /dev/null +++ b/build/prepare-install-package.sh @@ -0,0 +1,201 @@ +#!/bin/bash + +########## +## Constants +########## +gamePath="/home/pathoschild/Stardew Valley" +bundleModNames=("ConsoleCommands" "ErrorHandler" "SaveBackup") +buildConfig="Release" +folders=("unix" "windows") +declare -A runtimes=(["unix"]="linux-x64" ["windows"]="win-x64") +declare -A msBuildPlatformNames=(["unix"]="Unix" ["windows"]="Windows_NT") + + +########## +## Move to SMAPI root +########## +cd "`dirname "$0"`/.." + + +########## +## Clear old build files +########## +echo "Clearing old builds..." +echo "-----------------------" +for path in */**/bin */**/obj; do + rm -rf $path +done +rm -rf "bin" +echo "" + +########## +## Compile files +########## +for folder in ${folders[@]}; do + runtime=${runtimes[$folder]} + msbuildPlatformName=${msBuildPlatformNames[$folder]} + + # SMAPI + echo "Compiling SMAPI for $folder..." + echo "------------------" + dotnet publish src/SMAPI --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" + echo "" + echo "" + + echo "Compiling installer for $folder..." + echo "----------------------" + dotnet publish src/SMAPI.Installer --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" + echo "" + echo "" + + for modName in ${bundleModNames[@]}; do + echo "Compiling $modName for $folder..." + echo "----------------------------------" + dotnet publish src/SMAPI.Mods.$modName --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" + echo "" + echo "" + done +done + + +########## +## Prepare install package +########## +echo "Preparing install package..." +echo "----------------------------" + +# init paths +installAssets="src/SMAPI.Installer/assets" +packagePath="bin/SMAPI installer" +packageDevPath="bin/SMAPI installer for developers" + +# init structure +for folder in ${folders[@]}; do + mkdir "$packagePath/internal/$folder/bundle/smapi-internal" --parents +done + +# copy base installer files +cp "$installAssets/unix-install.sh" "$packagePath/install on Linux.sh" +cp "$installAssets/unix-install.sh" "$packagePath/install on macOS.command" +cp "$installAssets/windows-install.bat" "$packagePath/install on Windows.bat" +cp "$installAssets/README.txt" "$packagePath/README.txt" + +# copy per-platform files +for folder in ${folders[@]}; do + runtime=${runtimes[$folder]} + + # get paths + installBin="src/SMAPI.Installer/bin/$buildConfig/$runtime" + smapiBin="src/SMAPI/bin/$buildConfig/$runtime" + internalPath="$packagePath/internal/$folder" + bundlePath="$internalPath/bundle" + + # runtime config for installer + cp "$installBin/SMAPI.Installer.runtimeconfig.json" "$internalPath/SMAPI.Installer.runtimeconfig.json" + + # runtime config for SMAPI + cp "$installAssets/runtimeconfig.$folder.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json" + + # installer DLL + cp "$installBin/SMAPI.Installer.dll" "$internalPath/SMAPI.Installer.dll" + if [ $folder == "windows" ]; then + cp "$installAssets/windows-exe-config.xml" "$packagePath/internal/windows/install.exe.config" + fi + + # bundle root files + for name in "StardewModdingAPI" "StardewModdingAPI.dll" "StardewModdingAPI.pdb" "StardewModdingAPI.xml" "steam_appid.txt"; do + if [ $name == "StardewModdingAPI" ] && [ $folder == "windows" ]; then + name="$name.exe" + fi + + cp "$smapiBin/$name" "$bundlePath/$name" + done + + # bundle i18n + cp -r "$smapiBin/i18n" "$bundlePath/smapi-internal" + + # bundle smapi-internal + for name in "0Harmony.dll" "0Harmony.xml" "Mono.Cecil.dll" "Mono.Cecil.Mdb.dll" "Mono.Cecil.Pdb.dll" "MonoMod.Common.dll" "Newtonsoft.Json.dll" "TMXTile.dll" "SMAPI.Toolkit.dll" "SMAPI.Toolkit.pdb" "SMAPI.Toolkit.xml" "SMAPI.Toolkit.CoreInterfaces.dll" "SMAPI.Toolkit.CoreInterfaces.pdb" "SMAPI.Toolkit.CoreInterfaces.xml"; do + cp "$smapiBin/$name" "$bundlePath/smapi-internal/$name" + done + + cp "$smapiBin/SMAPI.config.json" "$bundlePath/smapi-internal/config.json" + cp "$smapiBin/SMAPI.metadata.json" "$bundlePath/smapi-internal/metadata.json" + if [ $folder == "unix" ]; then + cp "$installAssets/unix-launcher.sh" "$bundlePath/unix-launcher.sh" + cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal/System.Runtime.Caching.dll" + else + cp "$installAssets/windows-exe-config.xml" "$bundlePath/StardewModdingAPI.exe.config" + fi + + # copy .NET dependencies + cp "$smapiBin/System.Configuration.ConfigurationManager.dll" "$bundlePath/smapi-internal/System.Configuration.ConfigurationManager.dll" + cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal/System.Runtime.Caching.dll" + cp "$smapiBin/System.Security.Permissions.dll" "$bundlePath/smapi-internal/System.Security.Permissions.dll" + if [ $folder == "windows" ]; then + cp "$smapiBin/System.Management.dll" "$bundlePath/smapi-internal/System.Management.dll" + fi + + # copy bundled mods + for modName in ${bundleModNames[@]}; do + fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime" + targetPath="$bundlePath/Mods/$modName" + + mkdir "$targetPath" --parents + + cp "$fromPath/$modName.dll" "$targetPath/$modName.dll" + cp "$fromPath/$modName.pdb" "$targetPath/$modName.pdb" + cp "$fromPath/manifest.json" "$targetPath/manifest.json" + if [ -d "$fromPath/i18n" ]; then + cp -r "$fromPath/i18n" "$targetPath" + fi + done +done + +# mark scripts executable +for path in "install on Linux.sh" "install on macOS.command" "bundle/unix-launcher.sh"; do + if [ -f "$packagePath/$path" ]; then + chmod 755 "$packagePath/$path" + fi +done + +# split into main + for-dev folders +cp -r "$packagePath" "$packageDevPath" +for folder in ${folders[@]}; do + # disable developer mode in main package + sed --in-place --expression="s/\"DeveloperMode\": true/\"DeveloperMode\": false/" "$packagePath/internal/$folder/bundle/smapi-internal/config.json" + + # convert bundle folder into final 'install.dat' files + for path in "$packagePath/internal/$folder" "$packageDevPath/internal/$folder"; do + pushd "$path/bundle" > /dev/null + zip "install.dat" * --recurse-paths --quiet + popd > /dev/null + mv "$path/bundle/install.dat" "$path/install.dat" + rm -rf "$path/bundle" + done +done + + +########## +## Create release zips +########## +# get version number +version="$1" +if [ $# -eq 0 ]; then + echo "SMAPI release version (like '4.0.0'):" + read version +fi + +# rename folders +mv "$packagePath" "bin/SMAPI $version installer" +mv "$packageDevPath" "bin/SMAPI $version installer for developers" + + +# package files +pushd bin > /dev/null +zip -9 "SMAPI $version installer.zip" "SMAPI $version installer" --recurse-paths --quiet +zip -9 "SMAPI $version installer for developers.zip" "SMAPI $version installer for developers" --recurse-paths --quiet +popd > /dev/null + +echo "" +echo "Done! Package created in $(pwd)/bin" diff --git a/build/prepare-install-package.targets b/build/prepare-install-package.targets deleted file mode 100644 index ef5624ad..00000000 --- a/build/prepare-install-package.targets +++ /dev/null @@ -1,130 +0,0 @@ - - - - - windows - unix - - $(SolutionDir) - $(SolutionDir)\..\bin - - $(BuildRootPath)\SMAPI\bin\$(Configuration) - $(BuildRootPath)\SMAPI.Toolkit\bin\$(Configuration)\net5.0 - $(BuildRootPath)\SMAPI.Mods.ConsoleCommands\bin\$(Configuration) - $(BuildRootPath)\SMAPI.Mods.ErrorHandler\bin\$(Configuration) - $(BuildRootPath)\SMAPI.Mods.SaveBackup\bin\$(Configuration) - - $(OutRootPath)\SMAPI installer - $(OutRootPath)\SMAPI installer for developers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/release-notes.md b/docs/release-notes.md index d50a923d..cb52f814 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,11 +1,16 @@ ← [README](README.md) # Release notes +## Upcoming version +* For SMAPI maintainers: + * Added a new [scripted release package process](technical/smapi.md), which removes the need to compile SMAPI on multiple platforms and manually combine them. + ## 3.13.1 Released 30 November 2021 for Stardew Valley 1.5.5 or later. -* Improved .NET 5 validation in Windows installer to better explain how to get the right version. -* Fixed installer failing on Windows when run from the game folder. +* For players: + * Improved .NET 5 validation in Windows installer to better explain how to get the right version. + * Fixed installer failing on Windows when run from the game folder. ## 3.13.0 Released 30 November 2021 for Stardew Valley 1.5.5 or later. diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md index 29fa43a8..ce1220f1 100644 --- a/docs/technical/smapi.md +++ b/docs/technical/smapi.md @@ -75,22 +75,24 @@ the debugger attached, so you can intercept errors and step through the code bei doesn't work in MonoDevelop on Linux, unfortunately. ### Preparing a release -To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms: Windows and -Linux. The instructions below assume you have Windows 11, but you can adapt them for -a different setup if needed. +To prepare a crossplatform SMAPI release, you'll need to run the build script on Linux or macOS. #### Initial setup -First-time setup on Windows: -1. [Install Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install). -2. Install the needed software in WSL: - 1. Run `sudo apt update` to update the package list. - 2. Install [the .NET 5 SDK](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu) - (for Stardew Valley 1.5.5+) or [`mono-complete`](https://www.mono-project.com/download/stable/) - (for earlier versions). - _You can run `lsb_release -a` to get the Ubuntu version number._ - 3. [Install Steam](https://linuxconfig.org/how-to-install-steam-on-ubuntu-20-04-focal-fossa-linux). - 4. Launch `steam` and install the game like usual. - 5. Download and install your preferred IDE. For the [latest standalone Rider +First-time setup: + +1. On Windows only: + + 1. [Install Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install). + 2. Run `sudo apt update` in WSL to update the package list. + 3. The rest of the instructions below should be run in WSL. + +2. Install the required software: + + 1. Install the [.NET 5 SDK](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu). + _For Ubuntu-based systems, you can run `lsb_release -a` to get the Ubuntu version number._ + 2. [Install Steam](https://linuxconfig.org/how-to-install-steam-on-ubuntu-20-04-focal-fossa-linux). + 3. Launch `steam` and install the game like usual. + 4. Download and install your preferred IDE. For the [latest standalone Rider version](https://www.jetbrains.com/help/rider/Installation_guide.html#prerequisites): ```sh wget "" -O rider-install.tar.gz @@ -98,23 +100,20 @@ First-time setup on Windows: ln -s "/opt/JetBrains Rider-/bin/rider.sh" ./rider.sh ``` - 3. Clone the SMAPI repo in WSL: - ```sh - git clone https://github.com/Pathoschild/SMAPI.git - ``` -To compile SMAPI in WSL: -1. Run `./rider.sh` to open the Rider GUI. -2. Use the GUI to compile the solution. +3. Clone the SMAPI repo: + ```sh + git clone https://github.com/Pathoschild/SMAPI.git + ``` To launch the game: -1. Open a WSL terminal. -2. Run these commands to start Steam: + +1. Run these commands to start Steam: ```sh export TERM=xterm steam ``` -3. Launch the game through the Steam UI. +2. Launch the game through the Steam UI. #### Prepare the release 1. Update the version numbers in `build/common.targets`, `Constants`, and the `manifest.json` for @@ -125,15 +124,8 @@ To launch the game: dev build | `-alpha.` | `3.0.0-alpha.20171230` prerelease | `-beta.` | `3.0.0-beta.20171230` release | `` | `3.0.0` -2. In Windows: - 1. Rebuild the solution with the _release_ solution configuration. - 2. Copy the `bin/SMAPI installer` and `bin/SMAPI installer for developers` folders to Linux. -4. In Linux: - 1. Rebuild the solution with the _release_ solution configuration. - 2. Add the `windows-install.*` files from Windows to the `bin/SMAPI installer` and - `bin/SMAPI installer for developers` folders compiled on Linux. - 3. Rename the folders to `SMAPI installer` and `SMAPI installer for developers`. - 4. Zip the two folders. +2. Run the `build/prepare-install-package.sh` script. This will create the release package in the + root `bin` folder. ### Custom Harmony build SMAPI uses [a custom build of Harmony](https://github.com/Pathoschild/Harmony#readme), which is diff --git a/src/SMAPI.Installer/SMAPI.Installer.csproj b/src/SMAPI.Installer/SMAPI.Installer.csproj index e3e01467..928e5c18 100644 --- a/src/SMAPI.Installer/SMAPI.Installer.csproj +++ b/src/SMAPI.Installer/SMAPI.Installer.csproj @@ -17,5 +17,4 @@ - diff --git a/src/SMAPI.sln b/src/SMAPI.sln index 92c6cb24..9a42b9ff 100644 --- a/src/SMAPI.sln +++ b/src/SMAPI.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28729.10 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".root", ".root", "{86C452BE-D2D8-45B4-B63F-E329EB06CEDA}" ProjectSection(SolutionItems) = preProject @@ -28,7 +28,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{09CF91E5 ProjectSection(SolutionItems) = preProject ..\build\common.targets = ..\build\common.targets ..\build\find-game-folder.targets = ..\build\find-game-folder.targets - ..\build\prepare-install-package.targets = ..\build\prepare-install-package.targets + ..\build\prepare-install-package.sh = ..\build\prepare-install-package.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{EB35A917-67B9-4EFA-8DFC-4FB49B3949BB}" -- cgit From 181508084b5bb2bb7b8cd61ec3193a293300ba45 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 3 Dec 2021 00:26:46 -0500 Subject: make installer self-contained This lets players run the installer without manually installing .NET 5, which was causing a lot of support requests. --- build/prepare-install-package.sh | 41 ++++++++------ docs/release-notes.md | 3 + src/SMAPI.Installer/assets/README.txt | 18 +++--- src/SMAPI.Installer/assets/install on Linux.sh | 4 ++ src/SMAPI.Installer/assets/install on Windows.bat | 41 ++++++++++++++ .../assets/install on macOS.command | 6 ++ src/SMAPI.Installer/assets/unix-install.sh | 14 ----- src/SMAPI.Installer/assets/windows-install.bat | 64 ---------------------- 8 files changed, 87 insertions(+), 104 deletions(-) create mode 100644 src/SMAPI.Installer/assets/install on Linux.sh create mode 100644 src/SMAPI.Installer/assets/install on Windows.bat create mode 100644 src/SMAPI.Installer/assets/install on macOS.command delete mode 100644 src/SMAPI.Installer/assets/unix-install.sh delete mode 100644 src/SMAPI.Installer/assets/windows-install.bat diff --git a/build/prepare-install-package.sh b/build/prepare-install-package.sh index c16fcd5f..2d03ba82 100755 --- a/build/prepare-install-package.sh +++ b/build/prepare-install-package.sh @@ -3,12 +3,15 @@ ########## ## Constants ########## +# paths gamePath="/home/pathoschild/Stardew Valley" bundleModNames=("ConsoleCommands" "ErrorHandler" "SaveBackup") + +# build configuration buildConfig="Release" -folders=("unix" "windows") -declare -A runtimes=(["unix"]="linux-x64" ["windows"]="win-x64") -declare -A msBuildPlatformNames=(["unix"]="Unix" ["windows"]="Windows_NT") +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") ########## @@ -44,7 +47,7 @@ for folder in ${folders[@]}; do echo "Compiling installer for $folder..." echo "----------------------" - dotnet publish src/SMAPI.Installer --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" + dotnet publish src/SMAPI.Installer --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true echo "" echo "" @@ -75,29 +78,32 @@ for folder in ${folders[@]}; do done # copy base installer files -cp "$installAssets/unix-install.sh" "$packagePath/install on Linux.sh" -cp "$installAssets/unix-install.sh" "$packagePath/install on macOS.command" -cp "$installAssets/windows-install.bat" "$packagePath/install on Windows.bat" -cp "$installAssets/README.txt" "$packagePath/README.txt" +for name in "install on Linux.sh" "install on macOS.command" "install on Windows.bat" "README.txt"; do + cp "$installAssets/$name" "$packagePath/$name" +done # copy per-platform files for folder in ${folders[@]}; do runtime=${runtimes[$folder]} # get paths - installBin="src/SMAPI.Installer/bin/$buildConfig/$runtime" - smapiBin="src/SMAPI/bin/$buildConfig/$runtime" + smapiBin="src/SMAPI/bin/$buildConfig/$runtime/publish" internalPath="$packagePath/internal/$folder" bundlePath="$internalPath/bundle" - # runtime config for installer - cp "$installBin/SMAPI.Installer.runtimeconfig.json" "$internalPath/SMAPI.Installer.runtimeconfig.json" + # installer files + cp -r "src/SMAPI.Installer/bin/$buildConfig/$runtime/publish"/* "$internalPath" + rm -rf "$internalPath/ref" + rm -rf "$internalPath/assets" # runtime config for SMAPI - cp "$installAssets/runtimeconfig.$folder.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json" + if [ $folder == "linux" ] || [ $folder == "macOS" ]; then + cp "$installAssets/runtimeconfig.unix.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json" + else + cp "$installAssets/runtimeconfig.$folder.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json" + fi - # installer DLL - cp "$installBin/SMAPI.Installer.dll" "$internalPath/SMAPI.Installer.dll" + # installer DLL config if [ $folder == "windows" ]; then cp "$installAssets/windows-exe-config.xml" "$packagePath/internal/windows/install.exe.config" fi @@ -121,7 +127,7 @@ for folder in ${folders[@]}; do cp "$smapiBin/SMAPI.config.json" "$bundlePath/smapi-internal/config.json" cp "$smapiBin/SMAPI.metadata.json" "$bundlePath/smapi-internal/metadata.json" - if [ $folder == "unix" ]; then + if [ $folder == "linux" ] || [ $folder == "macOS" ]; then cp "$installAssets/unix-launcher.sh" "$bundlePath/unix-launcher.sh" cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal/System.Runtime.Caching.dll" else @@ -138,7 +144,7 @@ for folder in ${folders[@]}; do # copy bundled mods for modName in ${bundleModNames[@]}; do - fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime" + fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime/publish" targetPath="$bundlePath/Mods/$modName" mkdir "$targetPath" --parents @@ -190,7 +196,6 @@ fi mv "$packagePath" "bin/SMAPI $version installer" mv "$packageDevPath" "bin/SMAPI $version installer for developers" - # package files pushd bin > /dev/null zip -9 "SMAPI $version installer.zip" "SMAPI $version installer" --recurse-paths --quiet diff --git a/docs/release-notes.md b/docs/release-notes.md index cb52f814..09bbf832 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,9 @@ # Release notes ## Upcoming version +* For players: + * You no longer need .NET 5 to run the SMAPI installer. + * For SMAPI maintainers: * Added a new [scripted release package process](technical/smapi.md), which removes the need to compile SMAPI on multiple platforms and manually combine them. diff --git a/src/SMAPI.Installer/assets/README.txt b/src/SMAPI.Installer/assets/README.txt index 5c20529a..08e99887 100644 --- a/src/SMAPI.Installer/assets/README.txt +++ b/src/SMAPI.Installer/assets/README.txt @@ -14,22 +14,27 @@ SMAPI lets you run Stardew Valley with mods. Don't forget to download mods separately. -Player's guide +Automated install -------------------------------- See https://stardewvalleywiki.com/Modding:Player_Guide for help installing SMAPI, adding mods, etc. Manual install -------------------------------- -THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See instructions above instead. +THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See the instructions above instead. If you really want to install SMAPI manually, here's how. -1. Unzip "internal/windows/install.dat" (on Windows) or "internal/unix/install.dat" (on - Linux/macOS). You can change '.dat' to '.zip', it's just a normal zip file renamed to prevent +1. Unzip "internal/windows/install.dat" (on Windows) or "internal/unix/install.dat" (on Linux or + macOS). You can change '.dat' to '.zip', it's just a normal zip file renamed to prevent confusion. + 2. Copy the files from the folder you just unzipped into your game folder. The `StardewModdingAPI.exe` file should be right next to the game's executable. -3. + +3. Copy `Stardew Valley.deps.json` in the game folder, and rename the copy to + `StardewModdingAPI.deps.json`. + +4. - Windows only: if you use Steam, see the install guide above to enable achievements and overlay. Otherwise, just run StardewModdingAPI.exe in your game folder to play with mods. @@ -38,8 +43,5 @@ If you really want to install SMAPI manually, here's how. play with mods. When installing on Linux or macOS: -- Make sure Mono is installed (normally the installer checks for you). While it's not required, - many mods won't work correctly without it. (Specifically, mods which load PNG images may crash or - freeze the game.) - To configure the color scheme, edit the `smapi-internal/config.json` file and see instructions there for the 'ColorScheme' setting. diff --git a/src/SMAPI.Installer/assets/install on Linux.sh b/src/SMAPI.Installer/assets/install on Linux.sh new file mode 100644 index 00000000..3b7eae9c --- /dev/null +++ b/src/SMAPI.Installer/assets/install on Linux.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd "`dirname "$0"`" +internal/linux/SMAPI.Installer diff --git a/src/SMAPI.Installer/assets/install on Windows.bat b/src/SMAPI.Installer/assets/install on Windows.bat new file mode 100644 index 00000000..b0d9ae81 --- /dev/null +++ b/src/SMAPI.Installer/assets/install on Windows.bat @@ -0,0 +1,41 @@ +@echo off +setlocal enabledelayedexpansion + +SET installerDir="%~dp0" + +REM make sure we're not running within a zip folder +echo %installerDir% | findstr /C:"%TEMP%" 1>nul +if %ERRORLEVEL% EQU 0 ( + echo Oops! It looks like you're running the installer from inside a zip file. Make sure you unzip the download first. + echo. + pause + exit +) + +REM make sure an antivirus hasn't deleted the installer DLL +if not exist %installerDir%"internal\windows\SMAPI.Installer.dll" ( + echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it. + echo Missing file: %installerDir%internal\windows\SMAPI.Installer.dll + echo. + pause + exit +) +if not exist %installerDir%"internal\windows\SMAPI.Installer.exe" ( + echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it. + echo Missing file: %installerDir%internal\windows\SMAPI.Installer.exe + echo. + pause + exit +) + +REM start installer +internal\windows\SMAPI.Installer.exe + +REM keep window open if it failed +if %ERRORLEVEL% NEQ 0 ( + echo. + echo Oops! The SMAPI installer seems to have failed. The error details may be shown above. + echo. + pause + exit +) diff --git a/src/SMAPI.Installer/assets/install on macOS.command b/src/SMAPI.Installer/assets/install on macOS.command new file mode 100644 index 00000000..abd21dc8 --- /dev/null +++ b/src/SMAPI.Installer/assets/install on macOS.command @@ -0,0 +1,6 @@ +#!/bin/bash + +cd "`dirname "$0"`" + +xattr -r -d com.apple.quarantine internal +internal/macOS/SMAPI.Installer diff --git a/src/SMAPI.Installer/assets/unix-install.sh b/src/SMAPI.Installer/assets/unix-install.sh deleted file mode 100644 index 07df4e6c..00000000 --- a/src/SMAPI.Installer/assets/unix-install.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Move to script's directory -cd "`dirname "$0"`" - -# make sure .NET 5 is installed -if ! command -v dotnet >/dev/null 2>&1; then - echo "Oops! You must have .NET 5 installed to use SMAPI: https://dotnet.microsoft.com/download"; - read - exit 1 -fi - -# run installer -dotnet internal/unix/SMAPI.Installer.dll diff --git a/src/SMAPI.Installer/assets/windows-install.bat b/src/SMAPI.Installer/assets/windows-install.bat deleted file mode 100644 index e34b9554..00000000 --- a/src/SMAPI.Installer/assets/windows-install.bat +++ /dev/null @@ -1,64 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -SET installerDir="%~dp0" - -REM make sure we're not running within a zip folder -echo %installerDir% | findstr /C:"%TEMP%" 1>nul -if %ERRORLEVEL% EQU 0 ( - echo Oops! It looks like you're running the installer from inside a zip file. Make sure you unzip the download first. - echo. - pause - exit -) - -REM make sure .NET 5 is installed -SET hasNet5=1 -WHERE dotnet /q -if !ERRORLEVEL! NEQ 0 ( - SET hasNet5=0 -) else ( - dotnet --info | findstr /C:"Microsoft.WindowsDesktop.App 5." 1>nul - if !ERRORLEVEL! NEQ 0 ( - SET hasNet5=0 - ) -) -if "%hasNet5%" == "0" ( - echo Oops! You don't have the required .NET version installed. - echo. - echo To install it: - echo 1. Go to https://dotnet.microsoft.com/download/dotnet/5.0/runtime - - if "%PROCESSOR_ARCHITECTURE%" == "ARM64" ( - echo 2. Under "Run desktop apps", click "Download Arm64". - ) else ( - echo 2. Under "Run desktop apps", click "Download x64". - ) - - echo 3. Run the downloaded installer. - echo 4. Restart your computer. - echo. - pause - exit -) - -REM make sure an antivirus hasn't deleted the installer DLL -if not exist %installerDir%"internal\windows\SMAPI.Installer.dll" ( - echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it. - echo Missing file: %installerDir%internal\windows\SMAPI.Installer.dll - echo. - pause - exit -) - -REM start installer -dotnet internal\windows\SMAPI.Installer.dll - -REM keep window open if it failed -if %ERRORLEVEL% NEQ 0 ( - echo. - echo Oops! The SMAPI installer seems to have failed. The error details may be shown above. - echo. - pause - exit -) -- cgit From e4416925f9b4d1deac521c62918d008076ac6b05 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 3 Dec 2021 02:16:27 -0500 Subject: add build script to set the release version --- build/set-smapi-version.sh | 18 ++++++++++++++++++ docs/technical/smapi.md | 13 ++++++------- src/SMAPI.sln | 1 + 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 build/set-smapi-version.sh diff --git a/build/set-smapi-version.sh b/build/set-smapi-version.sh new file mode 100755 index 00000000..42174cae --- /dev/null +++ b/build/set-smapi-version.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# get version number +version="$1" +if [ $# -eq 0 ]; then + echo "SMAPI release version (like '4.0.0'):" + read version +fi + +# move to SMAPI root +cd "`dirname "$0"`/.." + +# apply changes +sed "s/.+<\/Version>/$version<\/Version>/" "build/common.targets" --in-place --regexp-extended +sed "s/RawApiVersion = \".+?\";/RawApiVersion = \"$version\";/" "src/SMAPI/Constants.cs" --in-place --regexp-extended +for modName in "ConsoleCommands" "ErrorHandler" "SaveBackup"; do + sed "s/\"(Version|MinimumApiVersion)\": \".+?\"/\"\1\": \"$version\"/g" "src/SMAPI.Mods.$modName/manifest.json" --in-place --regexp-extended +done diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md index ce1220f1..f2e030d8 100644 --- a/docs/technical/smapi.md +++ b/docs/technical/smapi.md @@ -116,16 +116,15 @@ To launch the game: 2. Launch the game through the Steam UI. #### Prepare the release -1. Update the version numbers in `build/common.targets`, `Constants`, and the `manifest.json` for - bundled mods. Make sure you use a [semantic version](https://semver.org). Recommended format: +1. Run `build/set-smapi-version.sh` to set the SMAPI version. Make sure you use a [semantic + version](https://semver.org). Recommended format: build type | format | example :--------- | :----------------------- | :------ - dev build | `-alpha.` | `3.0.0-alpha.20171230` - prerelease | `-beta.` | `3.0.0-beta.20171230` - release | `` | `3.0.0` -2. Run the `build/prepare-install-package.sh` script. This will create the release package in the - root `bin` folder. + dev build | `-alpha.` | `4.0.0-alpha.20251230` + prerelease | `-beta.` | `4.0.0-beta.20251230` + release | `` | `4.0.0` +2. Run `build/prepare-install-package.sh` to create the release package in the root `bin` folder. ### Custom Harmony build SMAPI uses [a custom build of Harmony](https://github.com/Pathoschild/Harmony#readme), which is diff --git a/src/SMAPI.sln b/src/SMAPI.sln index 9a42b9ff..961a5ff7 100644 --- a/src/SMAPI.sln +++ b/src/SMAPI.sln @@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{09CF91E5 ..\build\common.targets = ..\build\common.targets ..\build\find-game-folder.targets = ..\build\find-game-folder.targets ..\build\prepare-install-package.sh = ..\build\prepare-install-package.sh + ..\build\set-smapi-version.sh = ..\build\set-smapi-version.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{EB35A917-67B9-4EFA-8DFC-4FB49B3949BB}" -- cgit From 6df3b0b8148377fc01a6000043deb2960adcaead Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 3 Dec 2021 19:53:22 -0500 Subject: update for Stardew Valley 1.5.5 hotfix --- docs/release-notes.md | 1 + src/SMAPI/Framework/SGame.cs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 09bbf832..3f13b4e2 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,7 @@ ## Upcoming version * For players: * You no longer need .NET 5 to run the SMAPI installer. + * Updated for the Stardew Valley 1.5.5 hotfix on 2021-12-03. * For SMAPI maintainers: * Added a new [scripted release package process](technical/smapi.md), which removes the need to compile SMAPI on multiple platforms and manually combine them. diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 898ed1f5..104cf330 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -776,10 +776,10 @@ namespace StardewModdingAPI.Framework } if (!Game1.eventUp && Game1.farmEvent == null && Game1.currentBillboard == 0 && Game1.gameMode == 3 && !this.takingMapScreenshot && Game1.isOutdoorMapSmallerThanViewport()) { - Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, -Math.Min(Game1.viewport.X, GameRunner.MaxTextureSize), Game1.graphics.GraphicsDevice.Viewport.Height), Color.Black); - Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64, 0, Math.Min(GameRunner.MaxTextureSize, Game1.graphics.GraphicsDevice.Viewport.Width - (-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64)), Game1.graphics.GraphicsDevice.Viewport.Height), Color.Black); - Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, Game1.graphics.GraphicsDevice.Viewport.Width, -Math.Min(Game1.viewport.Y, GameRunner.MaxTextureSize)), Color.Black); - Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, -Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64, Game1.graphics.GraphicsDevice.Viewport.Width, Math.Min(GameRunner.MaxTextureSize, Game1.graphics.GraphicsDevice.Viewport.Height - (-Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64))), Color.Black); + Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, -Game1.viewport.X, Game1.graphics.GraphicsDevice.Viewport.Height), Color.Black); + Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64, 0, Game1.graphics.GraphicsDevice.Viewport.Width - (-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64), Game1.graphics.GraphicsDevice.Viewport.Height), Color.Black); + Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, Game1.graphics.GraphicsDevice.Viewport.Width, -Game1.viewport.Y), Color.Black); + Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, -Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64, Game1.graphics.GraphicsDevice.Viewport.Width, Game1.graphics.GraphicsDevice.Viewport.Height - (-Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64)), Color.Black); } Game1.spriteBatch.End(); Game1.PushUIMode(); -- cgit From 1d7340f598436df705cf01c00ad1b33f70c60c72 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 4 Dec 2021 15:43:01 -0500 Subject: fix code warnings --- src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs | 2 +- src/SMAPI/SButton.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs index 1efc1616..e03c72de 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs @@ -315,7 +315,7 @@ namespace StardewModdingAPI.ModBuildConfig.Analyzer return false; // conversion to implemented interface is OK - if (fromType.AllInterfaces.Contains(toType)) + if (fromType.AllInterfaces.Contains(toType, SymbolEqualityComparer.Default)) return false; // avoid any other conversions diff --git a/src/SMAPI/SButton.cs b/src/SMAPI/SButton.cs index cc412946..ae825696 100644 --- a/src/SMAPI/SButton.cs +++ b/src/SMAPI/SButton.cs @@ -6,7 +6,7 @@ using StardewValley; namespace StardewModdingAPI { /// A unified button constant which includes all controller, keyboard, and mouse buttons. - /// Derived from , , and . + /// Derived from , , and System.Windows.Forms.MouseButtons. public enum SButton { /// No valid key. -- cgit From 711e17a4f99af29177fb250b24868b6e655dacb7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 4 Dec 2021 15:55:16 -0500 Subject: suppress non-applicable code warnings --- build/common.targets | 15 +++++++++++++++ .../ModLoading/RewriteFacades/AccessToolsFacade.cs | 2 ++ .../ModLoading/RewriteFacades/HarmonyInstanceFacade.cs | 2 ++ .../ModLoading/RewriteFacades/HarmonyMethodFacade.cs | 2 ++ .../ModLoading/RewriteFacades/SpriteBatchFacade.cs | 3 +++ src/SMAPI/Utilities/Keybind.cs | 2 ++ 6 files changed, 26 insertions(+) diff --git a/build/common.targets b/build/common.targets index c9a54763..ed860eee 100644 --- a/build/common.targets +++ b/build/common.targets @@ -9,6 +9,21 @@ $(DefineConstants);SMAPI_FOR_WINDOWS true + + + None + + + $(NoWarn);CS0436;CA1416;CS0809;NU1701 diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs index 8e4320b3..be2a1c58 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs @@ -4,6 +4,8 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using HarmonyLib; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly. + namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades { /// Maps Harmony 1.x methods to Harmony 2.x to avoid breaking older mods. diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs index 54b91679..135bd218 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs @@ -5,6 +5,8 @@ using System.Reflection; using System.Reflection.Emit; using HarmonyLib; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly. + namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades { /// Maps Harmony 1.x HarmonyInstance methods to Harmony 2.x's to avoid breaking older mods. diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs index 44c97401..5162dda4 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs @@ -3,6 +3,8 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using HarmonyLib; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly. + namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades { /// Maps Harmony 1.x methods to Harmony 2.x to avoid breaking older mods. diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs index a064f503..5f68f8d9 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs @@ -2,6 +2,9 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +#pragma warning disable CS0109 // Member does not hide an inherited member, new keyword is not required: This is deliberate to support legacy XNA Framework platforms. +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly. + namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades { /// Provides method signatures that can be injected into mod code for compatibility with mods written for XNA Framework before Stardew Valley 1.5.5. diff --git a/src/SMAPI/Utilities/Keybind.cs b/src/SMAPI/Utilities/Keybind.cs index dd8d2861..87b867a9 100644 --- a/src/SMAPI/Utilities/Keybind.cs +++ b/src/SMAPI/Utilities/Keybind.cs @@ -105,7 +105,9 @@ namespace StardewModdingAPI.Utilities /// Get the keybind state relative to the previous tick. public SButtonState GetState() { +#pragma warning disable CS0618 // Type or member is obsolete: deliberate call to GetButtonState() for unit tests SButtonState[] states = this.Buttons.Select(this.GetButtonState).Distinct().ToArray(); +#pragma warning restore CS0618 // single state if (states.Length == 1) -- cgit From c80d07fddfffe4fd3f8fa69bf6cab6374eec992d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 4 Dec 2021 15:55:29 -0500 Subject: migrate SMAPI to self-contained install This removes the need to have .NET 5 installed to run SMAPI. Note that there's no need to actually bundle the .NET files, since they're already bundled into the game folder. --- build/prepare-install-package.sh | 28 +++++++++++----------- docs/release-notes.md | 2 +- src/SMAPI.Installer/assets/runtimeconfig.unix.json | 3 ++- .../assets/runtimeconfig.windows.json | 3 ++- src/SMAPI.Installer/assets/unix-launcher.sh | 9 +------ 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/build/prepare-install-package.sh b/build/prepare-install-package.sh index 2d03ba82..07dae217 100755 --- a/build/prepare-install-package.sh +++ b/build/prepare-install-package.sh @@ -26,6 +26,7 @@ cd "`dirname "$0"`/.." echo "Clearing old builds..." echo "-----------------------" for path in */**/bin */**/obj; do + echo "$path" rm -rf $path done rm -rf "bin" @@ -38,10 +39,9 @@ for folder in ${folders[@]}; do runtime=${runtimes[$folder]} msbuildPlatformName=${msBuildPlatformNames[$folder]} - # SMAPI echo "Compiling SMAPI for $folder..." echo "------------------" - dotnet publish src/SMAPI --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" + dotnet publish src/SMAPI --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" --self-contained true echo "" echo "" @@ -79,7 +79,7 @@ done # copy base installer files for name in "install on Linux.sh" "install on macOS.command" "install on Windows.bat" "README.txt"; do - cp "$installAssets/$name" "$packagePath/$name" + cp "$installAssets/$name" "$packagePath" done # copy per-platform files @@ -114,7 +114,7 @@ for folder in ${folders[@]}; do name="$name.exe" fi - cp "$smapiBin/$name" "$bundlePath/$name" + cp "$smapiBin/$name" "$bundlePath" done # bundle i18n @@ -122,24 +122,24 @@ for folder in ${folders[@]}; do # bundle smapi-internal for name in "0Harmony.dll" "0Harmony.xml" "Mono.Cecil.dll" "Mono.Cecil.Mdb.dll" "Mono.Cecil.Pdb.dll" "MonoMod.Common.dll" "Newtonsoft.Json.dll" "TMXTile.dll" "SMAPI.Toolkit.dll" "SMAPI.Toolkit.pdb" "SMAPI.Toolkit.xml" "SMAPI.Toolkit.CoreInterfaces.dll" "SMAPI.Toolkit.CoreInterfaces.pdb" "SMAPI.Toolkit.CoreInterfaces.xml"; do - cp "$smapiBin/$name" "$bundlePath/smapi-internal/$name" + cp "$smapiBin/$name" "$bundlePath/smapi-internal" done cp "$smapiBin/SMAPI.config.json" "$bundlePath/smapi-internal/config.json" cp "$smapiBin/SMAPI.metadata.json" "$bundlePath/smapi-internal/metadata.json" if [ $folder == "linux" ] || [ $folder == "macOS" ]; then - cp "$installAssets/unix-launcher.sh" "$bundlePath/unix-launcher.sh" - cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal/System.Runtime.Caching.dll" + cp "$installAssets/unix-launcher.sh" "$bundlePath" + cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal" else cp "$installAssets/windows-exe-config.xml" "$bundlePath/StardewModdingAPI.exe.config" fi # copy .NET dependencies - cp "$smapiBin/System.Configuration.ConfigurationManager.dll" "$bundlePath/smapi-internal/System.Configuration.ConfigurationManager.dll" - cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal/System.Runtime.Caching.dll" - cp "$smapiBin/System.Security.Permissions.dll" "$bundlePath/smapi-internal/System.Security.Permissions.dll" + cp "$smapiBin/System.Configuration.ConfigurationManager.dll" "$bundlePath/smapi-internal" + cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal" + cp "$smapiBin/System.Security.Permissions.dll" "$bundlePath/smapi-internal" if [ $folder == "windows" ]; then - cp "$smapiBin/System.Management.dll" "$bundlePath/smapi-internal/System.Management.dll" + cp "$smapiBin/System.Management.dll" "$bundlePath/smapi-internal" fi # copy bundled mods @@ -149,9 +149,9 @@ for folder in ${folders[@]}; do mkdir "$targetPath" --parents - cp "$fromPath/$modName.dll" "$targetPath/$modName.dll" - cp "$fromPath/$modName.pdb" "$targetPath/$modName.pdb" - cp "$fromPath/manifest.json" "$targetPath/manifest.json" + cp "$fromPath/$modName.dll" "$targetPath" + cp "$fromPath/$modName.pdb" "$targetPath" + cp "$fromPath/manifest.json" "$targetPath" if [ -d "$fromPath/i18n" ]; then cp -r "$fromPath/i18n" "$targetPath" fi diff --git a/docs/release-notes.md b/docs/release-notes.md index 3f13b4e2..4fc6a524 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -3,7 +3,7 @@ # Release notes ## Upcoming version * For players: - * You no longer need .NET 5 to run the SMAPI installer. + * You no longer need .NET 5 installed to run SMAPI or the installer. * Updated for the Stardew Valley 1.5.5 hotfix on 2021-12-03. * For SMAPI maintainers: diff --git a/src/SMAPI.Installer/assets/runtimeconfig.unix.json b/src/SMAPI.Installer/assets/runtimeconfig.unix.json index 8a01ceb1..a1d060b5 100644 --- a/src/SMAPI.Installer/assets/runtimeconfig.unix.json +++ b/src/SMAPI.Installer/assets/runtimeconfig.unix.json @@ -4,7 +4,8 @@ "includedFrameworks": [ { "name": "Microsoft.NETCore.App", - "version": "5.0.7" + "version": "5.0.0", + "rollForward": "major" } ], "configProperties": { diff --git a/src/SMAPI.Installer/assets/runtimeconfig.windows.json b/src/SMAPI.Installer/assets/runtimeconfig.windows.json index b693d809..d5f24bdb 100644 --- a/src/SMAPI.Installer/assets/runtimeconfig.windows.json +++ b/src/SMAPI.Installer/assets/runtimeconfig.windows.json @@ -3,7 +3,8 @@ "tfm": "net5.0", "framework": { "name": "Microsoft.NETCore.App", - "version": "5.0.0" + "version": "5.0.0", + "rollForward": "major" }, "configProperties": { "System.Runtime.TieredCompilation": false diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index 58f7a5ae..e8b9ae62 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -49,20 +49,13 @@ if [ ! -f "Stardew Valley.dll" ]; then exit 1 fi -# .NET 5 must be installed -if ! command -v dotnet >/dev/null 2>&1; then - echo "Oops! You must have .NET 5 installed to use SMAPI: https://dotnet.microsoft.com/download"; - read - exit 1 -fi - ########## ## Launch SMAPI ########## # macOS if [ "$(uname)" == "Darwin" ]; then - dotnet StardewModdingAPI.dll "$@" + ./StardewModdingAPI "$@" # Linux else -- cgit From cc35dbdb3d1fe0a82557857a72d842f1217812c2 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 4 Dec 2021 20:25:53 -0500 Subject: fix self-contained install on Windows --- build/prepare-install-package.sh | 9 ++++----- src/SMAPI.Installer/assets/runtimeconfig.json | 16 ++++++++++++++++ src/SMAPI.Installer/assets/runtimeconfig.unix.json | 15 --------------- src/SMAPI.Installer/assets/runtimeconfig.windows.json | 13 ------------- src/SMAPI/SMAPI.csproj | 3 +++ 5 files changed, 23 insertions(+), 33 deletions(-) create mode 100644 src/SMAPI.Installer/assets/runtimeconfig.json delete mode 100644 src/SMAPI.Installer/assets/runtimeconfig.unix.json delete mode 100644 src/SMAPI.Installer/assets/runtimeconfig.windows.json diff --git a/build/prepare-install-package.sh b/build/prepare-install-package.sh index 07dae217..39575c4c 100755 --- a/build/prepare-install-package.sh +++ b/build/prepare-install-package.sh @@ -97,11 +97,10 @@ for folder in ${folders[@]}; do rm -rf "$internalPath/assets" # runtime config for SMAPI - if [ $folder == "linux" ] || [ $folder == "macOS" ]; then - cp "$installAssets/runtimeconfig.unix.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json" - else - cp "$installAssets/runtimeconfig.$folder.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json" - fi + # This is identical to the one generated by the build, except that the min runtime version is + # set to 5.0.0 (instead of whatever version it was built with) and rollForward is set to latestMinor instead of + # minor. + cp "$installAssets/runtimeconfig.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json" # installer DLL config if [ $folder == "windows" ]; then diff --git a/src/SMAPI.Installer/assets/runtimeconfig.json b/src/SMAPI.Installer/assets/runtimeconfig.json new file mode 100644 index 00000000..34018b8a --- /dev/null +++ b/src/SMAPI.Installer/assets/runtimeconfig.json @@ -0,0 +1,16 @@ +{ + "runtimeOptions": { + "tfm": "net5.0", +