From 48b9acb074967b03bdacff1fc357d4c8801ec1d6 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 18 Nov 2018 00:51:30 -0500 Subject: add build logic from the custom scripts (#602) --- build/prepare-install-package.targets | 51 +++++++++++++++++++++++---- docs/technical-docs.md | 53 ++++++----------------------- src/SMAPI.Installer/InteractiveInstaller.cs | 16 +++++++++ 3 files changed, 72 insertions(+), 48 deletions(-) diff --git a/build/prepare-install-package.targets b/build/prepare-install-package.targets index 127a8dd5..0b575d6f 100644 --- a/build/prepare-install-package.targets +++ b/build/prepare-install-package.targets @@ -10,9 +10,10 @@ $(SolutionDir)\..\bin\$(Configuration) $(CompiledRootPath)\SMAPI $(CompiledRootPath)\SMAPI.Toolkit\net4.5 - $(SolutionDir)\..\bin\Packaged - bundle.windows.zipped - bundle.mono.zipped + $(SolutionDir)\..\bin\SMAPI installer + $(SolutionDir)\..\bin\SMAPI installer for developers + windows + mono @@ -20,6 +21,7 @@ + @@ -27,7 +29,7 @@ - + @@ -52,11 +54,25 @@ - - + + + + + + + + + + + + + + + + @@ -81,4 +97,27 @@ + + + + + + + + + + + + + + + + + + diff --git a/docs/technical-docs.md b/docs/technical-docs.md index 4a8f45f1..88c1a91f 100644 --- a/docs/technical-docs.md +++ b/docs/technical-docs.md @@ -44,7 +44,7 @@ executed. This 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. See -[crossplatforming info](https://stardewvalleywiki.com/Modding:Creating_a_SMAPI_mod#Test_on_all_platforms) +[crossplatforming info](https://stardewvalleywiki.com/Modding:Modder_Guide/Test_and_Troubleshoot#Testing_on_all_platforms) on the wiki for the first-time setup. 1. Update the version number in `GlobalAssemblyInfo.cs` and `Constants::Version`. Make sure you use a @@ -57,47 +57,16 @@ on the wiki for the first-time setup. release | `` | `3.0` 2. In Windows: - 1. Rebuild the solution in _Release_ mode. - 2. Rename `bin/Packaged` to `SMAPI ` (e.g. `SMAPI 3.0`). - 2. Transfer the `SMAPI ` folder to Linux or Mac. - _This adds the installer executable and Windows files. We'll do the rest in Linux or Mac, - since we need to set Unix file permissions that Windows won't save._ - -2. In Linux or Mac: - 1. Rebuild the solution in _Release_ mode. - 2. Copy `bin/internal/Packaged/Mono` into the `SMAPI ` folder. - 3. If you did everything right so far, you should have a folder like this: - - ``` - SMAPI 3.0 installer/ - install on Linux.sh - install on Mac.command - install on Windows.exe - README.txt - internal/ - Mono/ - Mods/* - smapi-internal/* - StardewModdingAPI - StardewModdingAPI.exe - StardewModdingAPI.pdb - StardewModdingAPI.xml - steam_appid.txt - Windows/ - Mods/* - smapi-internal/* - StardewModdingAPI.exe - StardewModdingAPI.pdb - StardewModdingAPI.xml - steam_appid.txt - ``` - 4. Open a terminal in the `SMAPI ` folder and run `chmod 755 internal/Mono/StardewModdingAPI`. - 5. Copy & paste the `SMAPI ` folder as `SMAPI for developers`. - 6. In the `SMAPI ` folder... - * edit `internal/Mono/StardewModdingAPI.config.json` and - `internal/Windows/StardewModdingAPI.config.json` to disable developer mode; - * delete `internal/Windows/StardewModdingAPI.xml`. - 7. Compress the two folders into `SMAPI .zip` and `SMAPI for developers.zip`. + 1. Rebuild the solution in Release mode. + 2. Copy `bundle.windows.zipped` from `bin/SMAPI installer` and `bin/SMAPI installer for developers` + to Linux/Mac. + +3. In Linux/Mac: + 1. Rebuild the solution in Release mode. + 2. Add the `bundle.windows.zipped` files to the `bin/SMAPI installer` and + `bin/SMAPI installer for developers` folders. + 3. Rename the folders to `SMAPI installer` and `SMAPI installer for developers`. + 4. Zip the two folders. ## Customisation ### Configuration file diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 4212418d..d5866c74 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -445,6 +446,8 @@ namespace StardewModdingApi.Installer if (platform.IsMono()) { this.PrintDebug("Safely replacing game launcher..."); + + // back up & remove current launcher if (File.Exists(paths.UnixLauncherPath)) { if (!File.Exists(paths.UnixBackupLauncherPath)) @@ -453,7 +456,20 @@ namespace StardewModdingApi.Installer this.InteractivelyDelete(paths.UnixLauncherPath); } + // add new launcher File.Move(paths.UnixSmapiLauncherPath, paths.UnixLauncherPath); + + // mark file executable + // (MSBuild doesn't keep permission flags for files zipped in a build task.) + new Process + { + StartInfo = new ProcessStartInfo + { + FileName = "chmod", + Arguments = $"755 \"{paths.UnixLauncherPath}\"", + CreateNoWindow = true + } + }.Start(); } // create mods directory (if needed) -- cgit