-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSportsTacticsBoard.build
404 lines (352 loc) · 17.4 KB
/
SportsTacticsBoard.build
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<?xml version="1.0" encoding="utf-8" ?>
<project name="Sports Tactics Board" default="build" xmlns="http://nant.sf.net/release/0.85/nant.xsd">
<!-- You will need to change this if you installed WiX or FxCop somewhere else -->
<property name="dir.wixpath" value="${environment::get-variable('WIX')}" overwrite="false"/>
<property name="dir.fxcoppath" value="${environment::get-variable('ProgramFiles')}\Microsoft FxCop 1.36" overwrite="false"/>
<!-- Define various root directory names -->
<property name="dir.root" value="${project::get-base-directory()}" overwrite="false"/>
<echo level="Verbose" message="dir.root = ${dir.root}" />
<property name="dir.root.target" value="${dir.root}\Release" overwrite="false"/>
<property name="dir.root.build" value="${dir.root}\Build" overwrite="false"/>
<property name="dir.version" value="${dir.root}\Version" overwrite="false"/>
<property name="dir.library" value="${dir.root}\Library" overwrite="false"/>
<property name="dir.wixpath.bin" value="${dir.wixpath}\Bin"/>
<!-- Load the custom tasks for WiX -->
<!-- Not used yet as the WiX NAnt tasks do not support WiX Extensions -->
<!-- <loadtasks assembly="${dir.wixpath.bin}\Microsoft.Tools.WindowsInstallerXml.NAntTasks.dll"/> -->
<property name="flavor" value="debug" overwrite="false" />
<if test="${flavor != 'debug' and flavor != 'ship'}">
<fail message="Please specify either 'debug' or 'ship' for the flavor." />
</if>
<!-- Define various folder names that are based on the flavor -->
<property name="dir.target" value="${dir.root.target}\${flavor}" readonly="true"/>
<property name="dir.build" value="${dir.root.build}\Release" readonly="true" if="${flavor == 'ship'}"/>
<property name="dir.build" value="${dir.root.build}\Debug" readonly="true" if="${flavor == 'debug'}"/>
<property name="dir.install" value="${dir.root}\WiXInstaller" readonly="true"/>
<property name="dir.install.target" value="${dir.build}" readonly="true"/>
<property name="dir.install.build" value="${dir.install}\obj\Release" readonly="true" if="${flavor == 'ship'}"/>
<property name="dir.install.build" value="${dir.install}\obj\Debug" readonly="true" if="${flavor == 'debug'}"/>
<!-- Define some of the file names we will be working with/on -->
<property name="file.build.msi" value="${dir.install.target}\SportsTacticsBoard.msi" readonly="true"/>
<property name="file.build.setup.exe" value="${dir.install.target}\SportsTacticsBoard-setup.exe" readonly="true"/>
<property name="file.version.cs" value="${dir.version}\ver.cs"/>
<property name="file.version.wxi" value="${dir.version}\ver.wxi"/>
<property name="file.version.wxi.template" value="${dir.version}\ver.template.wxi"/>
<!-- Retrieve the release version information -->
<loadfile file="${file.version.cs}" property="version.cs" />
<regex input="${version.cs}" options="Multiline" pattern="^\[assembly: AssemblyVersion(Attribute)+\("(?'version_major'\d*)\.(?'version_minor'\d*)\.(?'version_build'\d*)\.(?'version_rev'\d*)"\)\]" />
<property name="version" value="${version_major}.${version_minor}.${version_build}.${version_rev}" />
<property name="version.withoutrev" value="${version_major}.${version_minor}.${version_build}" />
<!-- Define some re-used file sets -->
<fileset id="library_file_set" basedir="${dir.library}">
<include name="**/*"/>
</fileset>
<fileset id="docs_file_set" basedir="${dir.root}">
<include name="changelog.txt"/>
<include name="readme.txt"/>
<include name="license.txt"/>
<include name="license.rtf"/>
</fileset>
<fileset id="binaries_file_set" basedir="${dir.build}">
<include name="SportsTacticsBoard.exe"/>
<include name="SportsTacticsBoard.exe.config"/>
<include name="de/SportsTacticsBoard.resources.dll"/>
</fileset>
<!-- === MAIN TARGETS === -->
<target name="clean" description="Cleans all output from all targets"
depends="version_files.clean,
solution.clean,
analysis.clean,
installer.clean,
release_files.clean">
<delete dir="${dir.target}"/>
<delete dir="${dir.build}"/>
</target>
<target name="build" description="Builds all unbuilt targets"
depends="version_files,
solution,
analysis,
installer,
release_files"/>
<target name="rebuild" depends="clean, build" description="Rebuilds all output for all targets"/>
<!-- === INCREMENT BUILD NUMBER === -->
<!--
The master version number and build number is in ${file.version.cs} and
should be updated manually to change the product version. The build
number can be incremented using this target.
Note that this DOES NOT reload properties and should be called
independently (i.e. in a separate invocation of NAnt) of building the program.
-->
<target name="increment_build_number" description="Increments the build number and re-writes the version files.">
<!-- Generate the new build number and the complete version string -->
<property name="version_build.new" value="${int::to-string(int::parse(version_build) + 1)}"/>
<property name="version.new" value="${version_major}.${version_minor}.${version_build.new}.${version_rev}"/>
<!-- Write out the new assembly information file with the version information in -->
<asminfo output="${file.version.cs}" language="CSharp">
<attributes>
<attribute type="AssemblyVersionAttribute" value="${version.new}"/>
<attribute type="AssemblyFileVersionAttribute" value="${version.new}"/>
</attributes>
<imports>
<import namespace="System.Reflection"/>
</imports>
<references>
<include name="System.dll" />
</references>
</asminfo>
</target>
<!-- === CREATE VERSION FILES === -->
<target name="version_files">
<!-- Write out the WiX include file with the version information in -->
<copy file="${file.version.wxi.template}" tofile="${file.version.wxi}"
unless="${file::exists(file.version.wxi) and
file::up-to-date(file.version.cs, file.version.wxi)}"
overwrite="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
</target>
<target name="version_files.clean">
<delete file="${file.version.wxi}"/>
</target>
<!-- === RELEASE FILES === -->
<property name="dir.version.folder" value="${dir.target}" readonly="true" />
<property name="file.target.bin.zip" value="${dir.version.folder}\SportsTacticsBoard-${version.withoutrev}-bin.zip" readonly="true" />
<property name="file.target.src.zip" value="${dir.version.folder}\SportsTacticsBoard-${version.withoutrev}-src.zip" readonly="true" />
<property name="file.target.msi" value="${dir.version.folder}\SportsTacticsBoard-${version.withoutrev}.msi" readonly="true" />
<property name="file.target.setup.exe" value="${dir.version.folder}\SportsTacticsBoard-${version.withoutrev}-setup.exe" readonly="true" />
<target name="release_files" depends="solution,installer" description="Creates files used for releasing the program">
<mkdir dir="${dir.target}"/>
<mkdir dir="${dir.version.folder}"/>
<!-- Copy and rename the MSI file and the setup.exe -->
<copy file="${file.build.msi}" tofile="${file.target.msi}"/>
<copy file="${file.build.setup.exe}" tofile="${file.target.setup.exe}"/>
<!-- Build the bin ZIP file for those that don't like MSI installers -->
<zip zipfile="${file.target.bin.zip}">
<fileset prefix="Library" basedir="${dir.library}">
<include name="**/*"/>
</fileset>
<fileset basedir="${dir.root}">
<include name="changelog.txt"/>
<include name="readme.txt"/>
<include name="license.txt"/>
<include name="license.rtf"/>
</fileset>
<fileset basedir="${dir.build}">
<include name="SportsTacticsBoard.exe"/>
<include name="SportsTacticsBoard.exe.config"/>
<include name="de/SportsTacticsBoard.resources.dll"/>
</fileset>
</zip>
<!-- Build the source ZIP file to make it easy for people to download and preserve the source -->
<zip zipfile="${file.target.src.zip}">
<fileset basedir="${dir.root}">
<include name="**/*.avi"/>
<include name="**/*.bat"/>
<include name="**/*.bmp"/>
<include name="**/*.build"/>
<include name="**/*.config"/>
<include name="**/*.cpp"/>
<include name="**/*.cs"/>
<include name="**/*.css"/>
<include name="**/*.csproj"/>
<include name="**/*.ctc"/>
<include name="**/*.def"/>
<include name="**/*.files"/>
<include name="**/*.FxCop"/>
<include name="**/*.jsl"/>
<include name="**/*.h"/>
<include name="**/*.htm"/>
<include name="**/*.ico"/>
<include name="**/*.include"/>
<include name="**/*.manifest"/>
<include name="**/*.pp"/>
<include name="**/*.png"/>
<include name="**/*.rc"/>
<include name="**/*.reg"/>
<include name="**/*.resx"/>
<include name="**/*.rsp"/>
<include name="**/*.rtf"/>
<include name="**/*.Settings"/>
<include name="**/*.sln"/>
<include name="**/*.targets"/>
<include name="**/*.txt"/>
<include name="**/*.wixproj"/>
<include name="**/*.wxl"/>
<include name="**/*.wxs"/>
<include name="**/*.wxi"/>
<include name="**/*.vb"/>
<include name="**/*.vbproj"/>
<include name="**/*.vbs"/>
<include name="**/*.vcproj"/>
<include name="**/*.vjsproj"/>
<include name="**/*.vsdir"/>
<include name="**/*.vstemplate"/>
<include name="**/*.xsd"/>
<!-- Include particular paths verbatum -->
<include name="Library/**/*"/>
<include name="WebSiteFiles/**/*"/>
<!-- Skip the files we don't want that match one of the above extensions -->
<exclude name="**/*proj.FileList.txt"/>
<exclude name="Build/**/*"/>
<exclude name="Release/**/*"/>
<exclude name="Version/ver.wxi"/>
</fileset>
</zip>
</target>
<target name="release_files.clean">
<delete dir="${dir.target}"/>
</target>
<!-- === INSTALLER === -->
<target name="installer" depends="installer.msi,installer.bootstrapper"/>
<target name="installer.clean" depends="installer.msi.clean,installer.bootstrapper.clean"/>
<!-- === INSTALLER BOOTSTRAPPER === -->
<target name="installer.bootstrapper" depends="installer.msi">
<if test="${not file::exists(file.build.setup.exe) or
not file::up-to-date(file.build.msi, file.build.setup.exe) or
not file::up-to-date(dir.wixpath.bin + '\setup.exe', file.build.setup.exe)}">
<echo level="Info" message="Creating ${file.build.setup.exe}"/>
<exec program="setupbld.exe" basedir="${dir.wixpath.bin}" failonerror="true">
<arg value="-out"/>
<arg file="${file.build.setup.exe}"/>
<arg value="-mcus"/>
<arg file="${file.build.msi}"/>
<arg value="-setup"/>
<arg file="${dir.wixpath.bin}\setup.exe"/>
</exec>
</if>
</target>
<target name="installer.bootstrapper.clean">
<delete file="${file.build.setup.exe}"/>
</target>
<!-- === INSTALLER MSI === -->
<target name="installer.msi" depends="version_files,solution" description="Builds the installer MSI files">
<mkdir dir="${dir.install.build}"/>
<!-- Create a file set containing the list of source files -->
<fileset basedir="${dir.install}" id="wix_source_file_set">
<include name="*.wxs"/>
</fileset>
<!-- Compile each of the source files to object files -->
<foreach item="File" property="wix_source_file">
<in>
<items refid="wix_source_file_set"/>
</in>
<do>
<property name="wix_object_file" value="${path::combine(dir.install.build, path::get-file-name-without-extension(wix_source_file) + '.wixobj')}"/>
<exec program="candle.exe" basedir="${dir.wixpath.bin}" failonerror="true"
workingdir="${dir.install}"
unless="${file::up-to-date(wix_source_file, wix_object_file)}">
<arg value="-nologo"/>
<arg value='-dBuildDir="${dir.build}"'/>
<arg value='-dRootDir="${dir.root}"'/>
<arg value='-I"${dir.version}"'/>
<arg value='-ext "${dir.wixpath.bin}\WixUIExtension.dll"'/>
<arg value='-ext "${dir.wixpath.bin}\WixNetFxExtension.dll"'/>
<arg value='-out "${wix_object_file}"'/>
<arg file="${wix_source_file}"/>
</exec>
</do>
</foreach>
<!-- Define a file set containing the object files -->
<fileset basedir="${dir.install.build}" id="wix_object_file_set">
<include name="*.wixobj"/>
</fileset>
<!-- Create the parameter for light containing the list of object files -->
<property name="wix_object_file_list" value=""/>
<foreach item="File" property="wix_object_file">
<in>
<items refid="wix_object_file_set"/>
</in>
<do>
<property name="wix_object_file_list" value="${wix_object_file_list} ${wix_object_file}"/>
</do>
</foreach>
<!-- Determine if any dependant files have changed -->
<fileset id="target_msi_file_set">
<include name="${file.build.msi}"/>
</fileset>
<uptodate property="msi_uptodate.wix_objects">
<sourcefiles refid="wix_object_file_set"/>
<targetfiles refid="target_msi_file_set"/>
</uptodate>
<uptodate property="msi_uptodate.binaries">
<sourcefiles refid="binaries_file_set"/>
<targetfiles refid="target_msi_file_set"/>
</uptodate>
<uptodate property="msi_uptodate.docs">
<sourcefiles refid="docs_file_set"/>
<targetfiles refid="target_msi_file_set"/>
</uptodate>
<uptodate property="msi_uptodate.library">
<sourcefiles refid="library_file_set"/>
<targetfiles refid="target_msi_file_set"/>
</uptodate>
<!-- Link the object files together and build the MSI output file -->
<if test="${not (msi_uptodate.wix_objects and msi_uptodate.binaries and msi_uptodate.docs and msi_uptodate.library)}">
<echo level="Info" message="Creating ${file.build.msi}"/>
<exec program="light.exe" basedir="${dir.wixpath.bin}" failonerror="true"
workingdir="${dir.install}">
<arg value="-nologo"/>
<arg value="-cultures:en-US"/>
<arg value='-ext "${dir.wixpath.bin}\WixUIExtension.dll"'/>
<arg value='-ext "${dir.wixpath.bin}\WixNetFxExtension.dll"'/>
<arg value='-out "${file.build.msi}"'/>
<arg file="${wix_object_file_list}"/>
</exec>
<!-- Run SMOKE on the resulting MSI file and make sure everything is happy -->
<echo level="Info" message="Analyzing ${file.build.msi}"/>
<exec program="smoke.exe" basedir="${dir.wixpath.bin}" failonerror="true"
workingdir="${dir.install}">
<arg value="-nologo"/>
<arg value="-wx"/>
<arg value='"${file.build.msi}"'/>
</exec>
</if>
</target>
<target name="installer.msi.clean">
<delete>
<fileset basedir="${dir.install.build}">
<include name="*.wixobj"/>
</fileset>
</delete>
<delete file="${file.build.msi}"/>
<delete dir="${dir.install.build}"/>
</target>
<!-- === VISUAL STUDIO SOLUTION === -->
<target name="solution" depends="version_files" description="Builds the Visual Studio based solution using MSBuild">
<exec program="MSBuild.exe" basedir="${framework::get-framework-directory('net-3.5')}" failonerror="true">
<arg value="/nologo"/>
<arg value="/property:Configuration=Release" if="${flavor == 'ship'}"/>
<arg value="/property:Configuration=Debug" if="${flavor == 'debug'}"/>
<arg value="/target:Build"/>
<arg file="${dir.root}/SportsTacticsBoard.sln"/>
</exec>
</target>
<target name="solution.clean" description="Cleans the Visual Studio based solution using MSBuild">
<exec program="MSBuild.exe" basedir="${framework::get-framework-directory('net-3.5')}" failonerror="true">
<arg value="/nologo"/>
<arg value="/property:Configuration=Release" if="${flavor == 'ship'}"/>
<arg value="/property:Configuration=Debug" if="${flavor == 'debug'}"/>
<arg value="/target:Clean"/>
<arg file="${dir.root}/SportsTacticsBoard.sln"/>
</exec>
</target>
<!-- === CODE ANALYSIS === -->
<target name="analysis" depends="solution" description="Runs FxCop code analysis on the project">
<property name="file.fxcop.input" value="${dir.build}\SportsTacticsBoard.exe" readonly="true"/>
<property name="file.fxcop.output" value="${dir.build}\fxcop.xml" readonly="true"/>
<exec program="FxCopCmd.exe"
basedir="${dir.fxcoppath}"
failonerror="true"
if="${file::exists(dir.fxcoppath + '\FxCopCmd.exe') and not file::up-to-date(file.fxcop.input, file.fxcop.output)}">
<arg value="/file:${file.fxcop.input}"/>
<arg value="/out:${file.fxcop.output}"/>
<arg value="/forceoutput"/>
<arg value="/summary"/>
</exec>
</target>
<target name="analysis.clean">
<delete file="${dir.build}\fxcop.xml"/>
</target>
</project>