forked from jakartaee/mail-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
588 lines (533 loc) · 22.5 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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<!DOCTYPE project [
<!ENTITY commonBuild SYSTEM "ant-common.xml">
]>
<!--
NOTE: Jakarta Mail is now built using Maven:
https://eclipse-ee4j.github.io/jakartamail/Build-Instructions
This ant build file is obsolete and may not work.
-->
<project name="Jakarta Mail" default="all" basedir=".">
<!-- ========== Initialize Properties =================================== -->
<!--
component.name: required property. the value should be the
name of the component directory
-->
<property name="component.name" value="mail"/>
<property file="./build.properties"/>
&commonBuild;
<!-- all -->
<target name="all" depends="compile, assemble"
description="Build entire component">
</target>
<!-- build -->
<target name="build" depends="compile, assemble"
description="Build entire component">
</target>
<!-- init. Initialization involves creating publishing directories and
OS specific targets. -->
<target name="init" description="${component.name} initialization">
<tstamp>
<format property="start.time" pattern="MM/dd/yyyy hh:mm aa"/>
</tstamp>
<echo message="Building component ${component.name}"/>
<mkdir dir="${component.classes.dir}"/>
</target>
<!-- compile -->
<target name="compile" depends="init"
description="Compile Jakarta Mail sources">
<copy file="${resources.dir}/javax/mail/Version.java"
toFile="${src.dir}/javax/mail/Version.java">
<filterset begintoken="$${" endtoken="}">
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
<javac srcdir="${src.dir}"
destdir="${component.classes.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="javax/mail/**"/>
<include name="com/sun/mail/**"/>
</javac>
</target>
<!-- prepare manifest files for jars -->
<target name="cook-manifest" depends="init"
description="Generate MANIFEST.MF files">
<!--
Could make this simpler with ant-contrib foreach task...
<foreach list=",imap.,pop3.,smtp.,dsn." target="cook-manifest-file"
param="mf"/>
-->
<mkdir dir="${component.classes.dir}/manifest"/>
<copy file="${resources.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.imap.dir}/manifest"/>
<copy file="${resources.imap.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.imap.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.pop3.dir}/manifest"/>
<copy file="${resources.pop3.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.pop3.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.smtp.dir}/manifest"/>
<copy file="${resources.smtp.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.smtp.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.dsn.dir}/manifest"/>
<copy file="${resources.dsn.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.dsn.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.gimap.dir}/manifest"/>
<copy file="${resources.gimap.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.gimap.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
</target>
<!--
This could be used with foreach, above.
XXX - do nested variable references work?
<target name="cook-manifest-file">
<mkdir dir="${component.classes.${mf}dir}/manifest"/>
<copy file="${resources.${mf}dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.${mf}dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
</target>
-->
<!-- gimap compile -->
<target name="gimapcompile" depends="init"
description="Compile com/sun/mail/gimap sources">
<mkdir dir="${component.classes.gimap.dir}"/>
<javac srcdir="${src.gimap.dir}"
destdir="${component.classes.gimap.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="com/sun/mail/gimap/**"/>
</javac>
</target>
<!-- dsn compile -->
<target name="dsncompile" depends="init"
description="Compile com/sun/mail/dsn sources">
<mkdir dir="${component.classes.dsn.dir}"/>
<javac srcdir="${src.dsn.dir}"
destdir="${component.classes.dsn.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="com/sun/mail/dsn/**"/>
</javac>
</target>
<!-- demo compile -->
<target name="democompile" depends="init"
description="Compile demo sources">
<mkdir dir="${component.classes.demo.dir}"/>
<javac srcdir="${src.demo.dir}"
destdir="${component.classes.demo.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="*"/>
</javac>
<mkdir dir="${component.classes.client.dir}"/>
<javac srcdir="${src.client.dir}"
destdir="${component.classes.client.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="*"/>
</javac>
<mkdir dir="${component.classes.servlet.dir}"/>
<javac srcdir="${src.servlet.dir}"
destdir="${component.classes.servlet.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
<pathelement location="${javaee.jar}"/>
</classpath>
<include name="*"/>
</javac>
<mkdir dir="${component.classes.logging.dir}"/>
<javac srcdir="${src.logging.dir}"
destdir="${component.classes.logging.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${component.classes.demo.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="*"/>
</javac>
<!-- XXX - still need to add rules to build webapp -->
</target>
<!-- assemble -->
<target name="assemble" depends="jar"/>
<target name="clean" description="Clean the build">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${component.classes.dir}"/>
<fileset dir="${component.classes.dsn.dir}"/>
<fileset dir="${component.classes.gimap.dir}"/>
<fileset dir="${component.classes.demo.dir}"/>
<fileset dir="${component.classes.client.dir}"/>
<fileset dir="${component.classes.servlet.dir}"/>
<fileset dir="${component.classes.logging.dir}"/>
</delete>
</target>
<target name="clobber" description="Clobber all derived files">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="target"/>
</delete>
</target>
<!-- Jakarta Mail bundle build targets -->
<target name="release" depends="init, jars, democompile, docs">
<!-- XXX - need to replace "." with "_" in release.version -->
<property name="rel" value="jakartamail-${release.version}"/>
<property name="zipname" value="${rel}.zip"/>
<delete file="${basedir}/target/${zipname}"/>
<echo message="Creating Jakarta Mail bundle ${basedir}/target/${zipname}"/>
<zip destfile="${basedir}/target/${zipname}">
<zipfileset dir="${release.dir}" prefix="${rel}"/>
<zipfileset dir="${src.demo.dir}" prefix="${rel}/demo"
excludes="**/internal/**"/>
<zipfileset dir="${src.client.dir}" prefix="${rel}/demo/client"/>
<zipfileset dir="${src.servlet.dir}"
prefix="${rel}/demo/servlet"/>
<zipfileset dir="webapp" prefix="${rel}/demo/webapp"
excludes="src/**,pom.xml"/>
<zipfileset dir="${src.webapp.dir}"
prefix="${rel}/demo/webapp/src/classes"/>
<zipfileset dir="${docroot.webapp.dir}"
prefix="${rel}/demo/webapp/src/docroot"/>
<zipfileset dir="${src.taglib.dir}"
prefix="${rel}/demo/webapp/src/taglib"/>
<zipfileset dir="${resources.taglib.dir}"
prefix="${rel}/demo/webapp/src/taglib"/>
<zipfileset dir="${src.logging.dir}"
prefix="${rel}/demo/logging"/>
</zip>
</target>
<!-- Build all jars needed for release -->
<target name="jars"
depends="jar, mailapijar, pop3jar, imapjar, smtpjar, gimapjar, dsnjar"/>
<!-- Assemble mail.jar -->
<target name="jar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}"/>
<jar jarfile="${release.mail.jar}"
manifest="${component.classes.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.dir}/META-INF"
includes="javamail.charset.map,javamail.default.*,mailcap"/>
<fileset dir="${component.classes.dir}">
<include name="javax/mail/**/*.class"/>
<include name="com/sun/mail/**/*.class"/>
</fileset>
</jar>
</target>
<!-- Create zip file of source code to publish to maven repo -->
<target name="src">
<zip file="target/mail.src.zip">
<fileset dir="${src.dir}">
<include name="javax/mail/**/*.java"/>
<include name="com/sun/mail/**/*.java"/>
</fileset>
</zip>
</target>
<target name="imapjar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.imap.jar}"
manifest="${component.classes.imap.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.imap.dir}/META-INF"
includes="javamail.providers"/>
<fileset dir="${component.classes.dir}">
<include name="com/sun/mail/iap/*.class"/>
<include name="com/sun/mail/imap/*.class"/>
<include name="com/sun/mail/imap/protocol/*.class"/>
</fileset>
</jar>
</target>
<target name="pop3jar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.pop3.jar}"
manifest="${component.classes.pop3.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.pop3.dir}/META-INF"
includes="javamail.providers"/>
<fileset dir="${component.classes.dir}">
<include name="com/sun/mail/pop3/*.class"/>
</fileset>
</jar>
</target>
<target name="smtpjar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.smtp.jar}"
manifest="${component.classes.smtp.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.smtp.dir}/META-INF"
includes="javamail.providers,javamail.address.map"/>
<fileset dir="${component.classes.dir}">
<include name="com/sun/mail/smtp/*.class"/>
</fileset>
</jar>
</target>
<target name="gimapjar" depends="init, gimapcompile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.gimap.jar}"
manifest="${component.classes.gimap.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.gimap.dir}/META-INF"
includes="mailcap"/>
<fileset dir="${component.classes.gimap.dir}">
<include name="com/sun/mail/gimap/*.class"/>
</fileset>
</jar>
</target>
<target name="dsnjar" depends="init, dsncompile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.dsn.jar}"
manifest="${component.classes.dsn.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.dsn.dir}/META-INF"
includes="mailcap"/>
<fileset dir="${component.classes.dsn.dir}">
<include name="com/sun/mail/dsn/*.class"/>
</fileset>
</jar>
</target>
<target name="mailapijar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.mailapi.jar}"
manifest="${component.classes.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.dir}/META-INF"
includes="javamail.charset.map, mailcap"/>
<fileset dir="${component.classes.dir}">
<include name="javax/mail/**/*.class"/>
<include name="com/sun/mail/util/*.class"/>
<include name="com/sun/mail/handlers/*.class"/>
</fileset>
</jar>
</target>
<!-- javadocs -->
<target name="docs" depends="init, jar, jar">
<copy todir="${release.dir}">
<fileset dir="${basedir}/doc/release" includes="*.txt" />
</copy>
<mkdir dir="${release.docs.dir}"/>
<copy todir="${release.docs.dir}">
<fileset dir="${basedir}/doc/spec" includes="*.txt" />
</copy>
<!--
To allow us to generate javadocs that only include some
classes in certain packages, we need to copy the sources
to another location and run javadoc against that subset
of the sources.
-->
<copy todir="${release.dir}/javadoc">
<fileset dir="${src.dir}">
<include name="**/*.html"/>
<include name="javax/mail/**"/>
</fileset>
<fileset dir="${src.dir}"
includes="
com/sun/mail/imap/IMAPFolder.java,
com/sun/mail/imap/IMAPMessage.java,
com/sun/mail/imap/IMAPStore.java,
com/sun/mail/imap/IMAPSSLStore.java
com/sun/mail/imap/ACL.java,
com/sun/mail/imap/Rights.java,
com/sun/mail/imap/Quota.java,
com/sun/mail/imap/SortTerm.java,
com/sun/mail/pop3/POP3Store.java,
com/sun/mail/pop3/POP3SSLStore.java,
com/sun/mail/pop3/POP3Folder.java,
com/sun/mail/pop3/POP3Message.java,
com/sun/mail/smtp/SMTPMessage.java,
com/sun/mail/smtp/SMTPAddressFailedException.java,
com/sun/mail/smtp/SMTPAddressSucceededException.java,
com/sun/mail/smtp/SMTPSendFailedException.java,
com/sun/mail/smtp/SMTPSenderFailedException.java,
com/sun/mail/smtp/SMTPTransport.java,
com/sun/mail/smtp/SMTPSSLTransport.java,
com/sun/mail/util/MailConnectException.java,
com/sun/mail/util/MailSSLSocketFactory.java,
com/sun/mail/util/ReadableMime.java,
com/sun/mail/util/logging/MailHandler.java
"/>
<fileset dir="${src.dsn.dir}"
includes="
com/sun/mail/dsn/package.html,
com/sun/mail/dsn/DeliveryStatus.java,
com/sun/mail/dsn/DispositionNotification.java,
com/sun/mail/dsn/MessageHeaders.java,
com/sun/mail/dsn/MultipartReport.java,
com/sun/mail/dsn/Report.java
"/>
<fileset dir="${src.dsn.dir}"
includes="
com/sun/mail/gimap/package.html,
com/sun/mail/gimap/GmailStore.java,
com/sun/mail/gimap/GmailSSLStore.java,
com/sun/mail/gimap/GmailFolder.java,
com/sun/mail/gimap/GmailMessage.java,
com/sun/mail/gimap/GmailMsgIdTerm.java,
com/sun/mail/gimap/GmailThrIdTerm.java,
com/sun/mail/gimap/GmailRawSearchTerm.java
"/>
</copy>
<mkdir dir="${release.javadocs.dir}"/>
<javadoc packagenames="javax.mail, javax.mail.internet,
javax.mail.search, javax.mail.event,
javax.mail.util,
com.sun.mail.imap,
com.sun.mail.pop3,
com.sun.mail.smtp,
com.sun.mail.gimap,
com.sun.mail.util, com.sun.mail.util.logging,
com.sun.mail.dsn"
destdir="${release.javadocs.dir}"
sourcepath="${release.dir}/javadoc"
classpath="${activation.jar}:${release.mail.jar}:${release.dsn.jar}:${release.gimap.jar}"
author="false"
version="false"
use="true"
overview="${release.dir}/javadoc/overview.html"
windowtitle="Jakarta Mail API documentation"
doctitle="Jakarta Mail API documentation">
<group title="Jakarta Mail API Packages" packages="javax.*"/>
<group title="Sun-specific Packages" packages="com.sun.*"/>
<bottom>
<![CDATA[Copyright © 1996-2013,
<a href="http://www.oracle.com">Oracle</a>
and/or its affiliates. All Rights Reserved.
Use is subject to
<a href="{@docRoot}/doc-files/speclicense.html" target="_top">license terms<
/a>.
]]>
</bottom>
<!-- following can really slow down javadoc generation
<link href="${javase.url}"/>
<link href="${jaf.url}"/>
-->
</javadoc>
</target>
<target name="push-to-maven-prepare" depends="-push-to-maven-init, jar, src"
description="creates an image for the 'push-to-maven' goal">
<delete dir="target/maven-repo" /><!-- clean it -->
<maven-repository-importer
destdir="target/maven-repo" version="${release.version}">
<artifact jar="target/release/mail.jar" pom="mail.pom"
srczip="target/mail.src.zip" />
</maven-repository-importer>
</target>
<target name="push-to-maven" depends="push-to-maven-prepare"
description="pushes jars to the java.net maven repository">
<cvs-import src="target/maven-repo" dest="glassfish/repo" />
</target>
</project>