diff options
-rw-r--r-- | docs/mod-build-config.md | 13 | ||||
-rw-r--r-- | src/SMAPI.ModBuildConfig/build/smapi.targets | 17 | ||||
-rw-r--r-- | src/SMAPI.ModBuildConfig/package.nuspec | 3 |
3 files changed, 32 insertions, 1 deletions
diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index ca750c86..2616d8a5 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -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" diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index 7e8bbfc3..e27fc2c7 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -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> diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index 8393ab61..6af8fefe 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -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> |