[go: up one dir, main page]

Menu

[a38bb2]: / packaging.xml  Maximize  Restore  History

Download this file

329 lines (288 with data), 13.3 kB

  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
<?xml version="1.0"?>
<!-- Author: Jay Lawson -->
<!-- This is a packaging build file for MekHQ that will package -->
<!-- the following OS-specific releases. -->
<!-- a) An OS X bundled release -->
<!-- b) A Windows release with the EXE file using launch4j -->
<!-- c) A "unix" release containing only jars -->
<!-- d) A source-file only release to comply with GPL -->
<!-- Originally, the OS release was bundled with jarbundler, but I am -->
<!-- now using a pre-packaged set of app directories that we just -->
<!-- copy the newest jar files into. This allows for easier cutomization -->
<!-- of the pinfo.list file to get the classpath to all of the jars -->
<!-- correct. At the moment, I can't figure out how to get a classpath -->
<!-- to the wrapped executable in the launch4j program so MM and MML -->
<!-- in the windows release don't wrap the jar files but we do put them -->
<!-- in the lib folder to keep them out of sight -->
<project default="release" name="MekHQ" basedir=".">
<!-- Global properties for this build -->
<!-- Version and packaging properties -->
<property name="project.name" value="mekhq" />
<property name="version" value="0.3.1"/>
<property name="osxdist" value="${project.name}-${version}-mac" />
<property name="windist" value="${project.name}-${version}-windows" />
<property name="nixdist" value="${project.name}-${version}" />
<property name="srcdist" value="${project.name}-${version}-source" />
<property name="srcdir" value="src" />
<property name="confdir" value="mmconf" />
<property name="logdir" value="logs" />
<property name="builddir" value="classes" />
<property name="libdir" value="lib" />
<property name="datadir" value="data" />
<property name="apidocsdir" value="apidocs" />
<property name="docdir" value="docs" />
<property name="svndir" value="svndev" />
<property name="util" value="packaging_utils" />
<!-- same as builddir but under svn -->
<property name="svnbuilddir" value="${svndir}/${builddir}" />
<!-- svnroot used for svn authentification -->
<property name="svnroot" value="svn://svn.code.sf.net/p/mekhq/code/trunk/MekHQ" />
<property name="svndata" value="svn://svn.code.sf.net/p/megamek/code/trunk/megamek/data" />
<property name="svnrsheets" value="svn://svn.code.sf.net/p/megameklab/code/trunk/data/images/recordsheets" />
<property name="timestampfile" value="${logdir}/timestamp" />
<property name="TinyXMLsrc" value="TinyXML07-src.zip" />
<!-- Name of the target jarfile and the class containing the main-Method -->
<property name="jarfile" value="MekHQ.jar" />
<property name="jarmainclass" value="mekhq.MekHQ" />
<!-- This is the relative path to the 'data' directory -->
<property name="dataclasspath" value="." />
<condition property="isOsUnixLike">
<os family="unix" />
</condition>
<condition property="isOsWindows">
<os family="windows" />
</condition>
<condition property="isOsUnixNotMac">
<and>
<os family="unix" />
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="isOsMac">
<os family="mac" />
</condition>
<taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" classpath="${util}/jarbundler-2.1.0.jar"/>
<!-- if we're using a Mac then we'll use the launch4j for Mac OS -->
<target name="checkOSMac" if="isOsMac">
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${util}/launch4j/launch4j.jar:${util}/launch4j/lib/xstream.jar" />
</target>
<!-- if we're using UNIX or Linux then we'll use the launch4j for Linux -->
<target name="checkOSUNIX" if="isOsUnixNotMac">
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${util}/linux/launch4j/launch4j.jar:${util}/linux/launch4j/lib/xstream.jar" />
</target>
<target name="svndev-init" depends="checkOSMac, checkOSUNIX">
<tstamp />
<delete dir="${svndir}" />
</target>
<!-- following svndev-* tasks get, build & package the current version from svn -->
<target name="svndev-get" depends="svndev-init" description="get the latest source from SVN">
<exec executable="svn">
<arg line="export ${svnroot} ${svndir}" />
</exec>
<!--now we need to replace our data with the latest from the MM svn
but first we need to back it up because we will need to keep a few
things-->
<move file="${svndir}/${datadir}" tofile="${svndir}/${datadir}-OLD"/>
<exec executable="svn">
<arg line="export ${svndata} ${svndir}/${datadir}" />
</exec>
<!-- now add in record sheet vector images-->
<exec executable="svn">
<arg line="export ${svnrsheets} ${svndir}/${datadir}/images/recordsheets" />
</exec>
<!-- ok now move some stuff back into data that needs to be there-->
<copy todir="${svndir}/${datadir}">
<fileset dir="${svndir}/${datadir}-OLD" >
<include name="universe/" />
<include name="fonts/" />
<include name="images/force/" />
<include name="images/portraits/FoxsTeeth/" />
<include name="images/fluff/mech/*.png" />
<include name="images/misc/mekhq-load.png" />
<include name="images/misc/mekhq-splash.png" />
<include name="images/misc/tools.png" />
</fileset>
</copy>
<delete dir="${svndir}/${datadir}-OLD" />
</target>
<target name="svndev-build" depends="svndev-get" description="compile project from SVN and generate JAR file" >
<mkdir dir="${svnbuilddir}" />
<!-- compile -->
<echo message="MekHQ" />
<javac debug="true" debuglevel="lines,source" target="1.5" source="1.5" destdir="${svnbuilddir}" srcdir="${svndir}/${srcdir}" memoryInitialSize="512m" memoryMaximumSize="512m" fork="true">
<classpath>
<pathelement location="${svndir}" />
<fileset dir="${svndir}/${libdir}" includes="*.jar" />
<fileset dir="${svndir}" includes="MegaMek.jar" />
<fileset dir="${svndir}" includes="MegaMekLab.jar" />
</classpath>
</javac>
<!-- jar -->
<jar basedir="${svnbuilddir}" jarfile="${svndir}/${jarfile}" manifest="manifest.txt">
<fileset dir="${svndir}/${srcdir}" includes="**/*.properties"/>
</jar>
<!-- Ensure that the log directory exists. -->
<mkdir dir="${svndir}/${logdir}" />
<touch file="${svndir}/${timestampfile}" />
</target>
<target name="svndev-clean" description="remove the SVN build directory">
<delete dir="${svnbuilddir}" />
</target>
<target name="mac-bundle" description="Bundle the project built from SVN into an Mac OSX distribution">
<mkdir dir="${osxdist}" />
<copy todir="${osxdist}">
<fileset dir="${svndir}" >
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="${confdir}/" />
<include name="campaigns/" />
<include name="campaigns/FoxsTeeth.cpnx" />
<include name="*README.html" />
<include name="SubmitBug.html" />
<include name="license.txt" />
</fileset>
</copy>
<mkdir dir="${osxdist}/MegaMek.app" />
<copy todir="${osxdist}/MegaMek.app">
<fileset dir="${util}/MegaMek.app" >
<include name="**/*"/>
</fileset>
</copy>
<copy file="${util}/JavaApplicationStub" todir="${osxdist}/MegaMek.app/Contents/MacOS/"/>
<mkdir dir="${osxdist}/MegaMekLab.app" />
<copy todir="${osxdist}/MegaMekLab.app">
<fileset dir="${util}/MegaMekLab.app" >
<include name="**/*"/>
</fileset>
</copy>
<copy file="${util}/JavaApplicationStub" todir="${osxdist}/MegaMekLab.app/Contents/MacOS/"/>
<mkdir dir="${osxdist}/MekHQ.app" />
<copy todir="${osxdist}/MekHQ.app">
<fileset dir="${util}/MekHQ.app" >
<include name="**/*"/>
</fileset>
</copy>
<copy file="${util}/JavaApplicationStub" todir="${osxdist}/MekHQ.app/Contents/MacOS/"/>
<copy todir="${osxdist}/MekHQ.app/Contents/Resources/Java/">
<fileset dir="${svndir}" >
<include name="${libdir}/*.jar" />
<include name="${jarfile}" />
<include name="MegaMekLab.jar" />
<include name="MegaMek.jar" />
</fileset>
</copy>
</target>
<!-- Replace actual stubs with symlinks on mac systems -->
<target name="mac-stub" if="isOsMac" description="Create a dmg file from the OS X distribution (NOTE: only works on OSX)">
<delete file="${osxdist}/MekHQ.app/Contents/MacOS/JavaApplicationStub" />
<exec executable="ln">
<arg line="-s /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub" />
<arg value="${osxdist}/MekHQ.app/Contents/MacOS/JavaApplicationStub" />
</exec>
<delete file="${osxdist}/MegaMek.app/Contents/MacOS/JavaApplicationStub" />
<exec executable="ln">
<arg line="-s /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub" />
<arg value="${osxdist}/MegaMek.app/Contents/MacOS/JavaApplicationStub" />
</exec>
</target>
<target name="mac-zip">
<tar destfile="${osxdist}.tar.bz2" compression="bzip2" longfile="gnu">
<tarfileset dir="${osxdist}" mode="755" />
</tar>
</target>
<target name="mac-tar" depends="mac-stub,mac-zip" description="Create a compressed tar file of the OS X distribution"/>
<target name="mac-clean">
<delete dir="${osxdist}" />
</target>
<target name="mac-package" depends="mac-bundle, mac-tar, mac-clean" description="Package a Mac OS X distribution of the project built from SVN" />
<target name="nix-bundle" description="Bundle the project built from SVN into a unix distribution">
<mkdir dir="${nixdist}" />
<mkdir dir="${nixdist}/${nixdist}" />
<copy todir="${nixdist}/${nixdist}">
<fileset dir="${svndir}" >
<include name="${jarfile}" />
<include name="${libdir}/*.jar" />
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="${confdir}/" />
<include name="campaigns/" />
<include name="campaigns/FoxsTeeth.cpnx" />
<include name="MegaMek.jar" />
<include name="MegaMekLab.jar" />
<include name="*README.html" />
<include name="SubmitBug.html" />
<include name="license.txt" />
<include name="*.sh" />
</fileset>
</copy>
</target>
<target name="nix-tar" description="Create a compressed tar file of the unix distribution">
<tar destfile="${nixdist}.tar.gz" basedir="${nixdist}" compression="gzip" longfile="gnu" />
</target>
<target name="nix-clean">
<delete dir="${nixdist}" />
</target>
<target name="nix-package" depends="nix-bundle, nix-tar, nix-clean" description="Package a Unix distribution of the project built from SVN"/>
<!-- Produce an EXE file -->
<target name="exe" description="Generate an EXE wrappers for MekHQ.jar, MegaMek.jar, and MegaMekLab.jar">
<copy file="${svndir}/MegaMek.jar" tofile="${svndir}/lib/MegaMek.jar"/>
<copy file="${svndir}/MegaMekLab.jar" tofile="${svndir}/lib/MegaMekLab.jar"/>
<delete file="${svndir}/MekHQ.exe"/>
<launch4j configFile="${util}/mekhq.4j.xml" />
<delete file="${svndir}/MegaMek.exe"/>
<launch4j configFile="${util}/megamek.4j.xml" />
<delete file="${svndir}/MegaMekLab.exe"/>
<launch4j configFile="${util}/megameklab.4j.xml" />
</target>
<target name="win-bundle" depends="exe" description="Bundle the project built from SVN into a Windows distribution">
<mkdir dir="${windist}" />
<copy todir="${windist}">
<fileset dir="${svndir}" >
<include name="${libdir}/*.jar" />
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="${confdir}/" />
<include name="campaigns/" />
<include name="campaigns/FoxsTeeth.cpnx" />
<!--<include name="MegaMek.jar" />
<include name="MegaMekLab.jar" />-->
<include name="MegaMek.exe" />
<include name="MegaMekLab.exe" />
<include name="MekHQ.exe" />
<include name="*README.html" />
<include name="SubmitBug.html" />
<include name="license.txt" />
</fileset>
</copy>
<copy file="${util}/mekhq.l4j.ini" todir="${windist}"/>
</target>
<target name="win-zip" description="Create a zipfile of the Windows distribution">
<zip zipfile="${basedir}/${windist}.zip" basedir="${windist}" />
</target>
<target name="win-clean">
<delete dir="${windist}" />
<delete file="${svndir}/lib/MegaMek.jar" />
<delete file="${svndir}/lib/MegaMekLab.jar" />
</target>
<target name="win-package" depends="win-bundle, win-zip, win-clean" description="Package a Windows distribution of the project built from SVN"/>
<target name="source-package" description="Package a source-only distribution of the project built from SVN">
<mkdir dir="${srcdist}" />
<mkdir dir="${srcdist}/${srcdist}" />
<copy todir="${srcdist}/${srcdist}">
<fileset dir="${svndir}" >
<exclude name="${builddir}/**"/>
<exclude name="MekHQ.jar"/>
<exclude name="**/*.exe"/>
</fileset>
</copy>
<tar destfile="${srcdist}.tar.gz" basedir="${srcdist}" compression="gzip" longfile="gnu">
</tar>
<delete dir="${srcdist}" />
</target>
<target name="release" depends="svndev-build, mac-package, nix-package, win-package, source-package, svndev-clean" description="Build the project from SVN and package it as Windows, Mac, Unix, and source-only" />
</project>