This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
forked from MegaMek/megameklab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packaging_local.xml
267 lines (224 loc) · 11.2 KB
/
packaging_local.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
<?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="localdir" value="localdev" />
<property name="util" value="packaging_utils" />
<property name="confdir" value="mmconf" />
<!-- same as builddir but under svn -->
<property name="localbuilddir" value="${localdir}/${builddir}" />
<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="localdev-init" depends="checkOSMac, checkOSWindows, checkOSUNIX">
<tstamp />
<delete dir="${localdir}" />
<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 localdev-* tasks get, build & package the current version from local sources -->
<target name="localdev-get" depends="localdev-init" description="get the local source">
<copy todir="${localdir}" encoding="UTF-8">
<fileset dir="${basedir}">
<exclude name="${localdir}" />
</fileset>
</copy>
</target>
<target name="localdev-build" depends="localdev-get" description="compile project from local source and generate JAR file" >
<mkdir dir="${localbuilddir}" />
<!-- compile -->
<echo message="MegaMekLab" />
<javac debug="true" debuglevel="lines,source" target="1.8" source="1.8" destdir="${localbuilddir}" srcdir="${localdir}/${srcdir}" memoryInitialSize="512m" memoryMaximumSize="1024m" fork="true" encoding="UTF-8">
<classpath>
<pathelement location="${localdir}" />
<fileset dir="${localdir}/${libdir}" includes="*.jar" />
<fileset dir="${localdir}" includes="MegaMek.jar" />
</classpath>
</javac>
<jar destfile="${localdir}/${jarfile}" basedir="${localbuilddir}" manifest="manifest.txt">
<fileset dir="${localdir}/${srcdir}" includes="**/*.properties"/>
<zipgroupfileset dir="${localdir}" includes="MegaMek.jar"/>
</jar>
<!-- Ensure that the log directory exists. -->
<mkdir dir="${localdir}/${logdir}" />
<touch file="${localdir}/${timestampfile}" />
</target>
<target name="localdev-clean" description="remove the local source build directory">
<delete dir="${localbuilddir}" />
<delete dir="${localdir}" />
</target>
<target name="mac-bundle" description="Bundle the project built from local source into an Mac OSX distribution">
<mkdir dir="${osxdist}" />
<copy todir="${osxdist}" encoding="UTF-8">
<fileset dir="${localdir}" >
<include name="${jarfile}" />
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="${confdir}/" />
</fileset>
</copy>
<jarbundler
dir="${osxdist}"
name="MegaMek"
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="${localdir}">
<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 local source" />
<target name="nix-bundle" description="Bundle the project built from local source into a unix distribution">
<mkdir dir="${nixdist}" />
<mkdir dir="${nixdist}/${nixdist}" />
<copy todir="${nixdist}/${nixdist}" encoding="UTF-8">
<fileset dir="${localdir}" >
<include name="${libdir}/*.jar" />
<include name="${jarfile}" />
<include name="${logdir}/" />
<include name="${datadir}/" />
<include name="${docdir}/" />
<include name="${confdir}/" />
</fileset>
</copy>
<fixcrlf srcdir="${nixdist}" eol="lf">
<include name="**/*.sh"/>
</fixcrlf>
</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 local source"/>
<!-- Produce an EXE file -->
<target name="exe" description="Generate an EXE wrappers for MegaMekLab.jar">
<launch4j configFile="${util}/megameklab.4j_local.xml" />
</target>
<target name="win-bundle" depends="exe" description="Bundle the project built from local source into a Windows distribution">
<mkdir dir="${windist}" />
<copy todir="${windist}" encoding="UTF-8">
<fileset dir="${localdir}" >
<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 local source"/>
<target name="source-package" description="Package a source-only distribution of the project built from local source">
<mkdir dir="${srcdist}" />
<mkdir dir="${srcdist}/${srcdist}" />
<copy todir="${srcdist}/${srcdist}" encoding="UTF-8">
<fileset dir="${localdir}" >
<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="localdev-build, mac-package, nix-package, win-package, source-package, localdev-clean" description="Build the project from local source and package it as Windows, Mac, Unix, and source-only" />
<target name="mac-release" depends="localdev-build, mac-package, localdev-clean" description="Build the project from local source and package it as Mac" />
<target name="win-release" depends="localdev-build, win-package, localdev-clean" description="Build the project from local source and package it as Windows" />
<target name="nix-release" depends="localdev-build, nix-package, localdev-clean" description="Build the project from local source and package it as Unix" />
<target name="src-release" depends="localdev-build, source-package, localdev-clean" description="Build the project from local source and package it as source-only" />
</project>