-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
333 lines (303 loc) · 14.2 KB
/
build.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
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
<?xml version="1.0"?>
<project name="Simidude Build script" default="installer">
<property name="os" value="win32" />
<property environment="env" />
<property file="localbuild.properties" />
<property file="build.properties" />
<property name="prj.dir" location="${basedir}" />
<property name="prj.build.dir" location="${prj.dir}/build" />
<property name="prj.src.dir" location="${prj.dir}/src" />
<property name="prj.src.java.dir" location="${prj.dir}/src/java" />
<property name="prj.src.test.dir" location="${prj.dir}/src/test" />
<property name="prj.lib.dir" location="${prj.dir}/lib" />
<property name="prj.target.dir" location="${prj.dir}/target" />
<property name="prj.target.classes.java.dir" location="${prj.target.dir}/classes/java" />
<property name="prj.target.classes.test.dir" location="${prj.target.dir}/classes/test" />
<property name="prj.target.dist.base" location="${prj.target.dir}/distribution" />
<property name="prj.target.dist.installer" location="${prj.target.dist.base}/installer" />
<property name="prj.target.dist.dir" location="${prj.target.dist.base}/${app.name}" />
<property name="prj.target.dist.bin.dir" location="${prj.target.dist.dir}/bin" />
<property name="prj.target.dist.lib.dir" location="${prj.target.dist.dir}/lib" />
<property name="prj.target.dist.etc.dir" location="${prj.target.dist.dir}/etc" />
<property name="prj.target.osx.name.dir" value="${app.name}.app" />
<property name="prj.target.osx.contents.dir" value="${prj.target.osx.name.dir}/Contents" />
<property name="prj.target.test.dir" location="${prj.target.dir}/test" />
<property name="prj.target.report.dir" location="${prj.target.dir}/reports" />
<property name="prj.target.junit.dir" location="${prj.target.report.dir}/junit"/>
<property name="prj.target.javadoc.dir" location="${prj.target.report.dir}/javadoc"/>
<path id="build.classpath">
<fileset dir="${prj.build.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="compile.classpath">
<fileset dir="${prj.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${prj.lib.dir}/not_for_installer">
<include name="*.jar"/>
</fileset>
<fileset dir="${prj.lib.dir}/win32">
<include name="*.jar"/>
</fileset>
<fileset dir="${prj.lib.dir}/linux_x86">
<include name="*.jar"/>
</fileset>
<fileset dir="${prj.lib.dir}/osx_x86">
<include name="*.jar"/>
</fileset>
</path>
<taskdef resource="proguard/ant/task.properties" classpathref="build.classpath" />
<taskdef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="build.classpath"/>
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpathref="build.classpath"/>
<taskdef name="install4j" classname="com.install4j.Install4JTask" classpath="${install4j.ant.task.path}"/>
<target name="init">
<mkdir dir="${prj.target.dir}"/>
<mkdir dir="${prj.target.dir}/license"/>
<mkdir dir="${prj.target.classes.java.dir}"/>
<mkdir dir="${prj.target.classes.test.dir}"/>
<mkdir dir="${prj.target.dist.dir}"/>
<mkdir dir="${prj.target.dist.bin.dir}"/>
<mkdir dir="${prj.target.dist.lib.dir}"/>
<mkdir dir="${prj.target.dist.etc.dir}"/>
<mkdir dir="${prj.target.test.dir}"/>
<mkdir dir="${prj.target.report.dir}"/>
</target>
<target name="compile" depends="init" description="Compiling Simidude source">
<javac srcdir="${prj.src.java.dir}" destdir="${prj.target.classes.java.dir}"
debug="true" deprecation="on" source="1.5" target="1.5">
<classpath refid="compile.classpath" />
</javac>
<copy todir="${prj.target.classes.java.dir}">
<fileset dir="${prj.src.java.dir}" excludes="**/*.java,**/package.html"/>
</copy>
</target>
<target name="compile-test" depends="init">
<javac srcdir="${prj.src.test.dir}" destdir="${prj.target.classes.test.dir}" debug="false" deprecation="on" source="1.5" target="1.5">
<classpath refid="compile.classpath" />
<classpath refid="build.additional.classpath" />
<classpath>
<pathelement location="${prj.target.classes.java.dir}"/>
</classpath>
</javac>
<copy todir="${prj.target.classes.test.dir}">
<fileset dir="${prj.src.test.dir}">
<filename name="**/*.xml"/>
</fileset>
</copy>
</target>
<target name="jar" depends="compile" description="Create Jars" >
<jar jarfile="${prj.target.dist.lib.dir}/simidude-naked.jar" basedir="${prj.target.classes.java.dir}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Time" value="${build.time}"/>
<attribute name="Main-Class" value="com.agynamix.simidude.Simidude" />
<attribute name="Class-Path" value="${lib.project.manifest.classpath}"/>
<section name="com.agynamix.simidude">
<attribute name="Specification-Title" value="${app.name}"/>
<attribute name="Specification-Vendor" value="${app.company.name}"/>
<attribute name="Specification-Version" value="${app.version}"/>
<attribute name="Implementation-Title" value="${app.name}"/>
<attribute name="Implementation-Vendor" value="${app.vendor}"/>
<attribute name="Implementation-Version" value="${app.version}"/>
</section>
</manifest>
</jar>
</target>
<target name="dist" depends="obfuscate" description="Creating distribution package">
<tstamp>
<format property="build.time" pattern="yyyy-MM-dd HH:mm:ss" locale="en"/>
</tstamp>
<copy todir="${prj.target.dist.lib.dir}" failonerror="true">
<fileset dir="${prj.lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.dll"/>
<include name="**/*.lic"/>
</fileset>
</copy>
<copy todir="${prj.target.dist.etc.dir}" failonerror="true">
<fileset dir="${prj.dir}/etc">
</fileset>
</copy>
<copy todir="${prj.target.dist.dir}/licenses" failonerror="true">
<fileset dir="${prj.dir}/doc/licenses">
</fileset>
</copy>
<copy tofile="${prj.target.dist.dir}/licenses/simidude-license.txt" failonerror="true" file="${prj.dir}/etc/license.txt" />
<copy todir="${prj.target.dist.dir}" failonerror="true" file="${prj.dir}/doc/Simidude User Manual.pdf" />
<!--
<svn javahl="false">
<wcVersion path="${basedir}" prefix="svn." />
</svn>
-->
<buildnumber file="${prj.build.dir}/etc/build.number"/>
<echo file="${prj.target.dist.etc.dir}/appinfo.txt" append="false">Application-Name=${app.name}
Application-Version=${app.version}
Application-Years=${app.years}
Company-Name=${app.company.name}
Company-Email=${app.company.email}
Company-WWW=${app.company.www}
Company-Order-Url=${app.company.order_url}
Repository-Revision=${svn.revision.max}
Build-Number=${build.number}
Build-Time=${build.time}
</echo>
<zip destfile="${prj.target.dist.base}/Simidude-${app.version}-win32.zip" update="false">
<zipfileset dir="${prj.target.dist.base}">
<include name="Simidude/etc/**"/>
<include name="Simidude/lib/*.jar"/>
<include name="Simidude/lib/win32/*.jar"/>
<exclude name="Simidude/etc/private-key.bin" />
</zipfileset>
</zip>
<zip destfile="${prj.target.dist.base}/Simidude-${app.version}-linux_x86.zip" update="false">
<zipfileset dir="${prj.target.dist.base}">
<include name="Simidude/etc/**"/>
<include name="Simidude/lib/*.jar"/>
<include name="Simidude/lib/linux_x86/*.jar"/>
<exclude name="Simidude/etc/private-key.bin" />
</zipfileset>
</zip>
<zip destfile="${prj.target.dist.base}/Simidude-${app.version}-osx_x86.zip" update="false">
<zipfileset dir="${prj.target.dist.base}">
<include name="Simidude/etc/**"/>
<include name="Simidude/lib/*.jar"/>
<include name="Simidude/lib/osx_x86/*.jar"/>
<exclude name="Simidude/etc/private-key.bin" />
</zipfileset>
</zip>
</target>
<target name="obfuscate" depends="jar">
<!--<proguard configuration="${prj.build.dir}/etc/obfuscator.pro"/>-->
<copy tofile="${prj.target.dist.lib.dir}/simidude.jar" file="${prj.target.dist.lib.dir}/simidude-naked.jar" />
<delete file="${prj.target.dist.lib.dir}/simidude-naked.jar" />
</target>
<target name="osx_bundle" depends="dist">
<!-- setup -->
<mkdir dir="${prj.target.dist.base}/${prj.target.osx.name.dir}" />
<!-- build required directory structure -->
<mkdir dir="${prj.target.dist.base}/${prj.target.osx.contents.dir}/MacOS" />
<mkdir dir="${prj.target.dist.base}/${prj.target.osx.contents.dir}/Resources/Java" />
<!-- copy resources -->
<copy todir="${prj.target.dist.base}/${prj.target.osx.contents.dir}" >
<fileset dir="${prj.build.dir}/resources/macosx/">
<include name="Info.plist"/>
<include name="PkgInfo" />
</fileset>
</copy>
<copy file="${prj.build.dir}/resources/macosx/Simidude.icns" todir="${prj.target.dist.base}/${prj.target.osx.contents.dir}/Resources" />
<copy file="${prj.build.dir}/resources/macosx/JavaApplicationStub" todir="${prj.target.dist.base}/${prj.target.osx.contents.dir}/MacOS" />
<exec executable="chmod">
<arg value="755"/>
<arg value="${prj.target.dist.base}/${prj.target.osx.contents.dir}/MacOS/JavaApplicationStub"/>
</exec>
<!-- now our compiled app & libs -->
<copy todir="${prj.target.dist.base}/${prj.target.osx.contents.dir}/Resources/Java" >
<fileset dir="${prj.target.dist.lib.dir}" >
<include name="*.jar" />
</fileset>
</copy>
</target>
<target name="installer" depends="dist" description="Create install4j installers">
<echo message="Create all installers"/>
<condition property="update.url" value="${update.url.test}" else="${update.url.release}">
<isset property="build.test"/>
</condition>
<install4j projectfile="${prj.build.dir}/etc/installer.install4j" release="${app.version}">
<variable name="APP.VERSION" value="${app.version}"/>
<variable name="Update.Url" value="${update.url}" />
</install4j>
<tstamp>
<format property="release.notes.url.year" pattern="yyyy" locale="en"/>
</tstamp>
<property name="release.notes.url" value="http://www.agynamix.de/blog/simidude-${app.version.url}-release-notes/"></property>
<xmltask source="${prj.target.dist.installer}/updates.xml" dest="${prj.target.dist.installer}/updates.xml">
<insert path="/updateDescriptor/entry/comment" xml="<![CDATA[
<html>
<body>
<h3>${app.name} ${app.version} Release Notes</h3>
<p>For detailed information please see our <a href="${release.notes.url}">${app.name} ${app.version} Release Notes</a> web page.</p>
</body>
</html>
]]>"/>
</xmltask>
<echo message="updates.xml file updated" />
<echo message="Update-URL: ${update.url}"/>
<echo message="Release Notes URL = ${release.notes.url}" />
</target>
<target name="all" description="Creates installers for all available platforms">
<antcall target="dist">
<param name="os" value="win32"/>
<param name="prj.target.dist.base" location="${prj.target.dir}/distribution/${os}" />
<param name="prj.target.dist.dir" location="${prj.target.dist.base}/${app.name}" />
<param name="prj.target.dist.lib.dir" location="${prj.target.dist.dir}/lib" />
<param name="prj.target.dist.etc.dir" location="${prj.target.dist.dir}/etc" />
</antcall>
<antcall target="dist">
<param name="os" value="linux_x86"/>
<param name="prj.target.dist.base" location="${prj.target.dir}/distribution/${os}" />
<param name="prj.target.dist.dir" location="${prj.target.dist.base}/${app.name}" />
<param name="prj.target.dist.lib.dir" location="${prj.target.dist.dir}/lib" />
<param name="prj.target.dist.etc.dir" location="${prj.target.dist.dir}/etc" />
</antcall>
<antcall target="dist">
<param name="os" value="osx_x86"/>
<param name="prj.target.dist.base" location="${prj.target.dir}/distribution/${os}" />
<param name="prj.target.dist.dir" location="${prj.target.dist.base}/${app.name}" />
<param name="prj.target.dist.lib.dir" location="${prj.target.dist.dir}/lib" />
<param name="prj.target.dist.etc.dir" location="${prj.target.dist.dir}/etc" />
</antcall>
</target>
<target name="test" depends="compile, compile-test" description="JUnit Tests" >
<property name="simidude.home" value="${basedir}"/>
<junit fork="yes" printsummary="yes" timeout="10000"
haltonfailure="no" errorproperty="junit.error" failureproperty="junit.error">
<formatter type="xml"/>
<classpath>
<pathelement location="${prj.target.dist.etc.dir}"/>
<path refid="compile.classpath"/>
<path refid="build.additional.classpath"/>
<pathelement location="${prj.target.classes.test.dir}"/>
<pathelement location="${prj.target.classes.java.dir}"/>
<pathelement location="${prj.src.test.dir}"/>
<pathelement location="etc"/>
</classpath>
<jvmarg value="-Dsimidude.home=${simidude.home}"/>
<batchtest todir="${prj.target.test.dir}" fork="yes">
<fileset dir="${prj.target.classes.test.dir}">
<include name="**/*Test.class"/>
<include name="**/*Tester.class" />
</fileset>
</batchtest>
</junit>
<antcall target="test-report" />
</target>
<target name="test-report">
<junitreport todir="${prj.target.report.dir}">
<fileset dir="${prj.target.test.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" styledir="${prj.build.etc.dir}" todir="${prj.target.junit.dir}"/>
</junitreport>
</target>
<target name="javadoc" depends="init" description="Create Javadoc">
<echo message="Erstelle JavaDoc" />
<javadoc packagenames="com.agynamix.*" classpathref="compile.classpath" defaultexcludes="yes"
destdir="${prj.target.javadoc.dir}" author="true" version="true" use="true" private="true"
windowtitle="Simidude Source Documentation" encoding="Cp1252" source="1.5" maxmemory="256m">
<sourcepath>
<dirset dir="${prj.src.java.dir}"/>
</sourcepath>
<doctitle>
<![CDATA[<h1>Simidude</h1>]]></doctitle>
<bottom>
<![CDATA[<i>AGYNAMIX</i>]]></bottom>
</javadoc>
</target>
<!-- target for continuous build -->
<target name="hudson" depends="dist, javadoc, test">
</target>
<target name="clean">
<delete dir="${prj.target.dir}" />
</target>
</project>