-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
204 lines (186 loc) · 8.29 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
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
~ Copyright (c) 2011. Elad Kehat.
~ This software is provided under the MIT License:
~ http://www.opensource.org/licenses/mit-license.php
-->
<project name="JZBoy" default="build.jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="src.dir" location="src" />
<property name="test.dir" location="test" />
<property name="lib.dir" location="lib" />
<property name="doc.dir" location="doc" />
<property name="build.dir" location="build" />
<property name="product.name" value="jzboy" />
<property name="version.number" value="0.3.0" />
<property name="jar.name" value="${product.name}-${version.number}.jar" />
<property name="dist.package.name" value="${product.name}-${version.number}" />
<target name="resolve" description="retrieve dependencies with ivy">
<ivy:retrieve />
</target>
<target name="clean">
<delete dir="${build.dir}" quiet="true"/>
</target>
<path id="classpath.build">
<pathelement location="${lib.dir}/httpclient-4.1.1.jar"/>
<pathelement location="${lib.dir}/httpcore-4.1.1.jar"/>
<pathelement location="${lib.dir}/jackson-core-asl-1.5.1.jar"/>
<pathelement location="${lib.dir}/jackson-mapper-asl-1.5.1.jar"/>
<pathelement location="${lib.dir}/logback-classic-0.9.21.jar"/>
<pathelement location="${lib.dir}/logback-core-0.9.21.jar"/>
<pathelement location="${lib.dir}/slf4j-api-1.6.0.jar"/>
</path>
<target name="build.classes" depends="resolve">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}"
destdir="${build.dir}/classes"
includes="**/*.java"
deprecation="off"
debug="on"
source="1.6"
includeantruntime="false">
<classpath refid="classpath.build" />
</javac>
</target>
<target name="build.jar" depends="build.classes">
<mkdir dir="${build.dir}/jar"/>
<!-- Use this to include the lib jars in our own jar
<unjar src="${lib.dir}/httpclient-4.0.1.jar" dest="${build.dir}/jar"/>
etc.
-->
<copy todir="${build.dir}/jar">
<fileset dir="${build.dir}/classes"
includes="**/*.class"
excludes="com/jzboy/samples/**/*.class" />
</copy>
<jar destfile="${build.dir}/${jar.name}" basedir="${build.dir}/jar" />
</target>
<path id="classpath.test">
<pathelement location="${build.dir}/${jar.name}"/>
<pathelement location="${lib.dir}/junit-4.8.2.jar"/>
<pathelement location="${lib.dir}/httpclient-4.1.1.jar"/>
<pathelement location="${lib.dir}/httpcore-4.1.1.jar"/>
<pathelement location="${lib.dir}/jackson-core-asl-1.5.1.jar"/>
<pathelement location="${lib.dir}/jackson-mapper-asl-1.5.1.jar"/>
<pathelement location="${lib.dir}/logback-classic-0.9.21.jar"/>
<pathelement location="${lib.dir}/logback-core-0.9.21.jar"/>
<pathelement location="${lib.dir}/slf4j-api-1.6.0.jar"/>
<pathelement location="${lib.dir}/jcl-over-slf4j-1.6.0.jar"/>
</path>
<target name="build.tests" depends="build.jar">
<mkdir dir="${build.dir}/tests"/>
<javac srcdir="${test.dir}"
destdir="${build.dir}/tests"
includes="**/*.java"
deprecation="off"
debug="on"
source="1.6">
<classpath refid="classpath.test" />
</javac>
</target>
<target name="build.all" depends="build.jar, build.tests">
</target>
<target name="test" depends="build.tests">
<mkdir dir="tmp/rawtestoutput"/>
<junit fork="yes" printsummary="true" failureproperty="junit.failure">
<classpath refid="classpath.test" />
<classpath>
<pathelement location="${build.dir}/tests" />
</classpath>
<formatter type="plain" usefile="false" />
<batchtest todir="tmp/rawtestoutput">
<fileset dir="${build.dir}/tests" includes="**/*Test.class" />
<formatter type="xml" />
</batchtest>
</junit>
<junitreport todir="tmp">
<fileset dir="tmp/rawtestoutput"/>
<report todir="test-reports"/>
</junitreport>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
<target name="javadoc" depends="build.all">
<delete dir="${doc.dir}" quiet="true"/>
<javadoc sourcepath="${src.dir}"
destdir="${doc.dir}"
classpathref="classpath.test"
author="true"
version="true"
use="true"
windowtitle="JZBoy API"
linksource="yes">
</javadoc>
</target>
<target name="dist.src" depends="build.all, javadoc">
<mkdir dir="${build.dir}/${dist.package.name}"/>
<copy file="${build.dir}/${jar.name}" todir="${build.dir}/${dist.package.name}"/>
<copy todir="${build.dir}/${dist.package.name}">
<fileset dir=".">
<include name="LICENSE"/>
<include name="build.xml"/>
<include name="doc/**/*"/>
<include name="lib/**/*"/>
<include name="src/**/*"/>
<include name="test/**/*"/>
</fileset>
</copy>
<tar destfile="${build.dir}/${dist.package.name}-src.tar.gz"
basedir="${build.dir}"
includes="${dist.package.name}/**/*"
compression="gzip" />
<zip destfile="${build.dir}/${dist.package.name}-src.zip"
basedir="${build.dir}"
includes="${dist.package.name}/**/*" />
</target>
<target name="dist.bin" depends="build.jar">
<mkdir dir="${build.dir}/${dist.package.name}"/>
<tar destfile="${build.dir}/${dist.package.name}-bin.tar.gz" compression="gzip">
<fileset dir="." includes="LICENSE"/>
<fileset dir="${build.dir}" includes="${jar.name}"/>
</tar>
<zip destfile="${build.dir}/${dist.package.name}-bin.zip">
<fileset dir="." includes="LICENSE"/>
<fileset dir="${build.dir}" includes="${jar.name}"/>
</zip>
</target>
<target name="dist.bin-with-deps" depends="build.jar">
<mkdir dir="${build.dir}/${dist.package.name}"/>
<mkdir dir="${build.dir}/${dist.package.name}/lib"/>
<copy todir="${build.dir}/${dist.package.name}/lib">
<fileset dir="${lib.dir}" includes="*.jar"/>
</copy>
<tar destfile="${build.dir}/${dist.package.name}-bin-with-deps.tar.gz" compression="gzip">
<fileset dir="." includes="LICENSE"/>
<fileset dir="${build.dir}" includes="${jar.name}"/>
<tarfileset dir="${lib.dir}" prefix="lib"
includes="httpclient-4.1.1.jar httpcore-4.1.1.jar jackson-core-asl-1.5.1.jar jackson-mapper-asl-1.5.1.jar slf4j-api-1.6.0.jar"
/>
</tar>
<zip destfile="${build.dir}/${dist.package.name}-bin-with-deps.zip">
<fileset dir="." includes="LICENSE"/>
<fileset dir="${build.dir}" includes="${jar.name}"/>
<zipfileset dir="${lib.dir}" prefix="lib"
includes="httpclient-4.1.1.jar httpcore-4.1.1.jar jackson-core-asl-1.5.1.jar jackson-mapper-asl-1.5.1.jar slf4j-api-1.6.0.jar"
/>
</zip>
</target>
<target name="dist.javadoc" depends="javadoc">
<mkdir dir="${build.dir}/${dist.package.name}"/>
<copy todir="${build.dir}/${dist.package.name}">
<fileset dir=".">
<include name="LICENSE"/>
<include name="doc/**/*"/>
</fileset>
</copy>
<tar destfile="${build.dir}/${dist.package.name}-docs.tar.gz" compression="gzip">
<fileset dir="." includes="LICENSE"/>
<tarfileset dir="${doc.dir}" prefix="doc" includes="**/*"/>
</tar>
<zip destfile="${build.dir}/${dist.package.name}-docs.zip">
<fileset dir="." includes="LICENSE"/>
<zipfileset dir="${doc.dir}" prefix="doc" includes="**/*"/>
</zip>
</target>
<target name="dist.all" depends="dist.src, dist.javadoc, dist.bin, dist.bin-with-deps">
</target>
</project>