-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModPackageTool.targets
81 lines (67 loc) · 6.73 KB
/
ModPackageTool.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageDir>$(ProjectDir)Package</PackageDir>
<PublishDir>$(PojectDir)Publish</PublishDir>
</PropertyGroup>
<Target Name="CreateMdbFile" BeforeTargets="CopyDLLToPlugins" Condition="'$(Configuration)' == 'Debug'">
<Message Text="Creating the mdb debug file" Importance="high" Condition="Exists('$(Pdb2MdbPath)')" />
<Delete Files="$(TargetPath).mdb" />
<Exec Command="$(Pdb2MdbPath) $(TargetPath)" Condition="Exists('$(Pdb2MdbPath)')" />
<Message Text="Creation succeeded" Importance="high" Condition="'$(MSBuildLastTaskResult)' == 'True' AND Exists('$(TargetPath).mdb')" />
</Target>
<Target Name="CopyDLLToPlugins" AfterTargets="$(AfterTargets)" Condition="'$(Configuration)' == 'Debug'">
<Message Text="Copying DLL file to plugins" Importance="high" />
<MakeDir Directories="$(MOD_DEPLOYPATH)\$(AssemblyName)" />
<Message Text="Copying $(TargetFileName) to $(MOD_DEPLOYPATH)\$(AssemblyName)" Importance="high" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(MOD_DEPLOYPATH)\$(AssemblyName)" />
<Message Text="Copying $(TargetFileName).mdb to $(MOD_DEPLOYPATH)\$(AssemblyName)" Importance="high" Condition="Exists('$(TargetPath).mdb')" />
<Copy SourceFiles="$(TargetPath).mdb" DestinationFolder="$(MOD_DEPLOYPATH)\$(AssemblyName)" Condition="Exists('$(TargetPath).mdb')" />
<Message Text="Copying $(AssemblyName).pdb to $(MOD_DEPLOYPATH)\$(AssemblyName)" Importance="high" Condition="Exists('$(TargetDir)$(AssemblyName).pdb')" />
<Copy SourceFiles="$(TargetDir)$(AssemblyName).pdb" DestinationFolder="$(MOD_DEPLOYPATH)\$(AssemblyName)" Condition="Exists('$(TargetDir)$(AssemblyName).pdb')" />
<Message Text="Copy succeeded" Importance="high" />
</Target>
<Target Name="CoppyDLLToServer" AfterTargets="CopyDLLToPlugins" Condition="'$(Configuration)' == 'Debug' And '$(CopyToServer)' == 'true'">
<Message Text="Copying DLL file to server" Importance="high" />
<MakeDir Directories="$(SERVER_DEPLOYPATH)\$(AssemblyName)" />
<Message Text="Copying $(TargetFileName) to $(SERVER_DEPLOYPATH)\$(AssemblyName)" Importance="high" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(SERVER_DEPLOYPATH)\$(AssemblyName)" />
<Message Text="Copying $(TargetFileName).mdb to $(SERVER_DEPLOYPATH)\$(AssemblyName)" Importance="high" Condition="Exists('$(TargetPath).mdb')" />
<Copy SourceFiles="$(TargetPath).mdb" DestinationFolder="$(SERVER_DEPLOYPATH)\$(AssemblyName)" Condition="Exists('$(TargetPath).mdb')" />
<Message Text="Copying $(AssemblyName).pdb to $(SERVER_DEPLOYPATH)\$(AssemblyName)" Importance="high" Condition="Exists('$(TargetDir)$(AssemblyName).pdb')" />
<Copy SourceFiles="$(TargetDir)$(AssemblyName).pdb" DestinationFolder="$(SERVER_DEPLOYPATH)\$(AssemblyName)" Condition="Exists('$(TargetDir)$(AssemblyName).pdb')" />
<Message Text="Copy succeeded" Importance="high" />
</Target>
<Target Name="CreateNexusPackage" AfterTargets="$(AfterTargets)" Condition="'$(Configuration)' == 'Release'">
<Message Text="Creating Nexus package" Importance="high" />
<MakeDir Directories="$(PublishDir)\Nexus" />
<Message Text="Copying $(TargetFileName) to $(PublishDir)\Nexus" Importance="high" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PublishDir)\Nexus" />
<Message Text="Compressing..." Importance="high" />
<Exec Command="powershell.exe -Command "Compress-Archive -Path '$(PublishDir)\Nexus\*' -DestinationPath '$(PublishDir)\Nexus\$(AssemblyName).zip'" -Force" Condition="'$(OS)' == 'Windows_NT'" />
<Message Text="Nexus package created" Importance="high" />
</Target>
<Target Name="CreateThunderStorePackage" AfterTargets="$(AfterTargets)" Condition="'$(Configuration)' == 'Release'">
<Message Text="Creating ThunderStore package" Importance="high" />
<MakeDir Directories="$(PublishDir)\ThunderStore" />
<Message Text="Copying $(TargetFileName) to $(PublishDir)\ThunderStore" Importance="high" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PublishDir)\ThunderStore" />
<Message Text="Copying $(ProjectDir)README.md to $(PublishDir)\ThunderStore" Importance="high" Condition="Exists('$(ProjectDir)README.md')" />
<Copy SourceFiles="$(ProjectDir)README.md" DestinationFolder="$(PublishDir)\ThunderStore" Condition="Exists('$(ProjectDir)README.md')" />
<Message Text="Copying $(SolutionDir)README.md to $(PublishDir)\ThunderStore" Importance="high" Condition="Exists('$(SolutionDir)README.md') AND !Exists('$(ProjectDir)README.md')" />
<Copy SourceFiles="$(SolutionDir)README.md" DestinationFolder="$(PublishDir)\ThunderStore" Condition="Exists('$(SolutionDir)README.md') AND !Exists('$(ProjectDir)README.md')" />
<Message Text="Copying $(PackageDir)CHANGELOG.md to $(PublishDir)\ThunderStore" Importance="high" Condition="Exists('$(PackageDir)\CHANGELOG.md')" />
<Copy SourceFiles="$(PackageDir)\CHANGELOG.md" DestinationFolder="$(PublishDir)\ThunderStore" Condition="Exists('$(PackageDir)\CHANGELOG.md')" />
<Message Text="Copying $(SolutionDir)CHANGELOG.md to $(PublishDir)\ThunderStore" Importance="high" Condition="Exists('$(SolutionDir)CHANGELOG.md') AND !Exists('$(PackageDir)\CHANGELOG.md')" />
<Copy SourceFiles="$(SolutionDir)CHANGELOG.md" DestinationFolder="$(PublishDir)\ThunderStore" Condition="Exists('$(SolutionDir)CHANGELOG.md') AND !Exists('$(PackageDir)\CHANGELOG.md')" />
<Message Text="Copying $(PackageDir)\manifest.json to $(PublishDir)\ThunderStore" Importance="high" Condition="Exists('$(PackageDir)\manifest.json')" />
<Copy SourceFiles="$(PackageDir)\manifest.json" DestinationFolder="$(PublishDir)\ThunderStore" Condition="Exists('$(PackageDir)\manifest.json')" />
<Message Text="Copying $(SolutionDir)manifest.json to $(PublishDir)\ThunderStore" Importance="high" Condition="Exists('$(SolutionDir)manifest.json') AND !Exists('$(PackageDir)\manifest.json')" />
<Copy SourceFiles="$(SolutionDir)manifest.json" DestinationFolder="$(PublishDir)\ThunderStore" Condition="Exists('$(SolutionDir)manifest.json') AND !Exists('$(PackageDir)\manifest.json')" />
<Message Text="Copying $(PackageDir)\icon.png to $(PublishDir)\ThunderStore" Importance="high" Condition="Exists('$(PackageDir)\icon.png') AND !Exists('$(PackageDir)\icon.png')" />
<Copy SourceFiles="$(PackageDir)\icon.png" DestinationFolder="$(PublishDir)\ThunderStore" Condition="Exists('$(PackageDir)\icon.png')" />
<Message Text="Compressing..." Importance="high" />
<Exec Command="powershell.exe -Command "Compress-Archive -Path '$(PublishDir)\ThunderStore\*' -DestinationPath '$(PublishDir)\ThunderStore\$(AssemblyName).zip'" -Force" Condition="'$(OS)' == 'Windows_NT'" />
<Message Text="ThunderStore package created" Importance="high" />
</Target>
</Project>