add unit test mode to mod build config package

This commit is contained in:
Jesse Plamondon-Willard 2018-03-21 00:19:12 -04:00
parent de5ee6f928
commit e48f230142
3 changed files with 32 additions and 1 deletions

View File

@ -120,6 +120,19 @@ or you have multiple installs, you can specify the path yourself. There's two wa
The configuration will check your custom path first, then fall back to the default paths (so it'll
still compile on a different computer).
### Unit test projects
**(upcoming in 2.0.3)**
You can use the package in unit test projects too. Its optional unit test mode...
1. disables deploying the project as a mod;
2. disables creating a release zip;
2. and copies the referenced DLLs into the build output for unit test frameworks.
To enable it, add this above the first `</PropertyGroup>` in your `.csproj`:
```xml
<ModUnitTests>True</ModUnitTests>
```
## Troubleshoot
### "Failed to find the game install path"

View File

@ -19,9 +19,14 @@
<!-- set default settings -->
<ModFolderName Condition="'$(ModFolderName)' == ''">$(MSBuildProjectName)</ModFolderName>
<ModUnitTests Condition="'$(ModUnitTests)' == ''">True</ModUnitTests>
<ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath>
<EnableModDeploy Condition="'$(EnableModDeploy)' == ''">True</EnableModDeploy>
<EnableModZip Condition="'$(EnableModZip)' == ''">True</EnableModZip>
<!-- disable mod deploy in unit test project -->
<EnableModDeploy Condition="$(ModUnitTests)">False</EnableModDeploy>
<EnableModZip Condition="$(ModUnitTests)">False</EnableModZip>
</PropertyGroup>
<!-- find platform + game path -->
@ -57,32 +62,40 @@
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="Netcode" Condition="Exists('$(GamePath)\Netcode.dll')">
<HintPath>$(GamePath)\Netcode.dll</HintPath>
<Private>False</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="Stardew Valley">
<HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="StardewModdingAPI">
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86">
<HintPath>$(GamePath)\xTile.dll</HintPath>
<Private>false</Private>
<SpecificVersion>False</SpecificVersion>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
</ItemGroup>
@ -100,18 +113,22 @@
<HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath>
<Private>false</Private>
<SpecificVersion>False</SpecificVersion>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="StardewValley">
<HintPath>$(GamePath)\StardewValley.exe</HintPath>
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="StardewModdingAPI">
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
<Reference Include="xTile">
<HintPath>$(GamePath)\xTile.dll</HintPath>
<Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private>
</Reference>
</ItemGroup>
</Otherwise>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Pathoschild.Stardew.ModBuildConfig</id>
<version>2.0.3-alpha20180307</version>
<version>2.0.3-alpha20180321</version>
<title>Build package for SMAPI mods</title>
<authors>Pathoschild</authors>
<owners>Pathoschild</owners>
@ -29,6 +29,7 @@
2.0.3:
- Added support for Stardew Valley 1.3.
- Added support for unit test projects.
</releaseNotes>
</metadata>
<files>