summaryrefslogtreecommitdiff
path: root/src/SMAPI.ModBuildConfig
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-06-19 14:22:16 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-09-14 18:16:19 -0400
commit62d0b3b32228e0c0e8b999578a147a9dd217fb06 (patch)
treed141a589b873a18351756cbe9be69bed5364e455 /src/SMAPI.ModBuildConfig
parenta54db1b33019645f862b0552ad2cd0700074c592 (diff)
downloadSMAPI-62d0b3b32228e0c0e8b999578a147a9dd217fb06.tar.gz
SMAPI-62d0b3b32228e0c0e8b999578a147a9dd217fb06.tar.bz2
SMAPI-62d0b3b32228e0c0e8b999578a147a9dd217fb06.zip
reduce duplication in mod build package
Diffstat (limited to 'src/SMAPI.ModBuildConfig')
-rw-r--r--src/SMAPI.ModBuildConfig/build/smapi.targets175
1 files changed, 69 insertions, 106 deletions
diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets
index 0daf40a1..51432d96 100644
--- a/src/SMAPI.ModBuildConfig/build/smapi.targets
+++ b/src/SMAPI.ModBuildConfig/build/smapi.targets
@@ -26,133 +26,96 @@
<EnableModZip Condition="'$(EnableModZip)' == ''">true</EnableModZip>
<EnableHarmony Condition="'$(EnableModZip)' == ''">false</EnableHarmony>
<EnableGameDebugging Condition="$(EnableGameDebugging) == ''">true</EnableGameDebugging>
- <CopyModReferencesToBuildOutput Condition="'$(CopyModReferencesToBuildOutput)' == ''">false</CopyModReferencesToBuildOutput>
+ <CopyModReferencesToBuildOutput Condition="'$(CopyModReferencesToBuildOutput)' == '' OR ('$(CopyModReferencesToBuildOutput)' != 'true' AND '$(CopyModReferencesToBuildOutput)' != 'false')">false</CopyModReferencesToBuildOutput>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="$(OS) == 'Windows_NT' AND $(EnableGameDebugging) == 'true'">
+ <!-- enable game debugging -->
+ <StartAction>Program</StartAction>
+ <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram>
+ <StartWorkingDirectory>$(GamePath)</StartWorkingDirectory>
</PropertyGroup>
<!--*********************************************
- ** Inject the assembly references and debugging configuration
+ ** Add assembly references
**********************************************-->
+ <!-- common -->
<ItemGroup>
+ <Reference Include="$(GameExecutableName)">
+ <HintPath>$(GamePath)\$(GameExecutableName).exe</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="StardewModdingAPI">
+ <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="SMAPI.Toolkit.CoreInterfaces">
+ <HintPath>$(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="xTile">
+ <HintPath>$(GamePath)\xTile.dll</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
<Reference Include="0Harmony" Condition="'$(EnableHarmony)' == 'true'">
<HintPath>$(GamePath)\smapi-internal\0Harmony.dll</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ </ItemGroup>
+
+ <!-- Windows -->
+ <ItemGroup Condition="$(OS) == 'Windows_NT'">
+ <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="Netcode">
+ <HintPath>$(GamePath)\Netcode.dll</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="StardewValley.GameData">
+ <HintPath>$(GamePath)\StardewValley.GameData.dll</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ </ItemGroup>
+
+ <!-- Linux/Mac -->
+ <ItemGroup Condition="$(OS) != 'Windows_NT'">
+ <Reference Include="MonoGame.Framework">
+ <HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
+ </Reference>
+ <Reference Include="StardewValley.GameData.MonoGame">
+ <HintPath>$(GamePath)\StardewValley.GameData.MonoGame.dll</HintPath>
+ <Private>$(CopyModReferencesToBuildOutput)</Private>
</Reference>
</ItemGroup>
- <Choose>
- <When Condition="$(OS) == 'Windows_NT'">
- <!-- references -->
- <ItemGroup>
- <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">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="$(CopyModReferencesToBuildOutput)">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="$(CopyModReferencesToBuildOutput)">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="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="Netcode">
- <HintPath>$(GamePath)\Netcode.dll</HintPath>
- <Private>False</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="Stardew Valley">
- <HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="StardewValley.GameData">
- <HintPath>$(GamePath)\StardewValley.GameData.dll</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="StardewModdingAPI">
- <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="SMAPI.Toolkit.CoreInterfaces">
- <HintPath>$(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">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="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- </ItemGroup>
-
- <!-- launch game for debugging -->
- <PropertyGroup Condition="$(EnableGameDebugging) == 'true'">
- <StartAction>Program</StartAction>
- <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram>
- <StartWorkingDirectory>$(GamePath)</StartWorkingDirectory>
- </PropertyGroup>
- </When>
- <Otherwise>
- <!-- references -->
- <ItemGroup>
- <Reference Include="MonoGame.Framework">
- <HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath>
- <Private>false</Private>
- <SpecificVersion>false</SpecificVersion>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="StardewValley">
- <HintPath>$(GamePath)\StardewValley.exe</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="StardewValley.GameData.MonoGame">
- <HintPath>$(GamePath)\StardewValley.GameData.MonoGame.dll</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="StardewModdingAPI">
- <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="SMAPI.Toolkit.CoreInterfaces">
- <HintPath>$(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- <Reference Include="xTile">
- <HintPath>$(GamePath)\xTile.dll</HintPath>
- <Private>false</Private>
- <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
- </Reference>
- </ItemGroup>
- </Otherwise>
- </Choose>
<!--*********************************************
- ** Deploy mod files & create release zip after build
+ ** Show friendly error for invalid OS or game path
**********************************************-->
- <!-- if game path or OS is invalid, show one user-friendly error instead of a slew of reference errors -->
<Target Name="BeforeBuild">
<Error Condition="'$(OS)' != 'OSX' AND '$(OS)' != 'Unix' AND '$(OS)' != 'Windows_NT'" Text="The mod build package doesn't recognise OS type '$(OS)'." />
<Error Condition="!Exists('$(GamePath)')" Text="The mod build package can't find your game folder. You can specify where to find it; see https://smapi.io/buildmsg/custom-game-path." />
- <Error Condition="'$(OS)' == 'Windows_NT' AND !Exists('$(GamePath)\Stardew Valley.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the Stardew Valley.exe file. If this folder is invalid, delete it and the package will autodetect another game install path." />
- <Error Condition="'$(OS)' != 'Windows_NT' AND !Exists('$(GamePath)\StardewValley.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the StardewValley.exe file. If this folder is invalid, delete it and the package will autodetect another game install path." />
+ <Error Condition="!Exists('$(GamePath)\$(GameExecutableName).exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the $(GameExecutableName) file. If this folder is invalid, delete it and the package will autodetect another game install path." />
<Error Condition="!Exists('$(GamePath)\StardewModdingAPI.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain SMAPI. You need to install SMAPI before building the mod." />
</Target>
- <!-- deploy mod files & create release zip -->
+
+ <!--*********************************************
+ ** Deploy mod files & create release zip
+ **********************************************-->
<Target Name="AfterBuild">
<DeployModTask
ModFolderName="$(ModFolderName)"