This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
build.xml
221 lines (164 loc) · 6.97 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
<!--
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="opencsv" default="jar">
<target name="init" description="Initialise build parameters">
<property name="src.dir" location="src"/>
<property name="test.dir" location="test"/>
<property name="doc.dir" location="doc"/>
<property name="classes.dir" location="build/classes"/>
<property name="test.classes.dir" location="build/test.classes"/>
<property name="reports.dir" location="build/reports"/>
<property name="deploy.dir" location="deploy"/>
<property name="lib.dir" location="lib"/>
<property name="app.name" value="opencsv"/>
<!-- where resulting binaries are placed -->
<property name="dist.src.dir" location="${deploy.dir}/src"/>
<!-- Setup our version info -->
<property name="version.file" value="build.version"/>
<property file="${version.file}"/>
<property name="build.version.brief"
value="${build.release.major}.${build.release.minor}"/>
<property name="build.version"
value="${build.version.brief}.${build.number}"/>
<property name="build.version.tag"
value="Release_${build.release.major}_${build.release.minor}_${build.number}"/>
<property name="zip.dir.name"
value="${app.name}-${build.release.major}.${build.release.minor}"/>
<mkdir dir="${deploy.dir}"/>
<!-- Setup a useful classpath -->
<path id="useful.jars">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
</target>
<target name="build" depends="init" description="Compile opencsv">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}"
classpathref="useful.jars"/>
</target>
<target name="jar" depends="clean,build" description="Create opencsv jar file">
<mkdir dir="${deploy.dir}"/>
<tstamp>
<format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss" locale="en"/>
</tstamp>
<jar destfile="${deploy.dir}/${app.name}-${build.version.brief}.jar"
basedir="${classes.dir}">
<include name="**/*.class"/>
<manifest>
<attribute name="Build-Timestamp" value="${build.timestamp}" />
<attribute name="Implementation-Title" value="${app.name}" />
<attribute name="Implementation-Version" value="${build.version.brief}" />
</manifest>
</jar>
</target>
<target name="deploy.src" depends="jar,javadoc"
description="Deploys a source code distro">
<delete dir="${dist.src.dir}/${zip.dir.name}"/>
<mkdir dir="${dist.src.dir}/${zip.dir.name}"/>
<copy todir="${dist.src.dir}/${zip.dir.name}">
<fileset dir="${basedir}">
<include name="src/**/*.*"/>
<include name="test/**/*.*"/>
<include name="lib/**/*.*"/>
<include name="doc/**/*.*"/>
<include name="examples/**/*.*"/>
<include name="deploy/*.jar"/>
</fileset>
<fileset dir="${basedir}" includes="*.*"/>
</copy>
<property name="src.tar.name"
value="${dist.src.dir}/${zip.dir.name}-src-with-libs.tar"/>
<tar destfile="${src.tar.name}" basedir="${dist.src.dir}"
includes="${zip.dir.name}/**/*.*"/>
<gzip src="${src.tar.name}" destfile="${src.tar.name}.gz"/>
<delete file="${src.tar.name}"/>
</target>
<target name="test" depends="build" description="Runs junit test suite">
<mkdir dir="${test.classes.dir}"/>
<javac srcdir="${test.dir}" destdir="${test.classes.dir}"
classpathref="useful.jars">
<classpath>
<pathelement location="${classes.dir}"/>
</classpath>
</javac>
<mkdir dir="${reports.dir}/junit/xml"/>
<junit printsummary="yes" haltonerror="no" haltonfailure="no" fork="true">
<classpath>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${classes.dir}"/>
<pathelement location="${test.classes.dir}"/>
</classpath>
<formatter type="plain" usefile="false"/>
<formatter type="xml" usefile="true"/>
<batchtest todir="${reports.dir}/junit/xml">
<fileset dir="${test.classes.dir}" includes="**/*Test.class"/>
</batchtest>
</junit>
<!--
<java classname="au.com.bytecode.opencsv.CSVReaderTest">
<classpath>
<pathelement location="${lib.dir}/junit.jar"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${test.classes.dir}"/>
</classpath>
</java>
-->
</target>
<target name="report" depends="test" description="Generate JUnit report files">
<mkdir dir="${reports.dir}/junit/html"/>
<junitreport todir="${reports.dir}/junit/html">
<fileset dir="${reports.dir}/junit/xml">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports.dir}/junit/html"/>
</junitreport>
</target>
<target name="clean" depends="init" description="Remove all class files">
<delete dir="${classes.dir}"/>
<delete dir="${test.classes.dir}"/>
<delete dir="${deploy.dir}"/>
</target>
<target name="version" depends="init"
description="Update the version file and tag the CVS build">
<cvs command="update ${version.file}" failonerror="true"/>
<propertyfile file="${version.file}"
comment="OpenCSV Version Build Properties File.">
<entry key="build.number" type="int" default="0" operation="+"
pattern="000"/>
<entry key="build.release.minor" type="int"
value="${build.release.minor}" pattern="0"/>
<entry key="build.release.major" type="int"
value="${build.release.major}" pattern="0"/>
<entry key="build.date" type="date" value="now"/>
<entry key="build.user" type="string" value="${user.name}"/>
</propertyfile>
<cvs command="commit -m Release ${version.file}" failonerror="true"/>
<property file="${version.file}"/>
<echo>CVS Tag is ${build.version.tag}. Version is ${build.version}</echo>
<cvs command="tag -R ${build.version.tag}" failonerror="true"/>
</target>
<target name="javadoc" depends="init"
description="Generate javadoc for the package">
<javadoc packagenames="au.com.bytecode.opencsv.*" sourcepath="src"
defaultexcludes="yes" destdir="${doc.dir}/api" author="true" version="true"
use="true" windowtitle="opencsv API ${build.version.brief}">
<doctitle><![CDATA[<h1>opencsv</h1>]]>
</doctitle>
<bottom><![CDATA[<i>Copyright © 2005-2007 <a href="http://www.bytecode.com.au"/>Bytecode Pty Ltd.</a></i>]]>
</bottom>
</javadoc>
</target>
</project>