add support for using a custom Harmony build (#711)

This commit is contained in:
Jesse Plamondon-Willard 2020-06-14 11:29:07 -04:00
parent 79181012ee
commit 2d19095169
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
3 changed files with 24 additions and 16 deletions

4
.gitignore vendored
View File

@ -30,8 +30,8 @@ _ReSharper*/
# sensitive files
appsettings.Development.json
# AWS generated files
src/SMAPI.Web.LegacyRedirects/aws-beanstalk-tools-defaults.json
# generated build files
build/0Harmony.*
# Azure generated files
src/SMAPI.Web/Properties/PublishProfiles/*.pubxml

View File

@ -15,6 +15,7 @@ This document is about SMAPI itself; see also [mod build package](mod-package.md
* [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)
* [Release notes](#release-notes)
## Customisation
@ -60,21 +61,18 @@ flag | purpose
## For SMAPI developers
### Compiling from source
Using an official SMAPI release is recommended for most users.
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.
SMAPI often uses the latest C# syntax. You may need the latest version of
[Visual Studio](https://www.visualstudio.com/vs/community/) on Windows,
[MonoDevelop](https://www.monodevelop.com/) on Linux,
[Visual Studio for Mac](https://www.visualstudio.com/vs/visual-studio-mac/), or an equivalent IDE
to compile it. It 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.
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 Mac or Windows) will launch SMAPI with
the debugger attached, so you can intercept errors and step through the code being executed. This
the debugger attached, so you can intercept errors and step through the code being executed. That
doesn't work in MonoDevelop on Linux, unfortunately.
### Preparing a release
@ -87,9 +85,9 @@ on the wiki for the first-time setup.
build type | format | example
:--------- | :----------------------- | :------
dev build | `<version>-alpha.<date>` | `3.0-alpha.20171230`
prerelease | `<version>-beta.<count>` | `3.0-beta.2`
release | `<version>` | `3.0`
dev build | `<version>-alpha.<date>` | `3.0.0-alpha.20171230`
prerelease | `<version>-beta.<count>` | `3.0.0-beta.2`
release | `<version>` | `3.0.0`
2. In Windows:
1. Rebuild the solution in Release mode.
@ -103,5 +101,14 @@ on the wiki for the first-time setup.
3. Rename the folders to `SMAPI <version> installer` and `SMAPI <version> installer for developers`.
4. Zip the two folders.
### Using a custom Harmony build
The official SMAPI releases include [a custom build of Harmony](https://github.com/Pathoschild/Harmony),
but compiling from source will use the official build. To use a custom build, put `0Harmony.dll` in
the `build` folder and it'll be referenced automatically.
Note that Harmony merges its dependencies into `0Harmony.dll` when compiled in release mode. To use
a debug build of Harmony, you'll need to manually copy those dependencies into your game's
`smapi-internal` folder.
## Release notes
See [release notes](../release-notes.md).

View File

@ -14,13 +14,14 @@
<ItemGroup>
<PackageReference Include="LargeAddressAware" Version="1.0.4" />
<PackageReference Include="Lib.Harmony" Version="2.0.0.10" />
<PackageReference Include="Lib.Harmony" Version="2.0.0.10" Condition="!Exists('..\..\build\0Harmony.dll')" />
<PackageReference Include="Mono.Cecil" Version="0.11.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Platonymous.TMXTile" Version="1.3.7" />
</ItemGroup>
<ItemGroup>
<Reference Include="..\..\build\0Harmony.dll" Private="True" Condition="Exists('..\..\build\0Harmony.dll')" />
<Reference Include="$(GameExecutableName)" HintPath="$(GamePath)\$(GameExecutableName).exe" Private="False" />
<Reference Include="StardewValley.GameData" HintPath="$(GamePath)\StardewValley.GameData.dll" Private="False" />
<Reference Include="System.Numerics" Private="True" />