-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModPackageTool.targets
227 lines (197 loc) · 9.78 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?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>
<ProjectResourcesDir>$(ProjectDir)\Resources</ProjectResourcesDir>
<SolutionResourcesDir>$(SolutionDir)\Resources</SolutionResourcesDir>
</PropertyGroup>
<ItemGroup>
<ProjectResources Include="$(ProjectResourcesDir)\*.png" />
<SolutionResources Include="$(SolutionResourcesDir)\*.png" />
<PackageFiles Include="$(PackageDir)\*.*" />
</ItemGroup>
<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="CopyResourcesToPlugins"
AfterTargets="CopyDLLToPlugins"
Condition="'$(Configuration)' == 'Debug' And '$(CopyResources)' == 'true'">
<PropertyGroup>
<OutputResources>$(MOD_DEPLOYPATH)\$(AssemblyName)</OutputResources>
</PropertyGroup>
<Message Text="Copying Resources directory to $(OutputResources)" Importance="high" />
<MakeDir Directories="$(OutputResources)" />
<Message
Text="Copying $(ProjectResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(ProjectResourcesDir)')" />
<Copy
SourceFiles="@(ProjectResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(ProjectResources)')"
SkipUnchangedFiles="true" />
<Message
Text="Copying $(SolutionResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(SolutionResourcesDir)') AND !Exists('@(ProjectResources)')" />
<Copy
SourceFiles="@(SolutionResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(SolutionResources)') AND !Exists('@(ProjectResources)')"
SkipUnchangedFiles="true" />
<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="CopyResourcesToServer"
AfterTargets="CopyDLLToServer"
Condition="'$(Configuration)' == 'Debug' And '$(CopyResources)' == 'true'">
<PropertyGroup>
<OutputResources>$(SERVER_DEPLOYPATH)\$(AssemblyName)</OutputResources>
</PropertyGroup>
<Message Text="Copying Resources directory to $(OutputResources)" Importance="high" />
<MakeDir Directories="$(OutputResources)" />
<Message
Text="Copying $(ProjectResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(ProjectResourcesDir)')" />
<Copy
SourceFiles="@(ProjectResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(ProjectResources)')"
SkipUnchangedFiles="true" />
<Message
Text="Copying $(SolutionResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(SolutionResourcesDir)') AND !Exists('@(ProjectResources)')" />
<Copy
SourceFiles="@(SolutionResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(SolutionResources)') AND !Exists('@(ProjectResources)')"
SkipUnchangedFiles="true" />
<Message Text="Copy succeeded" Importance="high" />
</Target>
<Target Name="CreateNexusPackage" AfterTargets="$(AfterTargets)" Condition="'$(Configuration)' == 'Release'">
<PropertyGroup>
<OutputResources>$(PublishDir)\Nexus</OutputResources>
</PropertyGroup>
<Message Text="Creating Nexus package" Importance="high" />
<MakeDir Directories="$(PublishDir)\Nexus" />
<MakeDir Directories="$(OutputResources)" />
<Message Text="Copying $(TargetFileName) to $(PublishDir)\Nexus" Importance="high" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PublishDir)\Nexus" />
<Message
Text="Copying $(ProjectResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(ProjectResourcesDir)') AND '$(CopyResources)' == 'true'" />
<Copy
SourceFiles="@(ProjectResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(ProjectResources)') AND '$(CopyResources)' == 'true'"
SkipUnchangedFiles="true" />
<Message
Text="Copying $(SolutionResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(SolutionResourcesDir)') AND !Exists('@(ProjectResources)') AND '$(CopyResources)' == 'true'" />
<Copy
SourceFiles="@(SolutionResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(SolutionResources)') AND !Exists('@(ProjectResources)') AND '$(CopyResources)' == 'true'"
SkipUnchangedFiles="true" />
<Message Text="Copy succeeded" Importance="high" />
<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'">
<PropertyGroup>
<OutputResources>$(PublishDir)\ThunderStore</OutputResources>
</PropertyGroup>
<Message Text="Creating ThunderStore package" Importance="high" />
<MakeDir Directories="$(PublishDir)\ThunderStore" />
<MakeDir Directories="$(OutputResources)" />
<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 Package files to $(PublishDir)\ThunderStore" Importance="high" />
<Message
Text="Copying @(PackageFiles) to $(PublishDir)\ThunderStore"
Importance="high"
Condition="Exists('@(PackageFiles)')" />
<Copy
SourceFiles="@(PackageFiles)"
DestinationFolder="$(PublishDir)\ThunderStore"
Condition="Exists('@(PackageFiles)') "
SkipUnchangedFiles="true" />
<Message
Text="Copying $(ProjectResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(ProjectResourcesDir)') And '$(CopyResources)' == 'true'" />
<Copy
SourceFiles="@(ProjectResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(ProjectResources)') And '$(CopyResources)' == 'true'"
SkipUnchangedFiles="true" />
<Message
Text="Copying $(SolutionResourcesDir) to $(OutputResources)"
Importance="high"
Condition="Exists('$(SolutionResourcesDir)') AND !Exists('@(ProjectResources)') And '$(CopyResources)' == 'true'" />
<Copy
SourceFiles="@(SolutionResources)"
DestinationFolder="$(OutputResources)"
Condition="Exists('@(SolutionResources)') AND !Exists('@(ProjectResources)') And '$(CopyResources)' == 'true'"
SkipUnchangedFiles="true" />
<Message Text="Copy succeeded" Importance="high" />
<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>