forked from mguessan/davmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
560 lines (520 loc) · 24 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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
<project name="DavMail" default="dist" basedir=".">
<property file="user.properties"/>
<property name="version" value="6.0.1"/>
<path id="classpath">
<pathelement location="classes"/>
<fileset dir="lib">
<include name="*.jar"/>
<!-- make sure we compile with swt gtk 64 -->
<exclude name="swt-*-x86.jar"/>
<exclude name="swt-*-win32-*.jar"/>
</fileset>
</path>
<target name="clean">
<delete dir="target"/>
<delete dir="dist"/>
<delete>
<fileset dir=".">
<include name="*.log*"/>
</fileset>
</delete>
</target>
<condition property="is.windows">
<os family="windows"/>
</condition>
<condition property="is.svn">
<available file=".svn"/>
</condition>
<condition property="is.git">
<available file=".git"/>
</condition>
<condition property="is.javafx">
<available classname="javafx.embed.swing.JFXPanel" classpathref="classpath"/>
</condition>
<condition property="is.javafx.message" value="available" else="missing">
<available classname="javafx.embed.swing.JFXPanel" property="is.javafx" classpathref="classpath"/>
</condition>
<condition property="is.java8">
<not>
<matches string="${ant.java.version}" pattern="1\.[01234567]"/>
</not>
</condition>
<condition property="is.utf8">
<equals arg1="${file.encoding}" arg2="UTF-8"/>
</condition>
<target name="check-java8" unless="is.java8">
<fail message="Java 8 or later needed to build DavMail, current version is ${ant.java.version}, check JAVA_HOME"/>
</target>
<target name="check-encoding" unless="is.utf8">
<fail message="Please force UTF-8 encoding to build debian package with set ANT_OPTS=-Dfile.encoding=UTF-8"/>
</target>
<target name="svnrelease" if="is.svn">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml">
<classpath>
<fileset dir="svnant">
<include name="*.jar"/>
</fileset>
</classpath>
</typedef>
<svnSetting svnkit="true" javahl="false" id="svn.settings"/>
<svn refid="svn.settings">
<wcversion path="."/>
</svn>
<!-- failover value for revision -->
<property name="revision.max" value=""/>
<property name="release" value="${version}-${revision.max}"/>
</target>
<target name="gitsvnrelease" if="is.git">
<mkdir dir=".git/svn"/>
<!-- try to get svn revision from git -->
<exec executable="git" outputproperty="revision.max" failifexecutionfails="false">
<arg value="svn" />
<arg value="find-rev" />
<arg value="HEAD" />
</exec>
<property name="revision.max" value=""/>
<property name="release" value="${version}-${revision.max}"/>
</target>
<target name="defaultrelease" unless="is.svn">
<property name="release" value="${version}"/>
</target>
<target name="init" depends="check-encoding, check-java8, svnrelease, gitsvnrelease, defaultrelease">
<echo message="Creating DavMail ${release} dist package" level="info"/>
<echo message="Java ${ant.java.version} and JavaFX ${is.javafx.message}" level="info"/>
<mkdir dir="target/classes"/>
</target>
<target name="compile-java9" depends="init">
<mkdir dir="target/classes"/>
<javac srcdir="src/java" destdir="target/classes" source="9" debug="on" encoding="UTF-8"
includeantruntime="false">
<exclude name="davmail/exchange/auth/*Interactive*" unless="is.javafx"/>
<compilerarg value="--add-exports"/>
<compilerarg value="java.naming/com.sun.jndi.ldap=ALL-UNNAMED"/>
<compilerarg value="--add-exports"/>
<compilerarg value="java.base/sun.net.www.protocol.https=ALL-UNNAMED"/>
<classpath>
<path refid="classpath"/>
</classpath>
</javac>
</target>
<target name="compile-java" depends="init">
<mkdir dir="target/classes"/>
<javac srcdir="src/java" destdir="target/classes" source="1.8" target="1.8" debug="on" encoding="UTF-8"
includeantruntime="false">
<exclude name="davmail/exchange/auth/*Interactive*" unless="is.javafx"/>
<classpath>
<path refid="classpath"/>
</classpath>
</javac>
</target>
<target name="compile" depends="compile-java">
<copy todir="target/classes">
<fileset dir="src/java">
<include name="**/*"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="test-compile" depends="compile">
<mkdir dir="target/test-classes"/>
<javac srcdir="src/test" destdir="target/test-classes" source="1.8" target="1.8" debug="on" encoding="UTF-8"
includeantruntime="false">
<classpath>
<path refid="classpath"/>
<pathelement location="target/classes"/>
</classpath>
</javac>
<copy todir="target/test-classes">
<fileset dir="src/test">
<include name="**/*"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="test" depends="test-compile">
<taskdef resource="org/jacoco/ant/antlib.xml">
<classpath>
<fileset dir="lib">
<include name="jacocoant-*"/>
</fileset>
</classpath>
</taskdef>
<!-- execute tests with coverage -->
<coverage output="file" destfile="target/jacoco.exec">
<junit printsummary="on" haltonfailure="no" fork="true">
<classpath>
<path refid="classpath"/>
<pathelement location="target/classes"/>
<pathelement location="target/test-classes"/>
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest>
<!--fileset dir="src/test" includes="**/Test*.java"/-->
<fileset dir="src/test" includes="**/TestDoubleDotInputStream.java"/>
<fileset dir="src/test" includes="davmail/caldav/TestCaldavHttpClient4.java"/>
<fileset dir="src/test" includes="davmail/util/*.java"/>
<fileset dir="src/test" includes="davmail/smtp/*.java"/>
<fileset dir="src/test" includes="davmail/ldap/*.java"/>
<fileset dir="src/test" includes="davmail/imap/*.java"/>
</batchtest>
</junit>
</coverage>
<!-- create coverage report -->
<report>
<executiondata>
<file file="target/jacoco.exec"/>
</executiondata>
<structure name="DavMail">
<classfiles>
<fileset dir="target/classes">
<exclude name="**/StreamScanner.class"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src/java">
<exclude name="**/StreamScanner.java"/>
</fileset>
</sourcefiles>
</structure>
<html destdir="target/jacocoreport"/>
<xml destfile="target/jacoco.xml"/>
</report>
</target>
<!-- upload jacoco report to sourceforge -->
<target name='upload-coverage' depends="test">
<scp todir="${username},[email protected]:htdocs"
keyfile="${keyfile}" passphrase="${passphrase}" verbose="true" trust="true">
<fileset file="target/jacoco.xml"/>
</scp>
</target>
<target name="dist-nsis" if="is.windows">
<taskdef name="nsis" classname="net.sf.nsisant.Task">
<classpath location="lib/nsisant-1.2.jar"/>
</taskdef>
<nsis script="davmail-setup.nsi" verbosity="4" out="build.log" noconfig="yes">
<define name="VERSION" value="${release-name}"/>
</nsis>
<nsis script="davmail-setup64.nsi" verbosity="4" out="build64.log" noconfig="yes">
<define name="VERSION" value="${release-name}"/>
</nsis>
</target>
<target name="dist-osx">
<!-- move jar files to new location -->
<copy todir="dist/DavMail.app/Contents/Java">
<fileset dir="dist">
<include name="*.jar"/>
</fileset>
<fileset dir="dist/lib">
<include name="*.jar"/>
<include name="*.jnilib"/>
<exclude name="swt*.jar"/>
<exclude name="junit-*.jar"/>
<exclude name="hamcrest-core-*.jar"/>
<exclude name="winrun4j-*.jar"/>
</fileset>
</copy>
<copy file="src/osx/tray.icns" todir="dist/DavMail.app/Contents/Resources" overwrite="true"/>
<!-- use generic app launcher -->
<copy file="src/osx/davmail" todir="dist/DavMail.app/Contents/MacOS" overwrite="true"/>
<!-- template plist -->
<copy file="src/osx/Info.plist" todir="dist/DavMail.app/Contents" overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<zip file="dist/DavMail-MacOSX-${release-name}.app.zip"
comment="In order to run DavMail on OSX Mountain Lion or later, you will need to disable Gatekeeper temporarily, see http://davmail.sourceforge.net/macosxsetup.html">
<zipfileset dir="dist">
<include name="DavMail.app/**/*"/>
<exclude name="DavMail.app/Contents/MacOS/davmail"/>
</zipfileset>
<zipfileset dir="dist" filemode="755">
<include name="DavMail.app/Contents/MacOS/davmail"/>
</zipfileset>
</zip>
</target>
<target name="dist-deb">
<taskdef resource="ant_deb_task.properties">
<classpath location="lib/ant-deb-0.0.1.jar"/>
</taskdef>
<deb todir="dist"
package="davmail"
section="mail"
depends="openjdk-11-jre|openjdk-8-jre|openjdk-7-jre|openjdk-6-jre|oracle-java7-jre|sun-java6-jre|default-jre,libopenjfx-java,openjfx"
suggests="libswt-gtk-4-java,libswt-cairo-gtk-4-jni,libswt-gtk2-4-jni">
<version upstream="${release-name}"/>
<maintainer email="[email protected]" name="Mickaël Guessant"/>
<description synopsis="DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway">
Ever wanted to get rid of Outlook ? DavMail is a POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365
gateway allowing users to use any mail/calendar client (e.g. Thunderbird with Lightning or
Apple iCal) with an Exchange server, even from the internet or behind a firewall through
Outlook Web Access.
DavMail now includes an LDAP gateway to Exchange global address book and user personal
contacts to allow recipient address completion in mail compose window and full calendar
support with attendees free/busy display.
The main goal of DavMail is to provide standard compliant protocols in front of proprietary
Exchange. This means LDAP for global address book, SMTP to send messages, IMAP to browse
messages on the server in any folder, POP to retrieve inbox messages only, Caldav for
calendar support and Carddav for personal contacts sync.
Thus any standard compliant client can be used with Microsoft Exchange.
DavMail gateway is implemented in java and should run on any platform. Releases are tested
on Windows, Linux (Ubuntu) and Mac OSX. Tested successfully with the Iphone
(gateway running on a server).
http://davmail.sourceforge.net
</description>
<tarfileset dir="dist" prefix="usr/share/davmail">
<include name="lib/*.jar"/>
<include name="*.jar"/>
<!-- exclude swt jars from debian package -->
<exclude name="lib/swt*.jar"/>
<exclude name="lib/winrun4j-*.jar"/>
</tarfileset>
<tarfileset dir="src/bin" prefix="usr/bin" filemode="755">
<include name="davmail"/>
</tarfileset>
<tarfileset dir="dist" prefix="usr/share/icons">
<include name="davmail.png"/>
</tarfileset>
<tarfileset dir="src/desktop" prefix="usr/share/applications">
<include name="davmail.desktop"/>
</tarfileset>
<tarfileset dir="src/appstream" prefix="usr/share/metainfo">
<include name="org.davmail.DavMail.appdata.xml"/>
</tarfileset>
</deb>
</target>
<target name="jar" depends="compile">
<delete dir="dist"/>
<mkdir dir="dist"/>
<property name="release-name" value="${version}-trunk"/>
<pathconvert property="manifest-classpath" pathsep=" ">
<mapper>
<chainedmapper>
<!-- remove absolute path -->
<flattenmapper/>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</mapper>
<path>
<fileset dir="lib">
<include name="*.jar"/>
<exclude name="ant-deb*.jar"/>
<exclude name="junit-*.jar"/>
<exclude name="hamcrest-core-*.jar"/>
<exclude name="nsisant-*.jar"/>
<exclude name="servlet-api-*.jar"/>
<exclude name="swt-*.jar"/>
<exclude name="winrun4j-*.jar"/>
</fileset>
</path>
</pathconvert>
<jar basedir="target/classes" destfile="dist/davmail.jar">
<manifest>
<attribute name="Main-Class" value="davmail.DavGateway"/>
<attribute name="Class-Path" value="${manifest-classpath}"/>
<section name="davmail/">
<attribute name="Implementation-Title" value="DavMail Gateway"/>
<attribute name="Implementation-Version" value="${release-name}"/>
<attribute name="Implementation-Vendor" value="Mickael Guessant"/>
</section>
</manifest>
</jar>
</target>
<target name="prepare-dist" depends="jar">
<echo file="dist/version.txt" message="${release}"/>
<copy todir="dist/lib">
<fileset dir="lib">
<include name="*.jar"/>
<include name="*.jnilib"/>
<exclude name="nsisant*.jar"/>
<exclude name="servlet-api.jar"/>
<exclude name="ant-deb-*.jar"/>
</fileset>
</copy>
<copy file="src/icon/davmail.png" todir="dist"/>
<copy file="src/bin/davmail" todir="dist"/>
<!-- use WinRun4J wrappers -->
<copy file="src/winrun4j/davmail.exe" todir="dist"/>
<copy file="src/winrun4j/davmailconsole.exe" todir="dist"/>
<copy file="src/winrun4j/davmailservice.exe" todir="dist"/>
<copy file="src/winrun4j/davmail64.exe" todir="dist"/>
<copy file="src/winrun4j/davmailservice64.exe" todir="dist"/>
<copy todir="dist/web">
<fileset dir="src/web"/>
</copy>
<copy todir="dist/web/WEB-INF/lib">
<fileset dir="dist">
<include name="*.jar"/>
</fileset>
<fileset dir="dist/lib">
<include name="*.jar"/>
<exclude name="nsisant*.jar"/>
<exclude name="swt*.jar"/>
<exclude name="winrun4j-*.jar"/>
</fileset>
</copy>
<copy todir="dist/web/WEB-INF/classes" file="src/etc/davmail.properties"/>
</target>
<target name="dist" depends="prepare-dist">
<zip file="dist/davmail-${release-name}.zip">
<zipfileset dir="dist">
<include name="lib/*.jar"/>
<include name="*.jar"/>
<!-- exclude swt jars from platform independent package -->
<exclude name="lib/swt*.jar"/>
<exclude name="lib/junit-*.jar"/>
<exclude name="lib/hamcrest-core-*.jar"/>
<exclude name="lib/winrun4j-*.jar"/>
</zipfileset>
<zipfileset dir="src/bin" filemode="755">
<include name="davmail"/>
</zipfileset>
</zip>
<jar destfile="dist/davmail-${release-name}.war">
<fileset dir="dist/web"/>
</jar>
<zip file="dist/davmail-${release-name}-windows-noinstall.zip">
<fileset dir="dist">
<include name="lib/*.jar"/>
<include name="*.jar"/>
<include name="davmail*.exe"/>
<exclude name="lib/swt-*-gtk-*.jar"/>
<exclude name="lib/junit-*.jar"/>
<exclude name="lib/hamcrest-core-*.jar"/>
</fileset>
</zip>
<antcall target="download-jre"/>
<zip file="dist/davmail-${release-name}-windows-standalone.zip">
<fileset dir="dist">
<include name="jre/**"/>
<include name="lib/*.jar"/>
<include name="*.jar"/>
<include name="davmail64.exe"/>
<include name="davmailservice64.exe"/>
<exclude name="lib/swt-*-gtk-*.jar"/>
<exclude name="lib/junit-*.jar"/>
<exclude name="lib/hamcrest-core-*.jar"/>
</fileset>
</zip>
<antcall target="dist-nsis"/>
<antcall target="dist-deb"/>
<antcall target="dist-osx"/>
<!-- source with binary deps package -->
<tar tarfile="dist/davmail-src-${release-name}.tgz" compression="gzip" longfile="gnu">
<tarfileset prefix="davmail-src-${release-name}" dir=".">
<include name="**/*"/>
<exclude name="build*.log"/>
<exclude name="dist/**"/>
<exclude name="target/**"/>
<exclude name="archive/**"/>
<exclude name="user.properties"/>
<exclude name=".scannerwork/**"/>
<exclude name="*.ipr"/>
<exclude name="*.iws"/>
<exclude name="test.properties"/>
</tarfileset>
</tar>
<!-- davmail source only package for GNU/Linux distributions -->
<tar tarfile="dist/davmail-srconly-${release-name}.tgz" compression="gzip" longfile="gnu">
<tarfileset prefix="davmail-${release-name}" dir=".">
<include name="**/*"/>
<exclude name="build*.log"/>
<exclude name="dist/**"/>
<exclude name="target/**"/>
<exclude name="archive/**"/>
<exclude name="lib/**"/>
<exclude name="nsis/**"/>
<exclude name="svnant/**"/>
<exclude name="user.properties"/>
<exclude name="src/winrun4j/**"/>
<exclude name="src/osx/**"/>
<exclude name="src/osx/**"/>
<exclude name="src/contribs/**"/>
<exclude name="*.nsi"/>
<exclude name=".scannerwork/**"/>
<exclude name="*.ipr"/>
<exclude name="*.iws"/>
<exclude name="test.properties"/>
</tarfileset>
</tar>
</target>
<target name='fix-site'>
<!-- fix site title generated by mvn site -->
<replaceregexp match="Maven &#x2013; "
replace="">
<fileset dir="target/site"/>
</replaceregexp>
<replaceregexp match=" <div id="bodyColumn""
replace=" </div><div id="bodyColumn"">
<fileset dir="target/site"/>
</replaceregexp>
<replaceregexp match=" <div id="leftColumn" class="span2">"
replace=" <div class="nav-collapse"><div id="leftColumn" class="span2">">
<fileset dir="target/site"/>
</replaceregexp>
<replaceregexp
match="<a href="#" id="bannerRight"><img src="#" alt="#"/></a>"
replace="<div class="navbar"><div class="container"><a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a></div></div>">
<fileset dir="target/site"/>
</replaceregexp>
</target>
<target name='upload-site' depends="fix-site">
<scp todir="${username},[email protected]:htdocs"
keyfile="${keyfile}" passphrase="${passphrase}" verbose="true" trust="true">
<fileset dir="target/site"/>
</scp>
</target>
<target name="upload-release" depends="release">
<scp todir="${username},[email protected]:/home/frs/project/d/da/davmail/davmail"
keyfile="${keyfile}" passphrase="${passphrase}" verbose="true" trust="true">
<fileset dir="dist">
<include name="${version}/*"/>
</fileset>
</scp>
</target>
<target name="upload-version">
<scp todir="${username},[email protected]:htdocs"
keyfile="${keyfile}" passphrase="${passphrase}" verbose="true" trust="true">
<fileset dir="dist">
<include name="version.txt"/>
</fileset>
</scp>
</target>
<target name="release" depends="init">
<property name="release-name" value="${release}"/>
<antcall target="dist"/>
<checksum todir="dist" format="MD5SUM">
<fileset dir="dist">
<include name="*${version}-*"/>
</fileset>
</checksum>
<mkdir dir="dist/${version}"/>
<move todir="dist/${version}">
<fileset dir="dist">
<include name="*${version}-*"/>
<exclude name="*.MD5"/>
</fileset>
</move>
<copy file="RELEASE-NOTES.md" todir="dist/${version}"/>
<concat destfile="dist/${version}/checksums.md5">
<fileset dir="dist">
<include name="*.MD5"/>
</fileset>
</concat>
</target>
<target name="sonar">
<property file="sonar.properties"/>
<property name="sonar.projectVersion" value="${version}"/>
<taskdef resource="org/sonar/ant/antlib.xml" classpath="lib/sonarqube-ant-task-2.7.0.1612.jar"/>
<sonar/>
</target>
<target name="download-jre">
<get src="https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=15&ext=zip&os=windows&arch=x86&hw_bitness=64&bundle_type=jre&features=fx"
dest="dist/jrefx.zip"
/>
<unzip src="dist/jrefx.zip" dest="dist/jre">
<cutdirsmapper dirs="1"/>
</unzip>
<delete file="dist/jrefx.zip"/>
</target>
</project>