forked from MarcoFleres/tinyMediaManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
359 lines (320 loc) · 14.6 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
<project default="create_tmm_jar" name="Tiny Media Manager">
<!-- software revision number -->
<property name="version" value="2.6.9" />
<!-- CHECK UPGRADE TASKS FOR CORRECT VERSION -->
<!-- build directories -->
<property name="lib.dir" value="lib" />
<property name="bin.dir" value="bin" />
<property name="build.dir" value="build-tmp" />
<!-- temp dir, will then be moved to /build -->
<property name="dist.dir" value="dist" />
<property name="getdown" value="getdown.txt" />
<!-- set as property to override in jenkins -->
<tstamp>
<!--format property="today" pattern="dd/MM/yyyy" /-->
<format property="today" pattern="yyyy-MM-dd" />
</tstamp>
<path id="classpath.default">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${bin.dir}" />
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="init" depends="clean">
<mkdir dir="${bin.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<target name="compile" depends="init">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="source,lines,vars" destdir="${bin.dir}" source="1.6" target="1.6" encoding="UTF-8">
<src path="src" />
<classpath refid="classpath.default" />
</javac>
<!-- enhance several classes for objectdb -->
<java classname="com.objectdb.Enhancer" fork="true" classpathref="classpath.default">
<arg line="-s" />
<arg line="${bin.dir}/org/tinymediamanager/core/*" />
</java>
<!-- copy non java files -->
<copy includeemptydirs="false" todir="${bin.dir}">
<fileset dir="src" excludes="**/*.java" />
</copy>
</target>
<target name="javadoc">
<mkdir dir="reports/javadoc" />
<javadoc access="public" destdir="reports/javadoc" author="true" version="true" use="true" windowtitle="${ant.project.name}">
<classpath refid="classpath.default" />
<fileset dir="src" defaultexcludes="yes">
<include name="**/*.java" />
</fileset>
</javadoc>
</target>
<target name="create_resource_jar">
<jar destfile="${lib.dir}/resources.jar" basedir="resources" includes="*/**" />
</target>
<target name="create_tmm_jar" description="creates the jar" depends="compile, setNightly, setPreRelease">
<!-- set manifest Class-Path accordingly; fake jarFile parameter only used for relative path -->
<manifestclasspath property="jar.classpath" jarfile="tmm.jar">
<classpath refid="classpath.default" />
</manifestclasspath>
<!-- set date as revision here - git hashes are not useful -->
<!-- Only works, if rev is not set to nightly/prerel - so should be fine for release build -->
<echo message="Rev: ${rev}" />
<property name="rev" value="${today}" />
<echo message="Rev: ${rev}" />
<jar destfile="${build.dir}/tmm.jar">
<manifest>
<attribute name="Main-Class" value="org.tinymediamanager.TinyMediaManager" />
<attribute name="SplashScreen-Image" value="org/tinymediamanager/ui/images/splashscreen.png" />
<attribute name="Class-Path" value=". locale/ ${jar.classpath} lib/swt.jar" />
<attribute name="Implementation-Title" value="tinyMediaManager" />
<attribute name="Implementation-Version" value="${version} (${rev})" />
<attribute name="Build-Date" value="${DSTAMP}-${TSTAMP}" />
<attribute name="Build-By" value="${user.name}" />
</manifest>
<fileset dir="${bin.dir}" />
</jar>
<copy todir="${build.dir}/lib">
<fileset dir="${lib.dir}" />
</copy>
<!-- buildinfo -->
<propertyfile file="${build.dir}/version" comment="This file is automatically generated - DO NOT EDIT">
<entry key="version" value="${version}" />
<entry key="build" value="${rev}" />
<entry key="date" value="${today}" />
</propertyfile>
</target>
<target name="setNightly" if="nightly">
<property name="rev" value="nightly" />
</target>
<target name="setPreRelease" if="prerelease">
<property name="rev" value="prerelease" />
</target>
<target name="downloadLocale">
<get src="https://www.transifex.com/api/2/project/tinymediamanager/resource/messagesproperties/translation/${lang}/?file" dest="locale/messages_${lang}.properties" username="tmm" password="tmm" ignoreerrors="true" />
</target>
<target name="downloadLocales">
<antcall target="downloadLocale">
<param name="lang" value="cs" />
</antcall>
<!--<antcall target="downloadLocale"><param name="lang" value="da"/></antcall>-->
<antcall target="downloadLocale">
<param name="lang" value="de" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="es" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="el" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="fr" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="hu" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="it" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="ko" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="nl" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="no" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="pl" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="pt" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="ru" />
</antcall>
<!--<antcall target="downloadLocale"><param name="lang" value="ro"/></antcall>-->
<antcall target="downloadLocale">
<param name="lang" value="sk" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="sv" />
</antcall>
<antcall target="downloadLocale">
<param name="lang" value="tr" />
</antcall>
<!--<antcall target="downloadLocale"><param name="lang" value="vi" /></antcall>-->
<!--<antcall target="downloadLocale"><param name="lang" value="uk" /></antcall>-->
<antcall target="downloadLocale">
<param name="lang" value="zh" />
</antcall>
</target>
<target name='package-app' description="builds the packages" depends='create_tmm_jar, downloadLocales'>
<!-- default files, to include in dist -->
<copy file="objectdb.conf" todir="${build.dir}" />
<copy file="changelog.txt" todir="${build.dir}" />
<copy file="AppBundler/getdown.jar" todir="${build.dir}" />
<copy file="AppBundler/${getdown}" tofile="${build.dir}/getdown.txt" />
<copy todir="${build.dir}/native">
<fileset dir="native" />
</copy>
<copy todir="${build.dir}/templates">
<fileset dir="templates" />
</copy>
<copy todir="${build.dir}/locale">
<fileset dir="locale" />
</copy>
<pathconvert property="gd.code" refid="classpath.default" pathsep="">
<mapper>
<chainedmapper>
<flattenmapper />
<!-- remove absolute path -->
<!-- add GD + lib/ prefix + newline ;) -->
<globmapper from="*" to="code = lib/*${line.separator}" />
</chainedmapper>
</mapper>
</pathconvert>
<!-- echo message="${gd.code}" /-->
<replace file="${build.dir}/getdown.txt" token="%CODELIBS%" value="${gd.code}" />
<copy file="AppBundler/launch.jnlp" tofile="${build.dir}/launch.jnlp" />
<pathconvert property="webstart" refid="classpath.default" pathsep="">
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*" to=" <jar href="lib/*" />${line.separator}" />
</chainedmapper>
</mapper>
</pathconvert>
<!-- echo message="${gd.code}" /-->
<replace file="${build.dir}/launch.jnlp" token="%WEBSTARTLIBS%" value="${webstart}" />
<pathconvert property="gd.locale" pathsep="">
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*" to="resource = locale/*${line.separator}" />
</chainedmapper>
</mapper>
<path>
<fileset dir="locale">
<include name="**/*.properties" />
</fileset>
</path>
</pathconvert>
<!-- echo message="${gd.locale}" /-->
<replace file="${build.dir}/getdown.txt" token="%LOCALES%" value="${gd.locale}" />
<copy file="AppBundler/LICENSE" todir="${build.dir}" />
<copy file="AppBundler/splashscreen.png" todir="${build.dir}" />
<copy file="AppBundler/tmm.png" todir="${build.dir}" />
<copy file="AppBundler/env.txt" todir="${build.dir}" />
<!-- Mac OSX -->
<mkdir dir="${dist.dir}/mac/tinyMediaManager.app/Contents/MacOS" />
<mkdir dir="${dist.dir}/mac/tinyMediaManager.app/Contents/Resources/Java" />
<copy file="AppBundler/osx/Info.plist.template" tofile="${dist.dir}/mac/tinyMediaManager.app/Contents/Info.plist" />
<replace file="${dist.dir}/mac/tinyMediaManager.app/Contents/Info.plist" token="%VERSION%" value="${version}" />
<replace file="${dist.dir}/mac/tinyMediaManager.app/Contents/Info.plist" token="%SVNREV%" value="${rev}" />
<copy file="AppBundler/osx/PkgInfo" tofile="${dist.dir}/mac/tinyMediaManager.app/Contents/PkgInfo" />
<copy file="AppBundler/osx/tmm.icns" tofile="${dist.dir}/mac/tinyMediaManager.app/Contents/Resources/tmm.icns" />
<copy todir="${dist.dir}/mac/tinyMediaManager.app/Contents/Resources/Java/">
<fileset dir="${build.dir}">
<include name="**/*" />
<exclude name="native/windows*/**" />
<exclude name="native/linux*/**" />
<exclude name="templates/*.jar" />
</fileset>
</copy>
<!-- extract templates -->
<unjar dest="${dist.dir}/mac/tinyMediaManager.app/Contents/Resources/Java/templates">
<fileset dir="${build.dir}/templates" includes="*.jar" />
</unjar>
<copy file="AppBundler/JavaApplicationStub.new" tofile="${dist.dir}/mac/tinyMediaManager.app/Contents/MacOS/JavaApplicationStub" />
<chmod file="${dist.dir}/mac/tinyMediaManager.app/Contents/MacOS/JavaApplicationStub" perm="ugo+rx" />
<copy file="AppBundler/tinyMediaManagerOSX.sh" tofile="${dist.dir}/mac/tinyMediaManager.app/Contents/Resources/Java/tinyMediaManagerOSX.sh" />
<chmod file="${dist.dir}/mac/tinyMediaManager.app/Contents/Resources/Java/tinyMediaManagerOSX.sh" perm="ugo+rx" />
<!-- Windows -->
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="AppBundler/launch4j/launch4j.jar:AppBundler/launch4j/lib/xstream.jar" />
<launch4j configFile="./AppBundler/launch4j.xml" txtProductVersion="${version}_${rev}" outfile="${dist.dir}/tinyMediaManager.exe" />
<launch4j configFile="./AppBundler/launch4jUpdater.xml" txtProductVersion="${version}_${rev}" outfile="${dist.dir}/tinyMediaManagerUpd.exe" />
<launch4j configFile="./AppBundler/launch4jcmd.xml" txtProductVersion="${version}_${rev}" outfile="${dist.dir}/tinyMediaManagerCMD.exe" />
<!-- Linux -->
<copy file="AppBundler/tinyMediaManager.sh" todir="${dist.dir}" />
<copy file="AppBundler/tinyMediaManagerUpdater.sh" todir="${dist.dir}" />
<copy file="AppBundler/tinyMediaManagerCMD.sh" todir="${dist.dir}" />
<chmod file="${dist.dir}/tinyMediaManager.sh" perm="ugo+rx" />
<chmod file="${dist.dir}/tinyMediaManagerUpdater.sh" perm="ugo+rx" />
<chmod file="${dist.dir}/tinyMediaManagerCMD.sh" perm="ugo+rx" />
<!-- default files, NOT to include in dist, but in getdown updater -->
<copy file="${dist.dir}/tinyMediaManager.exe" tofile="${build.dir}/tinyMediaManager.new" />
<copy file="${dist.dir}/tinyMediaManagerUpd.exe" tofile="${build.dir}/tinyMediaManagerUpd.new" />
<copy file="${dist.dir}/tinyMediaManagerCMD.exe" tofile="${build.dir}/tinyMediaManagerCMD.new" />
<copy file="${dist.dir}/tinyMediaManager.sh" tofile="${build.dir}/tinyMediaManager.sh" />
<copy file="${dist.dir}/tinyMediaManagerUpdater.sh" tofile="${build.dir}/tinyMediaManagerUpdater.sh" />
<copy file="${dist.dir}/tinyMediaManagerCMD.sh" tofile="${build.dir}/tinyMediaManagerCMD.sh" />
<copy file="AppBundler/tinyMediaManagerOSX.sh" tofile="${build.dir}/tinyMediaManagerOSX.sh" />
<copy file="AppBundler/JavaApplicationStub.new" tofile="${build.dir}/JavaApplicationStub.new" />
<copy file="${dist.dir}/mac/tinyMediaManager.app/Contents/Info.plist" tofile="${build.dir}/Info.plist" />
<copy file="AppBundler/getdown.jar" tofile="${build.dir}/getdown-new.jar" />
<!-- finally create checksums -->
<taskdef name="digest" classname="com.threerings.getdown.tools.DigesterTask" classpath="AppBundler/getdown.jar" />
<digest appdir="${build.dir}" />
<!-- create a whole archive of /build for transfer to mirrors -->
<tar compression="gzip" destfile="${build.dir}/build.tar.gz">
<tarfileset dir="${build.dir}" />
<tarfileset filemode="755" dir="${build.dir}" includes="JavaApplicationStub" />
<tarfileset filemode="755" dir="${build.dir}" includes="*.exe" />
<tarfileset filemode="755" dir="${build.dir}" includes="*.sh" />
</tar>
<!-- done, move build dir -->
<delete dir="build" />
<copy todir="build">
<fileset dir="${build.dir}" />
</copy>
<!-- extract templates -->
<unjar dest="${build.dir}/templates">
<fileset dir="${build.dir}/templates" includes="*.jar" />
</unjar>
<delete>
<fileset dir="${build.dir}/templates" includes="*.jar" />
</delete>
<!-- copy digest.txt and create zip files -->
<copy file="${build.dir}/digest.txt" todir="${dist.dir}/mac/tinyMediaManager.app/Contents/Resources/Java/" />
<zip destfile="${dist.dir}/tmm_${version}_${rev}_mac.zip" level="9">
<zipfileset dir="${dist.dir}/mac" excludes="**/JavaApplicationStub,**/tinyMediaManagerOSX.sh" />
<zipfileset filemode="755" dir="${dist.dir}/mac" includes="**/JavaApplicationStub,**/tinyMediaManagerOSX.sh" />
</zip>
<!-- windows -->
<copy file="${build.dir}/digest.txt" todir="${dist.dir}" />
<zip destfile="${dist.dir}/tmm_${version}_${rev}_win.zip" level="9">
<zipfileset filemode="755" dir="${build.dir}" excludes="env.txt, native/linux*/**, native/mac*/**, build.tar.gz" />
<zipfileset filemode="755" dir="${dist.dir}" includes="*.exe" />
</zip>
<!-- linux -->
<tar compression="gzip" destfile="${dist.dir}/tmm_${version}_${rev}_linux.tar.gz">
<tarfileset dir="${build.dir}" excludes="env.txt, native/windows*/**, native/mac*/**, build.tar.gz" />
<tarfileset filemode="755" dir="${dist.dir}" includes="*.sh" />
</tar>
<!-- cleanup build -->
<delete dir="${build.dir}" />
<!-- cleanup dist -->
<delete includeemptydirs="true">
<fileset dir="${dist.dir}" includes="**/*" excludes="*.zip,*.tar.gz" />
<dirset dir="${dist.dir}" includes="**/*" />
</delete>
</target>
<!--target name="analyze" description="Run analyzers" depends="compile"-->
<target name="analyze" description="Run analyzers">
<delete dir="reports" />
<mkdir dir="reports" />
<ant antfile="buildsupport/analyze.xml">
<property name="source" value="src" />
<property name="classpath" refid="classpath.default" />
<property name="build" value="${bin.dir}" />
<!--property name="testsource" value="test"/-->
</ant>
</target>
</project>