Skip to content

Commit

Permalink
Use MSBuild targets for copying and zipping.
Browse files Browse the repository at this point in the history
  • Loading branch information
tinyhoot committed Jan 24, 2023
1 parent 997fba6 commit 0506536
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 32 deletions.
3 changes: 0 additions & 3 deletions SubnauticaRandomiser.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,4 @@ Global
{04F771FE-CA90-4C9D-B633-6366DE6855E5}.Debug|x64.ActiveCfg = Debug|x64
{04F771FE-CA90-4C9D-B633-6366DE6855E5}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
outputpath = "$SUBNAUTICA_DIR/QMods/SubnauticaRandomiser"
EndGlobalSection
EndGlobal
35 changes: 28 additions & 7 deletions SubnauticaRandomiser/SubnauticaRandomiser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,34 @@
<Optimize>true</Optimize>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>mkdir $(SUBNAUTICA_DIR)/BepInEx/plugins/SubnauticaRandomiser
cp $(OutDir)SubnauticaRandomiser.dll $(SUBNAUTICA_DIR)/BepInEx/plugins/SubnauticaRandomiser
cp $(SolutionDir)ReadMe-Documentation.txt $(SUBNAUTICA_DIR)/BepInEx/plugins/SubnauticaRandomiser
mkdir $(SUBNAUTICA_DIR)/BepInEx/plugins/SubnauticaRandomiser/DataFiles
cp $(SolutionDir)DataFiles/* $(SUBNAUTICA_DIR)/BepInEx/plugins/SubnauticaRandomiser/DataFiles</PostBuildEvent>
</PropertyGroup>

<!-- Define important extra files needed in the final distribution. -->
<ItemGroup>
<DataFiles Include="$(SolutionDir)\DataFiles\*" />
</ItemGroup>

<!-- Copy newly built files to the game directory. -->
<Target Name="CopyToGameFolder" AfterTargets="Build">
<Message Importance="high" Text="Copying files to game directory." />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(SUBNAUTICA_DIR)\BepInEx\plugins\$(AssemblyName)" />
<Copy SourceFiles="@(DataFiles)" DestinationFolder="$(SUBNAUTICA_DIR)\BepInEx\plugins\$(AssemblyName)\DataFiles" />
</Target>

<!-- Automatically create the zip file, ready for distribution. -->
<Target Name="PrepareZip" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
<Message Importance="normal" Text="Copying files to temporary directory." />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(OutputPath)\zipper\plugins\$(AssemblyName)" />
<Copy SourceFiles="@(DataFiles)" DestinationFolder="$(OutputPath)\zipper\plugins\$(AssemblyName)\DataFiles" />
</Target>
<Target Name="CreateZip" AfterTargets="PrepareZip" Condition="'$(Configuration)' == 'Release'">
<Message Importance="high" Text="Zipping project for distribution." />
<ZipDirectory DestinationFile="$(OutputPath)\$(AssemblyName).zip" SourceDirectory="$(OutputPath)\zipper" Overwrite="true" />
</Target>
<Target Name="Cleanup" AfterTargets="CreateZip" Condition="'$(Configuration)' == 'Release'">
<Message Importance="normal" Text="Cleaning up." />
<RemoveDir Directories="$(OutputPath)\zipper" />
</Target>

<ItemGroup>
<Compile Include="ConfigDefaults.cs" />
<Compile Include="DataDumper.cs" />
Expand Down
22 changes: 0 additions & 22 deletions build-release.sh

This file was deleted.

0 comments on commit 0506536

Please sign in to comment.