-
Notifications
You must be signed in to change notification settings - Fork 139
/
build.xml
293 lines (229 loc) · 8.98 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
<?xml version="1.0"?>
<!--
$Id$
$URL$
Top-level build file for SubEthaSMTP. Imports build files for the
various modules, so this is the only entry point.
To run the junit tests, you must copy junit.jar into ANT_HOME/lib.
-->
<project name="subethasmtp" default="jar" basedir=".">
<property name="name" value="${ant.project.name}" />
<property file="user.properties" />
<property file="build.properties" />
<property name="build.dir" location="target" />
<property name="src.dir" location="src/main/java" />
<property name="test.src.dir" location="src/test/java" />
<property name="lib.dir" location="lib" />
<property name="build.debug" value="on" />
<property name="build.deprecation" value="on" />
<property name="docs.dir" value="${build.dir}/docs" />
<property name="ant.build.javac.target" value="1.5" />
<property name="ant.build.javac.source" value="1.5" />
<property name="ant.build.javac.encoding" value="UTF-8" />
<property name="retroweaver.version" value="2.0.7" />
<property name="retroweaver.home" value="../retroweaver-${retroweaver.version}" />
<property name="deploy.dir" location="../Subetha/lib" />
<typedef resource="com/googlecode/svntask/svntask.xml">
<classpath>
<fileset dir="${lib.dir}">
<include name="**/svnkit.jar"/>
<include name="**/svntask.jar"/>
</fileset>
</classpath>
</typedef>
<path id="classpath">
<!-- jmockit.jar must precede junit.jar -->
<fileset dir="${lib.dir}/buildonly/jmockit" includes="*.jar"/>
<fileset dir="${lib.dir}" includes="*.jar"/>
<fileset dir="${lib.dir}/buildonly" includes="*.jar"/>
</path>
<target name="jar" depends="init">
<mkdir dir="${build.dir}/classes" />
<javac srcdir="${src.dir}" destdir="${build.dir}/classes"
includeAntRuntime="false" debug="${build.debug}"
deprecation="${build.deprecation}">
<classpath refid="classpath"/>
</javac>
<jar jarfile="${build.dir}/${name}-${build.version}.jar">
<manifest>
<attribute name="Specification-Version" value="${build.version}" />
<attribute name="Implementation-Version" value="${TODAY}" />
<attribute name="Main-Class" value="org.subethamail.smtp.Version" />
</manifest>
<fileset dir="${build.dir}/classes" />
</jar>
</target>
<target name="smtp-jdk1.4-jar" depends="jar, rt-task">
<retroweaver inputjar="${build.dir}/${name}-${build.version}.jar" outputjar="${build.dir}/${name}-${build.version}-jdk1.4.jar" />
</target>
<target name="assembly" depends="jar">
<property name="ikvm.dir" value="/dotnet/ikvm-0.38.0.2"/>
<taskdef name="ikvmc" classname="net.ikvm.ant.IkvmcTask" classpathref="classpath"/>
<ikvmc target="library" out="${build.dir}/${name}.dll" home="${ikvm.dir}" debug="true">
<fileset dir="${build.dir}">
<include name="${name}.jar"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="activation.jar"/>
</fileset>
</ikvmc>
</target>
<target name="rtest-jar" depends="init, jar">
<mkdir dir="${build.dir}/test" />
<javac srcdir="${test.src.dir}" destdir="${build.dir}/test"
includeAntRuntime="false" debug="${build.debug}"
deprecation="${build.deprecation}">
<classpath refid="classpath"/>
<classpath location="${build.dir}/classes"/>
</javac>
<jar jarfile="${build.dir}/rtest.jar">
<fileset dir="${build.dir}/classes"/>
<fileset dir="${build.dir}/test"/>
<manifest>
<attribute name="Specification-Version" value="${build.version}" />
<attribute name="Implementation-Version" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="junit" depends="rtest-jar">
<junit printsummary="yes" showoutput="yes" haltonfailure="true" fork="yes" maxmemory="512m">
<jvmarg value="-javaagent:lib/buildonly/jmockit/jmockit.jar"/>
<classpath refid="classpath" />
<classpath>
<fileset dir="${build.dir}">
<include name="*.jar" />
</fileset>
</classpath>
<formatter type="plain"/>
<batchtest todir="${build.dir}">
<fileset dir="${build.dir}/test">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="junit-special" depends="rtest-jar">
<junit printsummary="true" showoutput="true" fork="true" maxmemory="512m">
<classpath refid="classpath" />
<classpath>
<fileset dir="${build.dir}">
<include name="*.jar" />
</fileset>
</classpath>
<formatter type="plain" />
<batchtest todir="${build.dir}">
<fileset dir="${build.dir}/test">
<include name="${junit.special.tests}" />
</fileset>
</batchtest>
</junit>
</target>
<target name="practice" depends="rtest-jar">
<java classname="org.subethamail.smtp.test.util.Practice">
<classpath refid="classpath" />
<classpath>
<fileset dir="${build.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="input-version">
<input addproperty="build.version" message="Version number?" />
</target>
<target name="formal-build" depends="clean, input-version, jar">
</target>
<target name="formal-deploy" depends="formal-build, deploy">
</target>
<target name="init">
<tstamp/>
<tstamp>
<format property="YEAR" pattern="yyyy" />
</tstamp>
<property name="build.version" value="UNVERSIONED"/>
</target>
<target name="javadoc" depends="init">
<javadoc
destdir="${build.dir}/javadoc"
packagenames="*"
classpathref="classpath"
author="true"
version="true"
Windowtitle="SubEthaSMTP Javadoc"
>
<fileset dir="${src.dir}"/>
<doctitle><![CDATA[<h1>SubEthaSMTP</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © ${YEAR} SubEthaSMTP. All Rights Reserved. Build version: ${build.version}</i>]]></bottom>
</javadoc>
</target>
<target name="deploy" depends="jar">
<copy file="${build.dir}/${name}-${build.version}.jar" todir="${deploy.dir}" />
</target>
<target name="build-docs" description="downloads docs from wiki and processes them into the build/docs dir">
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="classpath"/>
<property name="gc.name" value="subethasmtp"/>
<property name="wiki.baseurl" value="http://code.google.com/p/${gc.name}/wiki"/>
<mkdir dir="${docs.dir}"/>
<svn><ls repository="http://${gc.name}.googlecode.com/svn" path="wiki" filterType="file" filterContains=".wiki"/></svn>
<propertyregex property="wiki.pages" input="${svn.ls}" regexp="\.wiki" replace=""/>
<echo message="Getting wiki pages: ${wiki.pages}"/>
<!-- Get files from wiki-->
<for list="${wiki.pages}" param="wiki.page" parallel="yes">
<sequential>
<get dest="${docs.dir}/@{wiki.page}.html" src="${wiki.baseurl}/@{wiki.page}?show=content"/>
</sequential>
</for>
<!-- Replace links in files -->
<for list="${wiki.pages}" param="wiki.page">
<sequential>
<replace dir="${docs.dir}" token="/p/${gc.name}/wiki/${wiki.page}" value="@{wiki.page}.html"/>
</sequential>
</for>
<!-- link back to the wiki, if we haven't downloaded the content -->
<replace dir="${docs.dir}" token="/p/${gc.name}/wiki" value="${wiki.baseurl}"/>
</target>
<target name="dist" depends="clean, formal-build, build-docs, javadoc"
description="creates the distribution archive after a clean build">
<property name="build.dist.dir" location="${build.dir}/${name}-${build.version}"/>
<property name="build.dist.zip" location="${build.dir}/${name}-${build.version}.zip"/>
<antcall target="smtp-jdk1.4-jar" />
<copy todir="${build.dist.dir}">
<fileset dir="${build.dir}">
<include name="${name}*.jar" />
</fileset>
<fileset dir="${build.dir}">
<include name="javadoc/**" />
</fileset>
<fileset dir="${build.dir}">
<include name="docs/**" />
</fileset>
<fileset dir=".">
<include name="README.html" />
<include name="LICENSE.txt" />
<include name="build.xml" />
<include name="build.properties" />
<include name=".project" />
<include name=".classpath" />
<include name="lib/**" />
<include name="src/**" />
</fileset>
</copy>
<dirname property="build.dist.dir.dirname" file="${build.dist.dir}" />
<basename property="build.dist.dir.basename" file="${build.dist.dir}" />
<zip zipfile="${build.dist.zip}" basedir="${build.dist.dir.dirname}">
<include name="${build.dist.dir.basename}/**" />
</zip>
</target>
<target name="rt-task">
<taskdef name="retroweaver" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask">
<classpath>
<fileset dir="${retroweaver.home}/lib" includes="**/*"/>
<pathelement location="${retroweaver.home}/release/retroweaver-all-${retroweaver.version}.jar"/>
</classpath>
</taskdef>
</target>
</project>