summaryrefslogtreecommitdiff
path: root/build/smapi.targets
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-06-05 15:24:53 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-06-05 17:45:05 -0400
commitffc339bc29a9b4b08d53a5d147546630116d82d7 (patch)
tree39746b67020b69b2d2915a91303d5fc0d0ecdaf0 /build/smapi.targets
parent66b1b583e5233a4b50b832733d8e2cbc329a70be (diff)
downloadSMAPI-ffc339bc29a9b4b08d53a5d147546630116d82d7.tar.gz
SMAPI-ffc339bc29a9b4b08d53a5d147546630116d82d7.tar.bz2
SMAPI-ffc339bc29a9b4b08d53a5d147546630116d82d7.zip
add support for deploying mods to game folder automatically
Diffstat (limited to 'build/smapi.targets')
-rw-r--r--build/smapi.targets25
1 files changed, 25 insertions, 0 deletions
diff --git a/build/smapi.targets b/build/smapi.targets
index 21989bd1..ea6af723 100644
--- a/build/smapi.targets
+++ b/build/smapi.targets
@@ -105,4 +105,29 @@
<Error Condition="'$(GamePlatform)' != 'Windows' AND !Exists('$(GamePath)\StardewValley.exe')" Text="Found a game folder at $(GamePath), but it doesn't contain Stardew Valley. You should delete this folder if it's empty." />
<Error Condition="!Exists('$(GamePath)\StardewModdingAPI.exe')" Text="Found a game folder at $(GamePath), but it doesn't contain SMAPI." />
</Target>
+
+ <!--######
+ ## deploy mod files
+ #######-->
+ <Target Name="AfterBuild" Condition="'$(DeployModFolderName)' != ''">
+ <!--generate paths-->
+ <PropertyGroup>
+ <ModDeployPath>$(GamePath)\Mods\$(DeployModFolderName)</ModDeployPath>
+ <FallbackManifestPath>$(ProjectDir)\manifest.json</FallbackManifestPath>
+ </PropertyGroup>
+ <ItemGroup>
+ <BuildFiles Include="$(TargetDir)\**\*.*" />
+ <FallbackTranslationFiles Include="$(ProjectDir)\i18n\*.json" />
+ </ItemGroup>
+
+ <!--validate-->
+ <Error Text="Could not deploy mod automatically because no build output was found." Condition="'@(BuildFiles)' == ''" />
+ <Error Text="Could not deploy mod automatically because no manifest.json was found in the project or build output." Condition="!Exists('$(TargetDir)\manifest.json') AND !Exists('$(FallbackManifestPath)')" />
+
+ <!-- copy mod files -->
+ <Message Text="Deploying mod to $(ModDeployPath)..." Importance="high" />
+ <Copy SourceFiles="@(BuildFiles)" DestinationFolder="$(ModDeployPath)\%(RecursiveDir)" SkipUnchangedFiles="true" />
+ <Copy SourceFiles="$(FallbackManifestPath)" DestinationFolder="$(ModDeployPath)" Condition="!Exists('$(TargetDir)\manifest.json')" />
+ <Copy SourceFiles="@(FallbackTranslationFiles)" DestinationFolder="$(ModDeployPath)\i18n\%(RecursiveDir)" Condition="!Exists('$(TargetDir)\i18n')" />
+ </Target>
</Project> \ No newline at end of file