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 --- src/SMAPI/Framework/SGame.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/SMAPI') 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(-) (limited to 'src/SMAPI') 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(+) (limited to 'src/SMAPI') 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 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 (limited to 'src/SMAPI') 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", + "includedFrameworks": [ + { + "name": "Microsoft.NETCore.App", + "version": "5.0.0", + "rollForward": "latestMinor" + } + ], + "configProperties": { + "System.Runtime.TieredCompilation": false, + "System.Reflection.Metadata.MetadataUpdater.IsSupported": false + } + } +} diff --git a/src/SMAPI.Installer/assets/runtimeconfig.unix.json b/src/SMAPI.Installer/assets/runtimeconfig.unix.json deleted file mode 100644 index a1d060b5..00000000 --- a/src/SMAPI.Installer/assets/runtimeconfig.unix.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net5.0", - "includedFrameworks": [ - { - "name": "Microsoft.NETCore.App", - "version": "5.0.0", - "rollForward": "major" - } - ], - "configProperties": { - "System.Runtime.TieredCompilation": false - } - } -} diff --git a/src/SMAPI.Installer/assets/runtimeconfig.windows.json b/src/SMAPI.Installer/assets/runtimeconfig.windows.json deleted file mode 100644 index d5f24bdb..00000000 --- a/src/SMAPI.Installer/assets/runtimeconfig.windows.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net5.0", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "5.0.0", - "rollForward": "major" - }, - "configProperties": { - "System.Runtime.TieredCompilation": false - } - } -} diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index b99028da..f07ede87 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -13,6 +13,9 @@ true + + + false -- cgit From f4ca7dd228390f030735195357e81e5170bcd474 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 5 Dec 2021 18:55:10 -0500 Subject: add Windows build process to fix application icon until .NET bug is fixed --- .editorconfig | 3 + .gitattributes | 5 +- build/prepare-install-package.sh | 205 ---------------------------- build/set-smapi-version.sh | 18 --- build/unix/prepare-install-package.sh | 211 +++++++++++++++++++++++++++++ build/unix/set-smapi-version.sh | 26 ++++ build/windows/finalize-install-package.sh | 67 +++++++++ build/windows/lib/in-place-regex.ps1 | 11 ++ build/windows/prepare-install-package.ps1 | 217 ++++++++++++++++++++++++++++++ build/windows/set-smapi-version.ps1 | 25 ++++ docs/release-notes.md | 1 - docs/technical/smapi.md | 101 +++++++++----- src/SMAPI.Mods.ErrorHandler/i18n/pl.json | 8 +- src/SMAPI.sln | 23 +++- src/SMAPI/i18n/pl.json | 12 +- 15 files changed, 662 insertions(+), 271 deletions(-) delete mode 100755 build/prepare-install-package.sh delete mode 100755 build/set-smapi-version.sh create mode 100644 build/unix/prepare-install-package.sh create mode 100644 build/unix/set-smapi-version.sh create mode 100755 build/windows/finalize-install-package.sh create mode 100644 build/windows/lib/in-place-regex.ps1 create mode 100644 build/windows/prepare-install-package.ps1 create mode 100644 build/windows/set-smapi-version.ps1 (limited to 'src/SMAPI') diff --git a/.editorconfig b/.editorconfig index d600d602..2aeaeadd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -22,6 +22,9 @@ insert_final_newline = false [README.txt] end_of_line=crlf +[*.{command,sh}] +end_of_line=lf + ########## ## C# formatting ## documentation: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference diff --git a/.gitattributes b/.gitattributes index 1161a204..00ae145b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,6 @@ # normalize line endings * text=auto -README.txt text=crlf +README.txt text eol=crlf + +*.command text eol=lf +*.sh text eol=lf diff --git a/build/prepare-install-package.sh b/build/prepare-install-package.sh deleted file mode 100755 index 39575c4c..00000000 --- a/build/prepare-install-package.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/bash - -########## -## Constants -########## -# paths -gamePath="/home/pathoschild/Stardew Valley" -bundleModNames=("ConsoleCommands" "ErrorHandler" "SaveBackup") - -# build configuration -buildConfig="Release" -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"`/.." - - -########## -## Clear old build files -########## -echo "Clearing old builds..." -echo "-----------------------" -for path in */**/bin */**/obj; do - echo "$path" - rm -rf $path -done -rm -rf "bin" -echo "" - -########## -## Compile files -########## -for folder in ${folders[@]}; do - runtime=${runtimes[$folder]} - msbuildPlatformName=${msBuildPlatformNames[$folder]} - - 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" --self-contained true - 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" -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true - 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 -for name in "install on Linux.sh" "install on macOS.command" "install on Windows.bat" "README.txt"; do - cp "$installAssets/$name" "$packagePath" -done - -# copy per-platform files -for folder in ${folders[@]}; do - runtime=${runtimes[$folder]} - - # get paths - smapiBin="src/SMAPI/bin/$buildConfig/$runtime/publish" - internalPath="$packagePath/internal/$folder" - bundlePath="$internalPath/bundle" - - # installer files - cp -r "src/SMAPI.Installer/bin/$buildConfig/$runtime/publish"/* "$internalPath" - rm -rf "$internalPath/ref" - rm -rf "$internalPath/assets" - - # runtime config for SMAPI - # 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 - 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" - 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" - 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" - 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" - 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" - fi - - # copy bundled mods - for modName in ${bundleModNames[@]}; do - fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime/publish" - targetPath="$bundlePath/Mods/$modName" - - mkdir "$targetPath" --parents - - 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 - 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/set-smapi-version.sh b/build/set-smapi-version.sh deleted file mode 100755 index 42174cae..00000000 --- a/build/set-smapi-version.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/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/build/unix/prepare-install-package.sh b/build/unix/prepare-install-package.sh new file mode 100644 index 00000000..9a89f8d4 --- /dev/null +++ b/build/unix/prepare-install-package.sh @@ -0,0 +1,211 @@ +#!/bin/bash + +# +# +# This is the Bash equivalent of ../windows/prepare-install-package.ps1. +# When making changes, both scripts should be updated. +# +# + + +########## +## Constants +########## +# paths +gamePath="/home/pathoschild/Stardew Valley" +bundleModNames=("ConsoleCommands" "ErrorHandler" "SaveBackup") + +# build configuration +buildConfig="Release" +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"`/../.." + + +########## +## Clear old build files +########## +echo "Clearing old builds..." +echo "-------------------------------------------------" +for path in bin */**/bin */**/obj; do + echo "$path" + rm -rf $path +done +echo "" + +########## +## Compile files +########## +for folder in ${folders[@]}; do + runtime=${runtimes[$folder]} + msbuildPlatformName=${msBuildPlatformNames[$folder]} + + 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" --self-contained true + 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" -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true + 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 +for name in "install on Linux.sh" "install on macOS.command" "install on Windows.bat" "README.txt"; do + cp "$installAssets/$name" "$packagePath" +done + +# copy per-platform files +for folder in ${folders[@]}; do + runtime=${runtimes[$folder]} + + # get paths + smapiBin="src/SMAPI/bin/$buildConfig/$runtime/publish" + internalPath="$packagePath/internal/$folder" + bundlePath="$internalPath/bundle" + + # installer files + cp -r "src/SMAPI.Installer/bin/$buildConfig/$runtime/publish"/* "$internalPath" + rm -rf "$internalPath/assets" + + # runtime config for SMAPI + # 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 + 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" + 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" + 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" + 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" + 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" + fi + + # copy bundled mods + for modName in ${bundleModNames[@]}; do + fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime/publish" + targetPath="$bundlePath/Mods/$modName" + + mkdir "$targetPath" --parents + + 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 + 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/unix/set-smapi-version.sh b/build/unix/set-smapi-version.sh new file mode 100644 index 00000000..0c0cbeb0 --- /dev/null +++ b/build/unix/set-smapi-version.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# +# +# This is the Bash equivalent of ../windows/set-smapi-version.ps1. +# When making changes, both scripts should be updated. +# +# + + +# 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/build/windows/finalize-install-package.sh b/build/windows/finalize-install-package.sh new file mode 100755 index 00000000..0996e3ed --- /dev/null +++ b/build/windows/finalize-install-package.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +########## +## Read config +########## +# get SMAPI version +version="$1" +if [ $# -eq 0 ]; then + echo "SMAPI release version (like '4.0.0'):" + read version +fi + +# get Windows bin path +windowsBinPath="$2" +if [ $# -le 1 ]; then + echo "Windows compiled bin path:" + read windowsBinPath +fi + +# installer internal folders +buildFolders=("linux" "macOS" "windows") + + +########## +## Finalize release package +########## +for folderName in "SMAPI $version installer" "SMAPI $version installer for developers"; do + # move files to Linux filesystem + echo "Preparing $folderName.zip..." + echo "-------------------------------------------------" + echo "copying '$windowsBinPath/$folderName' to Linux filesystem..." + cp -r "$windowsBinPath/$folderName" . + + # fix permissions + echo "fixing permissions..." + find "$folderName" -type d -exec chmod 755 {} \; + find "$folderName" -type f -exec chmod 644 {} \; + find "$folderName" -name "*.sh" -exec chmod 755 {} \; + find "$folderName" -name "*.command" -exec chmod 755 {} \; + find "$folderName" -name "SMAPI.Installer" -exec chmod 755 {} \; + find "$folderName" -name "StardewModdingAPI" -exec chmod 755 {} \; + + # convert bundle folder into final 'install.dat' files + for build in ${buildFolders[@]}; do + echo "packaging $folderName/internal/$build/install.dat..." + pushd "$folderName/internal/$build/bundle" > /dev/null + zip "install.dat" * --recurse-paths --quiet + mv install.dat ../ + popd > /dev/null + + rm -rf "$folderName/internal/$build/bundle" + done + + # zip installer + echo "packaging installer..." + zip -9 "$folderName.zip" "$folderName" --recurse-paths --quiet + + # move zip back to Windows bin path + echo "moving release zip to $windowsBinPath/$folderName.zip..." + mv "$folderName.zip" "$windowsBinPath" + rm -rf "$folderName" + + echo "" + echo "" +done + +echo "Done!" diff --git a/build/windows/lib/in-place-regex.ps1 b/build/windows/lib/in-place-regex.ps1 new file mode 100644 index 00000000..7b309342 --- /dev/null +++ b/build/windows/lib/in-place-regex.ps1 @@ -0,0 +1,11 @@ +function In-Place-Regex { + param ( + [Parameter(Mandatory)][string]$Path, + [Parameter(Mandatory)][string]$Search, + [Parameter(Mandatory)][string]$Replace + ) + + $content = (Get-Content "$Path" -Encoding UTF8) + $content = ($content -replace "$Search", "$Replace") + [System.IO.File]::WriteAllLines((Get-Item "$Path").FullName, $content) +} diff --git a/build/windows/prepare-install-package.ps1 b/build/windows/prepare-install-package.ps1 new file mode 100644 index 00000000..db7fadcb --- /dev/null +++ b/build/windows/prepare-install-package.ps1 @@ -0,0 +1,217 @@ +# +# +# 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. +# +# When making changes, make sure to update ../unix/prepare-install-package.ps1 too. +# +# + + +. "$PSScriptRoot\lib\in-place-regex.ps1" + +########## +## Constants +########## +# paths +$gamePath = "C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley" +$bundleModNames = "ConsoleCommands", "ErrorHandler", "SaveBackup" + +# build configuration +$buildConfig = "Release" +$folders = "linux", "macOS", "windows" +$runtimes = @{ linux = "linux-x64"; macOS = "osx-x64"; windows = "win-x64" } +$msBuildPlatformNames = @{ linux = "Unix"; macOS = "OSX"; windows = "Windows_NT" } + + +########## +## Move to SMAPI root +########## +cd "$PSScriptRoot/../.." + + +########## +## Clear old build files +########## +echo "Clearing old builds..." +echo "-------------------------------------------------" + +foreach ($path in (dir -Recurse -Include ('bin', 'obj'))) { + echo "$path" + rm -Recurse -Force "$path" +} +echo "" + + +########## +## Compile files +########## +ForEach ($folder in $folders) { + $runtime = $runtimes[$folder] + $msbuildPlatformName = $msBuildPlatformNames[$folder] + + 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" --self-contained true + 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" -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true + echo "" + echo "" + + foreach ($modName in $bundleModNames) { + 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 "" + } +} + + +########## +## 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 +foreach ($folder in $folders) { + mkdir "$packagePath/internal/$folder/bundle/smapi-internal" > $null +} + +# copy base installer files +foreach ($name in @("install on Linux.sh", "install on macOS.command", "install on Windows.bat", "README.txt")) { + cp "$installAssets/$name" "$packagePath" +} + +# copy per-platform files +foreach ($folder in $folders) { + $runtime = $runtimes[$folder] + + # get paths + $smapiBin = "src/SMAPI/bin/$buildConfig/$runtime/publish" + $internalPath = "$packagePath/internal/$folder" + $bundlePath = "$internalPath/bundle" + + # installer files + cp "src/SMAPI.Installer/bin/$buildConfig/$runtime/publish/*" "$internalPath" -Recurse + rm -Recurse -Force "$internalPath/assets" + + # runtime config for SMAPI + # 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 -eq "windows") { + cp "$installAssets/windows-exe-config.xml" "$packagePath/internal/windows/install.exe.config" + } + + # bundle root files + foreach ($name in @("StardewModdingAPI", "StardewModdingAPI.dll", "StardewModdingAPI.pdb", "StardewModdingAPI.xml", "steam_appid.txt")) { + if ($name -eq "StardewModdingAPI" -and $folder -eq "windows") { + $name = "$name.exe" + } + + cp "$smapiBin/$name" "$bundlePath" + } + + # bundle i18n + cp -Recurse "$smapiBin/i18n" "$bundlePath/smapi-internal" + + # bundle smapi-internal + foreach ($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")) { + cp "$smapiBin/$name" "$bundlePath/smapi-internal" + } + + cp "$smapiBin/SMAPI.config.json" "$bundlePath/smapi-internal/config.json" + cp "$smapiBin/SMAPI.metadata.json" "$bundlePath/smapi-internal/metadata.json" + if ($folder -eq "linux" -or $folder -eq "macOS") { + 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" + } + + # copy .NET dependencies + 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 -eq "windows") { + cp "$smapiBin/System.Management.dll" "$bundlePath/smapi-internal" + } + + # copy bundled mods + foreach ($modName in $bundleModNames) { + $fromPath = "src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime/publish" + $targetPath = "$bundlePath/Mods/$modName" + + mkdir "$targetPath" > $null + + cp "$fromPath/$modName.dll" "$targetPath" + cp "$fromPath/$modName.pdb" "$targetPath" + cp "$fromPath/manifest.json" "$targetPath" + if (Test-Path "$fromPath/i18n" -PathType Container) { + cp -Recurse "$fromPath/i18n" "$targetPath" + } + } +} + +# DISABLED: will be handled by Linux script +# mark scripts executable +#ForEach ($path in @("install on Linux.sh", "install on macOS.command", "bundle/unix-launcher.sh")) { +# if (Test-Path "$packagePath/$path" -PathType Leaf) { +# chmod 755 "$packagePath/$path" +# } +#} + +# split into main + for-dev folders +cp -Recurse "$packagePath" "$packageDevPath" +foreach ($folder in $folders) { + # disable developer mode in main package + In-Place-Regex -Path "$packagePath/internal/$folder/bundle/smapi-internal/config.json" -Search "`"DeveloperMode`": true" -Replace "`"DeveloperMode`": false" + + # DISABLED: will be handled by Linux script + # convert bundle folder into final 'install.dat' files + #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" + #} +} + + +########### +### Create release zips +########### +# get version number +$version = $args[0] +if (!$version) { + $version = Read-Host "SMAPI release version (like '4.0.0')" +} + +# rename folders +mv "$packagePath" "bin/SMAPI $version installer" +mv "$packageDevPath" "bin/SMAPI $version installer for developers" + +# DISABLED: will be handled by Linux script +## 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 + +echo "" +echo "Done! See docs/technical/smapi.md to create the release zips." diff --git a/build/windows/set-smapi-version.ps1 b/build/windows/set-smapi-version.ps1 new file mode 100644 index 00000000..ff6b2096 --- /dev/null +++ b/build/windows/set-smapi-version.ps1 @@ -0,0 +1,25 @@ +# +# +# This is the PowerShell equivalent of ../unix/set-smapi-version.sh. +# When making changes, both scripts should be updated. +# +# + + +. "$PSScriptRoot\lib\in-place-regex.ps1" + +# get version number +$version=$args[0] +if (!$version) { + $version = Read-Host "SMAPI release version (like '4.0.0')" +} + +# move to SMAPI root +cd "$PSScriptRoot/../.." + +# apply changes +In-Place-Regex -Path "build/common.targets" -Search ".+" -Replace "$version" +In-Place-Regex -Path "src/SMAPI/Constants.cs" -Search "RawApiVersion = `".+?`";" -Replace "RawApiVersion = `"$version`";" +ForEach ($modName in "ConsoleCommands","ErrorHandler","SaveBackup") { + In-Place-Regex -Path "src/SMAPI.Mods.$modName/manifest.json" -Search "`"(Version|MinimumApiVersion)`": `".+?`"" -Replace "`"`$1`": `"$version`"" +} diff --git a/docs/release-notes.md b/docs/release-notes.md index 4c734cb3..8a26514d 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,7 +7,6 @@ * The installer now detects when the game folder contains an incompatible legacy game version. * Updated for the latest Stardew Valley 1.5.5 hotfix. * Updated compatibility list. - * **Known issue:** SMAPI no longer has a pufferchick icon on Windows. That's [a known bug in .NET](https://github.com/dotnet/runtime/issues/3828) which affects the changes needed to run SMAPI without installing .NET manually. * For the web UI: * Fixed the JSON validator marking `.fnt` files invalid in Content Patcher files. diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md index f2e030d8..d9aad875 100644 --- a/docs/technical/smapi.md +++ b/docs/technical/smapi.md @@ -11,11 +11,12 @@ This document is about SMAPI itself; see also [mod build package](mod-package.md * [Configuration file](#configuration-file) * [Command-line arguments](#command-line-arguments) * [Compile flags](#compile-flags) -* [For SMAPI developers](#for-smapi-developers) - * [Compiling from source](#compiling-from-source) - * [Debugging a local build](#debugging-a-local-build) - * [Preparing a release](#preparing-a-release) - * [Using a custom Harmony build](#using-a-custom-harmony-build) +* [Compile from source code](#compile-from-source-code) + * [Main project](#main-project) + * [Custom Harmony build](#custom-harmony-build) +* [Prepare a release](#prepare-a-release) + * [On any platform](#on-any-platform) + * [On Windows](#on-windows) * [Release notes](#release-notes) ## Customisation @@ -58,36 +59,37 @@ flag | purpose ---- | ------- `SMAPI_FOR_WINDOWS` | Whether SMAPI is being compiled for Windows; if not set, the code assumes Linux/macOS. Set automatically in `common.targets`. -## For SMAPI developers -### Compiling from source +## Compile from source code +### Main project Using an official SMAPI release is recommended for most users, but you can compile from source -directly if needed. There are no special steps (just open the project and compile), but SMAPI often -uses the latest C# syntax. You may need the latest version of your IDE to compile it. +directly if needed. Just open the project in an IDE like [Visual +Studio](https://visualstudio.microsoft.com/vs/community/) or [Rider](https://www.jetbrains.com/rider/), +and build the `SMAPI` project. The project will automatically adjust the build settings for your +current OS and Stardew Valley install path. -SMAPI uses build configuration derived from the [crossplatform mod config](https://smapi.io/package/readme) -to detect your current OS automatically and load the correct references. Compile output will be -placed in a `bin` folder at the root of the Git repository. - -### Debugging a local build Rebuilding the solution in debug mode will copy the SMAPI files into your game folder. Starting -the `SMAPI` project with debugging from Visual Studio (on macOS or Windows) will launch SMAPI with -the debugger attached, so you can intercept errors and step through the code being executed. That -doesn't work in MonoDevelop on Linux, unfortunately. +the `SMAPI` project with debugging from Visual Studio or Rider should launch SMAPI with the +debugger attached, so you can intercept errors and step through the code being executed. -### Preparing a release -To prepare a crossplatform SMAPI release, you'll need to run the build script on Linux or macOS. +### Custom Harmony build +SMAPI uses [a custom build of Harmony](https://github.com/Pathoschild/Harmony#readme), which is +included in the `build` folder. To use a different build, just replace `0Harmony.dll` in that +folder before compiling. -#### Initial setup -First-time setup: +## Prepare a release +### On any platform +**⚠ Ideally we'd have one set of instructions for all platforms. The instructions in this section +will produce a fully functional release for all supported platfrms, _except_ that the application +icon for SMAPI on Windows will disappear due to [.NET runtime bug +3828](https://github.com/dotnet/runtime/issues/3828). Until that's fixed, see the _[on +Windows](#on-windows)_ section below to create a build that retains the icon.** +#### 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). @@ -100,14 +102,12 @@ First-time setup: ln -s "/opt/JetBrains Rider-/bin/rider.sh" ./rider.sh ``` - 3. Clone the SMAPI repo: ```sh git clone https://github.com/Pathoschild/SMAPI.git ``` -To launch the game: - +### Launch the game 1. Run these commands to start Steam: ```sh export TERM=xterm @@ -115,8 +115,8 @@ To launch the game: ``` 2. Launch the game through the Steam UI. -#### Prepare the release -1. Run `build/set-smapi-version.sh` to set the SMAPI version. Make sure you use a [semantic +### Prepare the release +1. Run `build/unix/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 @@ -124,12 +124,45 @@ To launch the game: 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 -included in the `build` folder. To use a different build, just replace `0Harmony.dll` in that -folder before compiling. +2. Run `build/unix/prepare-install-package.sh` to create the release package in the root `bin` + folder. + +### On Windows +#### First-time setup +1. Set up Windows Subsystem for Linux (WSL): + 1. [Install 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://dotnet.microsoft.com/download/dotnet/5.0). + 2. Install [Stardew Valley](https://www.stardewvalley.net/). +3. Clone the SMAPI repo: + ```sh + git clone https://github.com/Pathoschild/SMAPI.git + ``` + +### Prepare the release +1. Run `build/windows/set-smapi-version.ps1` in PowerShell to set the SMAPI version. Make sure you + use a [semantic version](https://semver.org). Recommended format: + + build type | format | example + :--------- | :----------------------- | :------ + dev build | `-alpha.` | `4.0.0-alpha.20251230` + prerelease | `-beta.` | `4.0.0-beta.20251230` + release | `` | `4.0.0` + +2. Run `build/windows/prepare-install-package.ps1` in PowerShell to create the release package + folders in the root `bin` folder. + +3. Launch WSL and run this script: + ```bash + # edit to match the build created in steps 1-2 + # In WSL, `/mnt/c/example` accesses `C:\example` on the Windows filesystem. + version="4.0.0" + binFolder="/mnt/e/source/_Stardew/SMAPI/bin" + build/windows/finalize-install-package.sh "$version" "$binFolder" + ``` ## Release notes See [release notes](../release-notes.md). diff --git a/src/SMAPI.Mods.ErrorHandler/i18n/pl.json b/src/SMAPI.Mods.ErrorHandler/i18n/pl.json index 05a9d411..f080bcd4 100644 --- a/src/SMAPI.Mods.ErrorHandler/i18n/pl.json +++ b/src/SMAPI.Mods.ErrorHandler/i18n/pl.json @@ -1,4 +1,4 @@ -{ - // warning messages - "warn.invalid-content-removed": "Nieprawidłowa zawartość została usunięta, aby zapobiec awarii (zobacz konsolę SMAPI po więcej informacji)." -} +{ + // warning messages + "warn.invalid-content-removed": "Nieprawidłowa zawartość została usunięta, aby zapobiec awarii (zobacz konsolę SMAPI po więcej informacji)." +} diff --git a/src/SMAPI.sln b/src/SMAPI.sln index 961a5ff7..be5326f7 100644 --- a/src/SMAPI.sln +++ b/src/SMAPI.sln @@ -28,8 +28,6 @@ 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.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}" @@ -85,6 +83,24 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.Toolkit.CoreInterface EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.Web", "SMAPI.Web\SMAPI.Web.csproj", "{80EFD92F-728F-41E0-8A5B-9F6F49A91899}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windows", "windows", "{4D661178-38FB-43E4-AA5F-9B0406919344}" + ProjectSection(SolutionItems) = preProject + ..\build\windows\finalize-install-package.sh = ..\build\windows\finalize-install-package.sh + ..\build\windows\prepare-install-package.ps1 = ..\build\windows\prepare-install-package.ps1 + ..\build\windows\set-smapi-version.ps1 = ..\build\windows\set-smapi-version.ps1 + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unix", "unix", "{CAA1488E-842B-433D-994D-1D3D0B5DD125}" + ProjectSection(SolutionItems) = preProject + ..\build\unix\prepare-install-package.sh = ..\build\unix\prepare-install-package.sh + ..\build\unix\set-smapi-version.sh = ..\build\unix\set-smapi-version.sh + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{3B5BF14D-F612-4C83-9EF6-E3EBFCD08766}" + ProjectSection(SolutionItems) = preProject + ..\build\windows\lib\in-place-regex.ps1 = ..\build\windows\lib\in-place-regex.ps1 + EndProjectSection +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution SMAPI.Internal\SMAPI.Internal.projitems*{0634ea4c-3b8f-42db-aea6-ca9e4ef6e92f}*SharedItemsImports = 5 @@ -168,6 +184,9 @@ Global {0634EA4C-3B8F-42DB-AEA6-CA9E4EF6E92F} = {AE9A4D46-E910-4293-8BC4-673F85FFF6A5} {491E775B-EAD0-44D4-B6CA-F1FC3E316D33} = {AE9A4D46-E910-4293-8BC4-673F85FFF6A5} {CD53AD6F-97F4-4872-A212-50C2A0FD3601} = {AE9A4D46-E910-4293-8BC4-673F85FFF6A5} + {4D661178-38FB-43E4-AA5F-9B0406919344} = {09CF91E5-5BAB-4650-A200-E5EA9A633046} + {CAA1488E-842B-433D-994D-1D3D0B5DD125} = {09CF91E5-5BAB-4650-A200-E5EA9A633046} + {3B5BF14D-F612-4C83-9EF6-E3EBFCD08766} = {4D661178-38FB-43E4-AA5F-9B0406919344} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {70143042-A862-47A8-A677-7C819DDC90DC} diff --git a/src/SMAPI/i18n/pl.json b/src/SMAPI/i18n/pl.json index b9c788fc..fa4650a2 100644 --- a/src/SMAPI/i18n/pl.json +++ b/src/SMAPI/i18n/pl.json @@ -1,6 +1,6 @@ -{ - // short date format for SDate - // tokens: {{day}} (like 15), {{season}} (like Spring), {{seasonLowercase}} (like spring), {{year}} (like 2) - "generic.date": "{{day}} {{seasonLowercase}}", - "generic.date-with-year": "{{day}} {{seasonLowercase}} w roku {{year}}" -} +{ + // short date format for SDate + // tokens: {{day}} (like 15), {{season}} (like Spring), {{seasonLowercase}} (like spring), {{year}} (like 2) + "generic.date": "{{day}} {{seasonLowercase}}", + "generic.date-with-year": "{{day}} {{seasonLowercase}} w roku {{year}}" +} -- cgit From 5b5dd47c22a1332a4c432d6a1cd414b5c83388d7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 5 Dec 2021 19:10:28 -0500 Subject: prepare for release --- build/common.targets | 2 +- docs/release-notes.md | 8 +++++--- src/SMAPI.Installer/InteractiveInstaller.cs | 4 ++-- src/SMAPI.Mods.ConsoleCommands/manifest.json | 4 ++-- src/SMAPI.Mods.ErrorHandler/manifest.json | 4 ++-- src/SMAPI.Mods.SaveBackup/manifest.json | 4 ++-- src/SMAPI/Constants.cs | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/SMAPI') diff --git a/build/common.targets b/build/common.targets index ed860eee..1021c2a1 100644 --- a/build/common.targets +++ b/build/common.targets @@ -1,7 +1,7 @@ - 3.13.1 + 3.13.2 SMAPI latest $(AssemblySearchPaths);{GAC} diff --git a/docs/release-notes.md b/docs/release-notes.md index 8a26514d..499fa322 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,9 +1,11 @@ ← [README](README.md) # Release notes -## Upcoming version +## 3.13.2 +Released 05 December 2021 for Stardew Valley 1.5.5 or later. + * For players: - * You no longer need .NET 5 installed to run SMAPI or the installer. + * You no longer need .NET 5 to install or use SMAPI. * The installer now detects when the game folder contains an incompatible legacy game version. * Updated for the latest Stardew Valley 1.5.5 hotfix. * Updated compatibility list. @@ -12,7 +14,7 @@ * Fixed the JSON validator marking `.fnt` files invalid in Content Patcher files. * 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. + * Added [release package scripts](technical/smapi.md) to streamline preparing SMAPI releases. ## 3.13.1 Released 30 November 2021 for Stardew Valley 1.5.5 or later. diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 6694c257..1257f12b 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -655,7 +655,7 @@ namespace StardewModdingApi.Installer case GameFolderType.LegacyCompatibilityBranch: this.PrintWarning($"{errorPrefix} that directory seems to have the Stardew Valley legacy 'compatibility' branch."); - this.PrintWarning("Unfortunately SMAPI is only compatible with the full main version of the game."); + this.PrintWarning("Unfortunately SMAPI is only compatible with the modern version of the game."); this.PrintWarning("Please update your game to the main branch to use SMAPI."); return null; @@ -738,7 +738,7 @@ namespace StardewModdingApi.Installer case GameFolderType.LegacyCompatibilityBranch: this.PrintWarning("That directory seems to have the Stardew Valley legacy 'compatibility' branch."); - this.PrintWarning("Unfortunately SMAPI is only compatible with the full main version of the game."); + this.PrintWarning("Unfortunately SMAPI is only compatible with the modern version of the game."); this.PrintWarning("Please update your game to the main branch to use SMAPI."); continue; diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index ac6ff6ea..216a4c32 100644 --- a/src/SMAPI.Mods.ConsoleCommands/manifest.json +++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json @@ -1,9 +1,9 @@ { "Name": "Console Commands", "Author": "SMAPI", - "Version": "3.13.1", + "Version": "3.13.2", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "3.13.1" + "MinimumApiVersion": "3.13.2" } diff --git a/src/SMAPI.Mods.ErrorHandler/manifest.json b/src/SMAPI.Mods.ErrorHandler/manifest.json index e19a6a7f..beb52020 100644 --- a/src/SMAPI.Mods.ErrorHandler/manifest.json +++ b/src/SMAPI.Mods.ErrorHandler/manifest.json @@ -1,9 +1,9 @@ { "Name": "Error Handler", "Author": "SMAPI", - "Version": "3.13.1", + "Version": "3.13.2", "Description": "Handles some common vanilla errors to log more useful info or avoid breaking the game.", "UniqueID": "SMAPI.ErrorHandler", "EntryDll": "ErrorHandler.dll", - "MinimumApiVersion": "3.13.1" + "MinimumApiVersion": "3.13.2" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index 3e55ce42..2bd20a63 100644 --- a/src/SMAPI.Mods.SaveBackup/manifest.json +++ b/src/SMAPI.Mods.SaveBackup/manifest.json @@ -1,9 +1,9 @@ { "Name": "Save Backup", "Author": "SMAPI", - "Version": "3.13.1", + "Version": "3.13.2", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "3.13.1" + "MinimumApiVersion": "3.13.2" } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index c5ad215c..5de28f84 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -49,7 +49,7 @@ namespace StardewModdingAPI internal static int? LogScreenId { get; set; } /// SMAPI's current raw semantic version. - internal static string RawApiVersion = "3.13.1"; + internal static string RawApiVersion = "3.13.2"; } /// Contains SMAPI's constants and assumptions. -- cgit