forked from hyphanet/plugin-Freemail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
241 lines (217 loc) · 7.73 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
<?xml version="1.0"?>
<project name="Freemail" default="default" basedir="." xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<!--
build.properties holds the default values for the properties that
people might want to change. Use override.properties to set new
values without getting in trouble with Git.
-->
<property name="override" location="override.properties" />
<property file="${override}"/>
<property file="build.properties"/>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="test.run" location="run"/>
<property name="build" location="build"/>
<property name="build-test" location="build-test"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="version.src" value="org/freenetproject/freemail/Version.java"/>
<property name="version.build" value="org/freenetproject/freemail/Version.class"/>
<property name="tools.src" location="tools/src"/>
<property name="tools.dst" location="tools/build"/>
<exec executable="git"
failifexecutionfails="false"
errorProperty="git.errror"
outputproperty="git.describe"
resultproperty="git.result">
<arg value="describe" />
<arg value="--always" />
<arg value="--abbrev=1" />
<arg value="--dirty" />
</exec>
<condition property="git.revision" value="${git.describe}" else="@unknown@">
<and>
<equals arg1="${git.result}" arg2="0" />
<isset property="git.describe" />
</and>
</condition>
<!--
Convenience targets
-->
<target name="all" depends="unit, dist, checkstyle, compile-tools"/>
<target name="default" depends="unit, dist"/>
<!--
Real targets
-->
<target name="compile"
description="Compiles the Freemail source code">
<mkdir dir="${build}"/>
<tstamp/>
<!-- Create the Version file with patched revision number in ${build} -->
<copy file="${src}/${version.src}"
tofile="${build}/${version.src}"
overwrite="true" />
<delete file="${build}/${version.build}" quiet="true" />
<replace file="${build}/${version.src}">
<replacefilter token="@custom@" value="${git.revision}"/>
</replace>
<echo message="Updated build version to ${git.revision} in ${build}/${version.src}"/>
<!-- Compile the patched version file -->
<javac srcdir="${build}"
destdir="${build}"
debug="on"
optimize="on"
source="1.6"
target="1.6"
encoding="UTF-8"
includeantruntime="false">
<include name="${version.src}"/>
<classpath>
<pathelement location="${freenet-cvs-snapshot.location}"/>
<pathelement path="${main.lib}"/>
<pathelement location="${bcprov.location}"/>
</classpath>
<compilerarg value="-Xlint"/>
</javac>
<!-- Bundle the whole lot together, unless anyone whinges.
It makes it much easier to run -->
<javac srcdir="${src}"
destdir="${build}"
debug="on"
optimize="on"
source="1.6"
target="1.6"
encoding="UTF-8"
includeantruntime="false">
<classpath>
<pathelement location="${freenet-cvs-snapshot.location}"/>
<pathelement path="${main.lib}"/>
<pathelement location="${bcprov.location}"/>
</classpath>
<compilerarg value="-Xlint"/>
</javac>
<!-- Copy l10n and css -->
<copy todir="${build}">
<fileset dir="${src}">
<include name="org/freenetproject/freemail/l10n/*.l10n" />
<include name="org/freenetproject/freemail/ui/web/css/*.css" />
<include name="org/freenetproject/freemail/ui/web/images/" />
</fileset>
</copy>
</target>
<target name="compile-tools" description="Compiles the supporting tools">
<mkdir dir="${tools.dst}"/>
<javac srcdir="${tools.src}"
destdir="${tools.dst}"
debug="on"
optimize="on"
source="1.6"
target="1.6"
encoding="UTF-8"
includeantruntime="false">
<classpath>
<pathelement location="${bouncycastle.location}"/>
</classpath>
<compilerarg value="-Xlint"/>
</javac>
</target>
<target name="unit-build" depends="compile" unless="${test.skip}">
<mkdir dir="${build-test}"/>
<javac srcdir="${test}"
destdir="${build-test}"
debug="on"
optimize="on"
source="1.6"
target="1.6"
encoding="UTF-8"
includeantruntime="false">
<classpath>
<pathelement location="${freenet-cvs-snapshot.location}"/>
<pathelement location="${bcprov.location}"/>
<pathelement location="${build}"/>
<pathelement location="${junit}"/>
<pathelement location="${hamcrest}"/>
<pathelement path="${test.lib}"/>
</classpath>
<compilerarg line="-Xlint"/>
</javac>
</target>
<target name="unit" depends="unit-build" unless="${test.skip}"
description="Runs the unit tests">
<mkdir dir="${test.run}"/>
<junit fork="yes" dir="${test.run}" haltonfailure="true">
<classpath>
<pathelement location="${freenet-cvs-snapshot.location}"/>
<pathelement location="${bcprov.location}"/>
<pathelement location="${build}"/>
<pathelement location="${build-test}"/>
<pathelement location="${junit}"/>
<pathelement location="${hamcrest}"/>
<pathelement path="${test.lib}"/>
</classpath>
<env key="test.extensive" value="${test.extensive}"/>
<env key="test.verbose" value="${test.verbose}"/>
<assertions><enable/></assertions>
<formatter type="brief" usefile="false"/>
<formatter type="xml" if="${test.xml_output}"/>
<batchtest todir="${build-test}">
<fileset dir="${build-test}">
<include name="org/freenetproject/freemail/**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<delete dir="${test.run}"/>
</target>
<target name="dist" depends="compile" description="Generates the Freemail jar">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/Freemail.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="org.freenetproject.freemail.FreemailCli"/>
<attribute name="Plugin-Main-Class" value="org.freenetproject.freemail.FreemailPlugin"/>
<attribute name="Built-By" value="${user.name}"/>
<section name="common">
<attribute name="Implementation-Title" value="Freemail"/>
<attribute name="Implementation-Version" value="0.0"/>
<attribute name="Implementation-Vendor" value="Dave Baker"/>
</section>
</manifest>
</jar>
</target>
<target name="clean" description="Removes all generated files">
<delete dir="${build}"/>
<delete dir="${build-test}"/>
<delete dir="${dist}"/>
<delete dir="${run}"/>
<delete dir="${tools.dst}"/>
</target>
<target name="distclean" depends="clean"
description="Removes all generated files and settings">
<delete dir="${lib}"/>
<delete file="${override}"/>
</target>
<!-- Checkstyle target that is run each build. Should run a
config that normally doesn't produce any warnings. -->
<target name="checkstyle-auto" unless="${checkstyle.skip}">
<cs:checkstyle config="checkstyle_auto.xml" failOnViolation="false">
<fileset dir="${src}" includes="**/*.java">
<exclude name="org/archive/**"/>
</fileset>
<fileset dir="${test}" includes="**/*.java"/>
<fileset dir="${tools.src}" includes="**/*.java"/>
<formatter type="plain"/>
</cs:checkstyle>
</target>
<!-- Checkstyle run with the full config, i.e. what we would like the
code to follow. Useful for e.g. checking new commits. -->
<target name="checkstyle" description="Runs Checkstyle on the source code">
<cs:checkstyle config="checkstyle.xml" failOnViolation="false">
<fileset dir="${src}" includes="**/*.java">
<exclude name="org/archive/**"/>
</fileset>
<fileset dir="${test}" includes="**/*.java"/>
<fileset dir="${tools.src}" includes="**/*.java"/>
<formatter type="plain"/>
</cs:checkstyle>
</target>
</project>