-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
210 lines (168 loc) · 5.9 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
<?xml version="1.0"?>
<project name="kaptcha" default="war" basedir=".">
<property name="name" value="${ant.project.name}" />
<property file="user.properties" />
<property file="${user.home}/build.properties" />
<property file="build.properties" />
<property file="jar.properties" />
<property name="base.dir" location="." />
<property name="lib.dir" location="./lib" />
<property name="build.dir" location="target" />
<property name="build.debug" value="on" />
<property name="build.deprecation" value="on" />
<property name="ant.build.javac.target" value="1.5" />
<property name="ant.build.javac.source" value="1.5" />
<property name="retroweaver.version" value="2.0.7" />
<property name="retroweaver.home" value="../retroweaver-${retroweaver.version}" />
<tstamp/>
<tstamp>
<format property="YEAR" pattern="yyyy" />
</tstamp>
<!-- ******************************************************** -->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="${servlet.jar}" />
<include name="${pixels.jar}" />
</fileset>
</path>
<path id="test.classpath">
<path refid="classpath" />
<fileset dir="${lib.dir}">
<include name="${junit.jar}"/>
</fileset>
<pathelement location="${build.dir}/classes" />
<pathelement location="${build.dir}/test/classes" />
</path>
<!-- ******************************************************** -->
<target name="jar" depends="init">
<mkdir dir="${build.dir}/classes" />
<unjar src="${lib.dir}/${pixels.jar}" dest="${build.dir}/pixels"/>
<copy todir="${build.dir}/classes">
<fileset dir="${build.dir}/pixels">
<include name="**/*.class" />
</fileset>
</copy>
<javac
srcdir="${base.dir}/src/"
destdir="${build.dir}/classes"
includeAntRuntime="false"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${ant.build.javac.target}"
source="${ant.build.javac.source}"
encoding="UTF-8">
<classpath refid="classpath" />
</javac>
<jar jarfile="${build.dir}/${name}-${version}.jar">
<fileset dir="${build.dir}/classes"/>
<manifest>
<attribute name="Specification-Version" value="${version}" />
<attribute name="Implementation-Version" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="war" depends="jar">
<war destfile="${build.dir}/${name}.war"
webxml="${base.dir}/src/resources/web.xml">
<fileset dir="${base.dir}/doc/">
<include name="*.jsp" />
</fileset>
<lib dir="${build.dir}">
<include name="${name}-${version}.jar"/>
</lib>
</war>
</target>
<target name="dist" depends="init-dist, clean, war, javadoc">
<copy todir="${build.dir}/${dist.name}/">
<fileset dir=".">
<include name="doc/**" />
<include name="README.txt" />
<include name="LICENSE.txt" />
</fileset>
</copy>
<copy todir="${build.dir}/${dist.name}/">
<fileset dir="${build.dir}">
<include name="javadoc/**" />
</fileset>
</copy>
<copy todir="${build.dir}/${dist.name}/">
<fileset dir=".">
<include name="src/**" />
</fileset>
</copy>
<copy file="${build.dir}/${name}-${version}.jar" todir="${build.dir}/${dist.name}/" />
<copy file="${build.dir}/${name}.war" todir="${build.dir}/${dist.name}/" />
<retroweaver inputjar="${build.dir}/${name}-${version}.jar"
outputjar="${build.dir}/${dist.name}/${name}-${version}-jdk14.jar" />
<zip zipfile="${build.dir}/${dist.name}.zip" basedir="${build.dir}/${dist.name}" />
</target>
<target name="javadoc" depends="init">
<property name="javadoc.dir" location="${build.dir}/javadoc" />
<mkdir dir="${javadoc.dir}"/>
<javadoc
destdir="${javadoc.dir}"
packagenames="*"
author="true"
version="true"
windowtitle="kaptcha Javadoc">
<classpath refid="classpath" />
<fileset dir="${base.dir}/src/java"/>
<doctitle><![CDATA[<h1>kaptcha</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © ${YEAR} <a href="http://code.google.com/p/kaptcha/">Kaptcha</a>. All Rights Reserved. Build version: ${version}</i>]]></bottom>
</javadoc>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="init-dist" depends="rt-task">
<input addproperty="version" message="Version number?" />
<property name="dist.name" value="${name}-${version}" />
</target>
<target name="init">
<typedef resource="com/googlecode/svntask/svntask.xml">
<classpath>
<fileset dir="${base.dir}/lib">
<include name="svnkit.jar"/>
<include name="svntask.jar"/>
</fileset>
</classpath>
</typedef>
<svn><info path="${base.dir}" revisionProperty="revisionVersion" /></svn>
<!-- A hack because svnant does not respect Ant's properties can't be overwritten rule. -->
<property name="version" value="${revisionVersion}" />
</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>
<target name="junit-compile" depends="jar">
<mkdir dir="${build.dir}/test/classes"/>
<javac
srcdir="${base.dir}/test/java"
destdir="${build.dir}/test/classes"
includeAntRuntime="false"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${ant.build.javac.target}"
source="${ant.build.javac.source}">
<classpath refid="test.classpath"/>
</javac>
</target>
<target name="junit" depends="junit-compile">
<junit printsummary="yes" showoutput="yes" fork="yes" haltonfailure="yes">
<jvmarg value="-Dlog4j.configuration=file:${base.dir}/test/log4j.properties"/>
<classpath refid="test.classpath"/>
<formatter type="plain" />
<formatter type="xml" />
<batchtest todir="${build.dir}/test/">
<fileset dir="${build.dir}/test/classes">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
</project>