forked from MegaMek/megameklab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packaging.xml
307 lines (263 loc) · 14 KB
/
packaging.xml
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
<?xml version="1.0"?>
<!-- Author: Jay Lawson -->
<!-- This is a packaging build file for MegaMekLab 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 -->
<!-- Unlike the packaging routine for MHQ, we will not package a separate -->
<!-- executable MegaMek copy in the OSX and Windows version, but rather -->
<!-- "bundle" it into the MML.jar. This is -->
<!-- to discourage users from trying to "update" their MM.jar which -->
<!-- can cause problems. So The MML executable can still be put into a -->
<!-- megamek directory to take advantage of existing mechfiles, fluff -->
<!-- images and the like, but it will not utilize the MM.jar that is -->
<!-- contained in that directory. -->
<project default="release" name="MegaMekLab" basedir=".">
<!-- Global properties for this build -->
<!-- Version and packaging properties -->
<property name="project.name" value="megameklab" />
<property name="srcdir" value="src" />
<property name="logdir" value="logs" />
<property name="builddir" value="classes" />
<property name="libdir" value="lib" />
<property name="datadir" value="data" />
<property name="docdir" value="docs" />
<property name="pkgdir" value="pkgdir" />
<property name="mm-pkgdir" value="mm-pkgdir" />
<property name="util" value="packaging_utils" />
<property name="confdir" value="mmconf" />
<!-- same as builddir but under git -->
<property name="pkgbuilddir" value="${pkgdir}/${builddir}" />
<!-- gitroot used for git authentification -->
<property name="gitroot" value="https://github.com/MegaMek/megameklab.git" />
<property name="mm-gitroot" value="https://github.com/MegaMek/megamek.git" />
<property name="timestampfile" value="${logdir}/timestamp" />
<!-- Name of the target jarfile and the class containing the main-Method -->
<property name="jarfile" value="MegaMekLab.jar" />
<property name="jarmainclass" value="megameklab.com.MegaMekLab" />
<!-- 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="com.ultramixer.jarbundler.JarBundler" classpath="${util}/jarbundler-core-3.3.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 Windows then we use the launch4j for Windows -->
<target name="checkOSWindows" if="isOsWindows">
<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="pkgdir-init" depends="checkOSMac, checkOSWindows, checkOSUNIX">
<tstamp />
<delete dir="${pkgdir}" />
<delete dir="${mm-pkgdir}" />
<delete dir="${mml-pkgdir}" />
<input message="Please enter version number (eg. 0.1.22):" addproperty="version"/>
<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" />
</target>
<!-- following pkgdir-* tasks get, build & package the current version from git -->
<target name="pkgdir-get" depends="pkgdir-init" description="get the latest source from git">
<exec executable="git">
<arg line="clone --single-branch ${gitroot} ${pkgdir}" />
</exec>
<exec executable="git">
<arg line="clone ${mm-gitroot} ${mm-pkgdir}" />
</exec>
<copy todir="${pkgdir}/${datadir}/" encoding="UTF-8">
<fileset dir="${mm-pkgdir}/megamek/data">
<include name="mechfiles/" />
</fileset>
</copy>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/battlearmor.zip" basedir="${pkgdir}/${datadir}/mechfiles/battlearmor"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/convfighter.zip" basedir="${pkgdir}/${datadir}/mechfiles/convfighter"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/dropships.zip" basedir="${pkgdir}/${datadir}/mechfiles/dropships"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/fighters.zip" basedir="${pkgdir}/${datadir}/mechfiles/fighters"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/ge.zip" basedir="${pkgdir}/${datadir}/mechfiles/ge"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/infantry.zip" basedir="${pkgdir}/${datadir}/mechfiles/infantry"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/jumpships.zip" basedir="${pkgdir}/${datadir}/mechfiles/jumpships"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/mechs.zip" basedir="${pkgdir}/${datadir}/mechfiles/mechs"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/protomechs.zip" basedir="${pkgdir}/${datadir}/mechfiles/protomechs"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/smallcraft.zip" basedir="${pkgdir}/${datadir}/mechfiles/smallcraft"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/spacestation.zip" basedir="${pkgdir}/${datadir}/mechfiles/spacestation"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/unofficial.zip" basedir="${pkgdir}/${datadir}/mechfiles/unofficial"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/vehicles.zip" basedir="${pkgdir}/${datadir}/mechfiles/vehicles"/>
<zip zipfile="${pkgdir}/${datadir}/mechfiles/warship.zip" basedir="${pkgdir}/${datadir}/mechfiles/warship"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/battlearmor"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/convfighter"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/dropship"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/fighters"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/ge"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/infantry"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/jumpships"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/mechs"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/protomechs"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/smallcraft"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/spacestation"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/unofficial"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/vehicles"/>
<delete dir="${pkgdir}/${datadir}/mechfiles/warship"/>
</target>
<target name="pkgdir-build" depends="pkgdir-get" description="compile project from git and generate JAR file" >
<mkdir dir="${pkgbuilddir}" />
<!-- compile -->
<echo message="MegaMekLab" />
<javac debug="true" debuglevel="lines,source" target="1.8" source="1.8" destdir="${pkgbuilddir}" srcdir="${pkgdir}/${srcdir}" memoryInitialSize="512m" memoryMaximumSize="1024m" fork="true" encoding="UTF-8">
<classpath>
<pathelement location="${pkgdir}" />
<fileset dir="${pkgdir}/${libdir}" includes="*.jar" />
<fileset dir="${pkgdir}" includes="MegaMek.jar" />
</classpath>
</javac>
<jar basedir="${pkgbuilddir}" jarfile="${pkgdir}/${jarfile}" manifest="manifest.txt">
<fileset dir="${pkgdir}/${srcdir}" includes="**/*.properties"/>
<zipgroupfileset dir="${pkgdir}" includes="MegaMek.jar"/>
</jar>
<!-- Ensure that the log directory exists. -->
<mkdir dir="${pkgdir}/${logdir}" />
<touch file="${pkgdir}/${timestampfile}" />
</target>
<target name="pkgdir-clean" description="remove the git build directory">
<delete dir="${pkgbuilddir}" />
<delete dir="${pkgdir}" />
<delete dir="${mm-pkgdir}" />
</target>
<target name="mac-bundle" description="Bundle the project built from git into an Mac OSX distribution">
<mkdir dir="${osxdist}" />
<copy todir="${osxdist}" encoding="UTF-8">
<fileset dir="${pkgdir}" >
<include name="${jarfile}" />
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="${confdir}/" />
</fileset>
</copy>
<jarbundler
dir="${osxdist}"
name="MegaMekLab"
mainclass="megameklab.com.MegaMekLab"
stubfile="packaging_utils/JavaApplicationStub"
icon="data/images/misc/megameklab.icns"
workingdirectory="$APP_PACKAGE/../"
useJavaXKey="true"
jvmversion="1.8+"
version="${version}"
vmoptions="-Xmx1024m">
<jarfileset dir="${pkgdir}">
<include name="**/*.jar" />
<exclude name="${util}/" />
</jarfileset>
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
<javaproperty name="apple.awt.brushMetal" value="true" />
</jarbundler>
</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}/MegaMekLab.app/Contents/MacOS/JavaApplicationStub" />
<exec executable="ln">
<arg line="-s /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub" />
<arg value="${osxdist}/MegaMekLab.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 git" />
<target name="nix-bundle" description="Bundle the project built from git into a unix distribution">
<mkdir dir="${nixdist}" />
<mkdir dir="${nixdist}/${nixdist}" />
<copy todir="${nixdist}/${nixdist}" encoding="UTF-8">
<fileset dir="${pkgdir}" >
<include name="${jarfile}" />
<include name="${libdir}/*.jar" />
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="${confdir}/" />
<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 git"/>
<!-- Produce an EXE file -->
<target name="exe" description="Generate an EXE wrappers for MegaMekLab.jar">
<launch4j configFile="${util}/megameklab.4j.xml" />
</target>
<target name="win-bundle" depends="exe" description="Bundle the project built from git into a Windows distribution">
<mkdir dir="${windist}" />
<copy todir="${windist}" encoding="UTF-8">
<fileset dir="${pkgdir}" >
<include name="${libdir}/*.jar" />
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="MegaMekLab.exe" />
<include name="${confdir}/" />
</fileset>
</copy>
<copy file="${util}/megameklab.l4j.ini" todir="${windist}" encoding="UTF-8"/>
</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}" />
</target>
<target name="win-package" depends="win-bundle, win-zip, win-clean" description="Package a Windows distribution of the project built from git"/>
<target name="source-package" description="Package a source-only distribution of the project built from git">
<mkdir dir="${srcdist}" />
<mkdir dir="${srcdist}/${srcdist}" />
<copy todir="${srcdist}/${srcdist}" encoding="UTF-8">
<fileset dir="${pkgdir}" >
<exclude name="${builddir}/**"/>
<exclude name="MegaMekLab.jar"/>
<exclude name="MegaMekLab.exe"/>
</fileset>
</copy>
<tar destfile="${srcdist}.tar.gz" basedir="${srcdist}" compression="gzip" longfile="gnu">
</tar>
<delete dir="${srcdist}" />
</target>
<target name="release" depends="pkgdir-build, mac-package, nix-package, win-package, source-package, pkgdir-clean" description="Build the project from git and package it as Windows, Mac, Unix, and source-only" />
<target name="mac-release" depends="pkgdir-build, mac-package, pkgdir-clean" description="Build the project from local source and package it as Mac" />
<target name="win-release" depends="pkgdir-build, win-package, pkgdir-clean" description="Build the project from local source and package it as Windows" />
<target name="nix-release" depends="pkgdir-build, nix-package, pkgdir-clean" description="Build the project from local source and package it as Unix" />
<target name="src-release" depends="pkgdir-build, source-package, pkgdir-clean" description="Build the project from local source and package it as source-only" />
</project>