-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
377 lines (318 loc) · 15.9 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
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
<?xml version="1.0" encoding="utf-8" ?>
<project name="FreeRapid Downloader" default="all" basedir=".">
<property name="application" value="FreeRapid"/>
<property name="version" value="0.9u4"/>
<property name="version.name" value="${application}-${version}"/>
<property name="mainclass" value="cz.vity.freerapid.core.MainApp"/>
<property name="mainjar.file" value="frd.jar"/>
<!--<property name="mainjar-packed.file" value="${mainjar.file}.pack.gz"/>-->
<!-- output data directories -->
<property name="build.dir" value="${version.name}"/>
<property name="classes.dir" value="_classes"/>
<property name="build.tests" value="_testClasses"/>
<property name="reports.tests" value="_reportTests"/>
<property name="src.tests" value="src-test"/>
<property name="dist.dir" value="dist"/>
<property name="macos.dmg.temp.dir" value="macos_dmg_temp"/>
<property name="macos.dmg" value="${dist.dir}/${version.name}.dmg"/>
<property name="javadoc.dir" value="${dist.dir}/javadoc"/>
<!-- input data directories -->
<property name="src.dir" value="src"/>
<property name="etc.dir" value="etc"/>
<property name="doc.dir" value="doc"/>
<property name="lib.dir" value="lib"/>
<property name="dev.dir" value="dev"/>
<property name="resources.dir" value="resources"/>
<property name="plugins.dir" value="plugins"/>
<property name="lookandfeel.dir" value="lookandfeel"/>
<property name="lib-src.dir" value="lib-src"/>
<property name="plugins-src.dir" value="plugins-src"/>
<!-- keep in sync with Consts.PLUGINS_DIST_FILE_NAME -->
<property name="plugins-dist-file-name" value="instplgs.dat"/>
<property name="resources" value="cz/vity/freerapid/core/resources/"/>
<property name="splash" value="${resources}icons/splash.jpg"/>
<property name="ignoreProperties" value="log*,lookandfeels*"/>
<fileset id="jars" dir="${lib.dir}" includes="**/*"/>
<fileset id="libjars" dir="${lib.dir}" includes="**/?*.jar"/>
<fileset id="devjars" dir="dev/lib" includes="**/*"/>
<taskdef name="native2AsciiExt" classpath="${dev.dir}/ant-tasks/vityanttasks.jar"
classname="cz.vity.ant.tasks.Native2AsciiExt"/>
<patternset id="compiler.resources">
<!--<include name="**/?*.properties"/>-->
<include name="**/?*.xml"/>
<include name="**/?*.txt"/>
<include name="**/?*.gif"/>
<include name="**/?*.png"/>
<include name="**/?*.jpeg"/>
<include name="**/?*.jpg"/>
<include name="**/?*.html"/>
<include name="**/?*.dtd"/>
<include name="**/?*.tld"/>
<include name="**/?*.mid"/>
<include name="**/?*.wav"/>
<include name="**/?*.xsd"/>
<exclude name="**/plugin.xml"/>
<exclude name="**/Thumbs.db"/>
</patternset>
<path id="cp">
<fileset refid="jars"/>
<fileset refid="devjars"/>
</path>
<path id="test-cp">
<fileset refid="libjars"/>
<fileset refid="devjars"/>
</path>
<path id="dist-jars">
<fileset dir="${build.dir}/${lib.dir}" includes="**/*.jar"/>
<fileset dir="${build.dir}/${lookandfeel.dir}" includes="**/*.jar"/>
<fileset dir="${build.dir}" includes="${mainjar.file}"/>
</path>
<pathconvert property="lib.prefix" pathsep=" ">
<path location="${lib.dir}"/>
</pathconvert>
<pathconvert property="classpath" refid="jars" pathsep=" " dirsep="/">
<map from="${lib.prefix}" to="${lib.dir}"/>
</pathconvert>
<target name="build" depends="compile, objectDbEnhance, tests" description="building">
<buildnumber file="build.txt"/>
<!--copying properties files-->
<copy todir="${classes.dir}" overwrite="true" encoding="utf-8">
<filterchain>
<ignoreblank byline="true"/>
<striplinecomments>
<comment value="#"/>
</striplinecomments>
</filterchain>
<fileset dir="${src.dir}" includes="**/?*.properties"/>
<mapper type="glob" from="*.properties" to="*.stripped">
</mapper>
</copy>
<replace dir="${classes.dir}" encoding="UTF-8" includes="**/MainApp*.stripped" casesensitive="true" token="##version##" value="${version}" description="replacing version token" />
<native2AsciiExt src="${classes.dir}" encoding="utf-8" includes="**/?*.stripped"
dest="${classes.dir}" ext=".properties"/>
<delete>
<fileset dir="${classes.dir}" includes="**/?*.stripped"/>
</delete>
<jar jarfile="${build.dir}/${mainjar.file}" compress="false">
<manifest>
<!--suppress AntResolveInspection -->
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Build" value="${build.number}"/>
<attribute name="Class-Path" value="${lib.dir}/languages.jar ${classpath}"/>
<attribute name="Main-Class" value="${mainclass}"/>
<attribute name="SplashScreen-Image" value="${splash}"/>
</manifest>
<fileset dir="${classes.dir}" includes="**/*"
excludes="**/services/**,**/sandbox/**, **/**/?*.properties,**/**/?*.java"/>
</jar>
<mkdir dir="${build.dir}/${lib.dir}"/>
<!--<mkdir dir="${build.dir}/help"/>-->
<copy todir="${build.dir}">
<fileset dir="${etc.dir}" includes="**/*" excludes="**/jnlp/**"/>
</copy>
<!--<copy todir="${build.dir}/help">-->
<!--<fileset dir="${help}" includes="**/*"></fileset>-->
<!--</copy>-->
<copy todir="${build.dir}/${lib.dir}">
<fileset dir="${lib.dir}" includes="**/*"/>
</copy>
<jar jarfile="${build.dir}/${lib.dir}/languages.jar" compress="true">
<manifest>
<!--suppress AntResolveInspection -->
<attribute name="Build-Date" value="${TODAY}"/>
</manifest>
<fileset dir="${classes.dir}" includes="**/**/?*.properties"/>
</jar>
<zip file="${build.dir}/${plugins-dist-file-name}" compress="false" basedir="${plugins.dir}">
<!--<fileset dir="${plugins.dir}" includes="**/*"/>-->
</zip>
<jar jarfile="${dist.dir}/plugin-api.jar" compress="true">
<manifest>
<!--suppress AntResolveInspection -->
<attribute name="Build-Date" value="${TODAY}"/>
</manifest>
<fileset dir="${classes.dir}" includes="**/plugins/**"/>
<fileset dir="${classes.dir}" includes="**/**/EDTPropertyChangeSupport**"/>
<fileset dir="${classes.dir}" includes="**/**/Utils**"/>
<fileset dir="${classes.dir}" includes="**/**/LogUtils**"/>
<fileset dir="${classes.dir}" includes="**/**/Crc32**"/>
</jar>
<zip file="${dist.dir}/plugin-api-src.zip" compress="true">
<fileset dir="${src.dir}" includes="**/plugins/**"/>
<fileset dir="${src.dir}" includes="**/**/EDTPropertyChangeSupport**"/>
<fileset dir="${src.dir}" includes="**/**/Utils**"/>
<fileset dir="${src.dir}" includes="**/**/LogUtils**"/>
<fileset dir="${src.dir}" includes="**/**/Crc32**"/>
</zip>
</target>
<target name="compile" depends="clean, init" description="compiling source codes">
<mkdir dir="${classes.dir}"/>
<javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="cp" source="1.6" target="1.6"
defaultexcludes="false" excludes="**/sandbox/**" includeantruntime="true" encoding="UTF-8">
</javac>
<mkdir dir="${build.tests}"/>
<javac srcdir="${src.tests}" destdir="${build.tests}" classpathref="test-cp" optimize="false" source="1.6"
target="1.6" includeantruntime="true" encoding="UTF-8">
<classpath location="${classes.dir}"/>
</javac>
<!-- zkopirovani resourcu -->
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
</target>
<target name="init" description="initialization">
<tstamp/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="javadoc" depends="init" description="Create javadoc">
<delete dir="${javadoc.dir}" quiet="true"/>
<mkdir dir="${javadoc.dir}"/>
<javadoc Author="true" Version="true" charset="utf-8" destdir="${javadoc.dir}" docencoding="utf-8"
encoding="utf-8" link="http://java.sun.com/javase/6/docs/api/" packagenames="*" package="true"
source="1.6">
<sourcepath>
<pathelement location="${src.dir}"/>
</sourcepath>
<classpath refid="cp"/>
</javadoc>
</target>
<target name="clean" description="clean up">
<delete dir="${build.dir}" failonerror="false"/>
<delete dir="${classes.dir}"/>
<delete dir="${dist.dir}" failonerror="false"/>
<delete dir="${resources.dir}"/>
<delete dir="${build.tests}"/>
<delete dir="${reports.tests}"/>
</target>
<target name="all" depends="clean,init, build, dist" description="build all"/>
<!-- run -->
<target name="run" depends="build">
<java fork="true" jar="${build.dir}/${mainjar.file}"/>
</target>
<target name="tests" depends="compile">
<copy todir="${build.tests}">
<fileset dir="${src.tests}">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
<mkdir dir="${reports.tests}"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="test-cp"/>
<pathelement location="${build.tests}"/>
<pathelement location="${classes.dir}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="${reports.tests}">
<fileset dir="${build.tests}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="resources" depends="init">
<delete dir="${resources.dir}"/>
<mkdir dir="${resources.dir}"/>
<copy todir="${resources.dir}" overwrite="">
<fileset dir="${src.dir}" includes="**/?*.properties" excludes="${ignoreProperties}"/>
</copy>
<zip zipfile="${dist.dir}/resources.zip">
<fileset dir="${resources.dir}"/>
</zip>
</target>
<target name="intellij">
<delete>
<fileset dir="out/production/freerapid" includes="**/?*.properties" excludes="${ignoreProperties}"/>
</delete>
<replace encoding="UTF-8" dir="out/production/freerapid" includes="**/MainApp*.stripped" casesensitive="true" token="##version##" value="${version}" description="replacing version token" />
<native2AsciiExt src="${src.dir}" encoding="utf-8" includes="**/?*.properties"
excludes="${ignoreProperties}"
dest="out/production/freerapid" ext=".properties"/>
</target>
<target name="objectDbEnhance" description="enhancing Object db entities">
<!--@see http://www.objectdb.com/java/jpa/tool/enhancer-->
<java classname="com.objectdb.Enhancer" fork="false" classpathref="test-cp">
<arg line="-cp ${classes.dir}"/>
<arg line="cz.vity.freerapid.gui.managers.FileHistoryItem"/>
<arg line="cz.vity.freerapid.model.DownloadFile"/>
<arg line="cz.vity.freerapid.model.PluginMetaData"/>
<arg line="cz.vity.freerapid.model.ProxyForPlugin"/>
<arg line="cz.vity.freerapid.model.ProxySet"/>
</java>
</target>
<target name="dist" depends="build" description="creating release">
<zip zipfile="${dist.dir}/${version.name}.zip" level="9" compress="true">
<fileset dir=".">
<include name="${build.dir}/"/>
<!--<exclude name="${build.dir}/${mainjar-packed.file}"/>-->
</fileset>
</zip>
<checksum algorithm="md5" forceoverwrite="true" file="${dist.dir}/${version.name}.zip"/>
<!--<zip destfile="${dist.dir}/${version.name}-src.zip">-->
<!--<fileset dir=".">-->
<!--<include name="${lib.dir}/"/>-->
<!--<include name="${lib-src.dir}/"/>-->
<!--<include name="${etc.dir}/"/>-->
<!--<include name="${src.dir}/"/>-->
<!--<include name="${dev.dir}/"/>-->
<!--<include name="${plugins.dir}/"/>-->
<!--<include name="${doc.dir}/"/>-->
<!--<include name="build.xml"/>-->
<!--</fileset>-->
<!--</zip>-->
</target>
<taskdef name="jarbundler"
classpath="./dev/ant-tasks/jarbundler-core-3.3.0/jarbundler-core-3.3.0.jar"
classname="com.ultramixer.jarbundler.JarBundler"/>
<!--todo chali you have to call target "dist" before this target-->
<!--see https://github.com/tofi86/universalJavaApplicationStub for more details-->
<!--this task is platform dependant, you can use it only on mac os x-->
<target name="mac-os-package">
<delete file="${macos.dmg}"/>
<mkdir dir="${macos.dmg.temp.dir}"/>
<jarbundler dir="${macos.dmg.temp.dir}"
name="FreeRapid"
mainclass="cz.vity.freerapid.core.MainApp"
icon="./${build.dir}/frd.icns"
vmoptions="-Djava.net.preferIPv4Stack=true -Xmx160m"
stubfile="./dev/universalJavaApplicationStub"
useJavaXKey="true"
arguments="">
<jarfileset dir="./${build.dir}/lib"/>
<jarfileset dir="./${build.dir}" includes="frd.jar"/>
<jarfileset dir="./${build.dir}/lookandfeel"/>
<javafileset dir="./${build.dir}" includes="*/*.xml"/>
<javafileset dir="./${build.dir}" includes="*/*.txt"/>
<javafileset dir="./${build.dir}" includes="*.conf"/>
<javafileset dir="./${build.dir}" includes="*.dat"/>
<javafileset dir="./${build.dir}" includes="*.properties"/>
</jarbundler>
<mkdir dir="${macos.dmg.temp.dir}"/>
<exec executable="./make_alias">
<arg line="/Applications ${macos.dmg.temp.dir}"/>
</exec>
<exec executable="hdiutil">
<arg line="create -volname ${version.name} -srcfolder ${macos.dmg.temp.dir} ${macos.dmg}"/>
</exec>
<delete dir="${macos.dmg.temp.dir}"/>
</target>
<target name="reverseResources" description="Target reverse all properties into UTF-8 encoded files">
<native2AsciiExt src="c:/temp/fr" encoding="utf-8" includes="**/?*.properties" excludes="${ignoreProperties}"
dest="c:/temp/fr2" ext=".properties2" reverse="true"/>
<!--<native2AsciiExt src="${src.dir}" encoding="UTF-16LE" includes="${unicodeResources}"-->
<!--dest="${src.dir}" ext=".properties2" reverse="true"/>-->
<copy todir="c:/temp/fr2" overwrite="true" encoding="utf-8">
<fileset dir="c:/temp/fr2" includes="**/?*.properties2"/>
<mapper type="glob" from="*.properties2" to="*.properties">
</mapper>
</copy>
<delete dir="c:/temp/fr2" includes="**/?*.properties2"/>
</target>
</project>