forked from marc4j/marc4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
208 lines (182 loc) · 8.74 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
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="marc4j" default="jar" basedir=".">
<target name="init">
<tstamp />
<record name="build.log" loglevel="verbose" append="no" />
</target>
<property file="build.properties" />
<target name="prepare" depends="init,setup-ivy" unless="prepared">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes.dir}"/>
<mkdir dir="${build.test-classes.dir}"/>
<mkdir dir="${build.generated-src.dir}"/>
<mkdir dir="${lib.dir}"/>
<ivy:retrieve />
<property name="prepared" value="true"/>
</target>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="test.classpath">
<pathelement location="${build.classes.dir}" />
<pathelement location="${build.test-classes.dir}" />
<pathelement location="test/resources"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="prepare-codetablegen" depends="prepare">
<mkdir dir="${build.generated-src.dir}/org/marc4j/converter/impl" />
<dependset>
<srcfileset dir="${src.dir}/org/marc4j/converter/impl/"/>
<targetfileset dir="${build.generated-src.dir}/org/marc4j/converter/impl/" includes="*.java"/>
</dependset>
<available file="${build.generated-src.dir}/org/marc4j/converter/impl/CodeTableGenerated.java" property="already.ctged"/>
</target>
<target name="codetablegen" depends="prepare-codetablegen" unless="already.ctged">
<java fork="true" classname="org.marc4j.converter.impl.CodeTableGenerator" output="${build.generated-src.dir}/org/marc4j/converter/impl/CodeTableGenerated.java" >
<classpath location="${build.classes.dir}" />
</java>
<java fork="true" classname="org.marc4j.converter.impl.ReverseCodeTableGenerator" output="${build.generated-src.dir}/org/marc4j/converter/impl/ReverseCodeTableGenerated.java" >
<classpath location="${build.classes.dir}" />
</java>
</target>
<target name="compile-codegen" depends="codetablegen">
<javac encoding="UTF-8" srcdir="${build.generated-src.dir}" destdir="${build.classes.dir}" includes="**/*Generated.java" debug="false">
<classpath refid="classpath" />
</javac>
</target>
<target name="compile-all" depends="compile-base,compile-codegen"/>
<target name="compile-base" depends="prepare">
<javac encoding="UTF-8" srcdir="${src.dir}" destdir="${build.classes.dir}" includes="**/*.java" excludes="**/*Generated.java" debug="true" debuglevel="source,lines,vars">
<classpath refid="classpath" />
</javac>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.properties" />
<include name="**/*.xml" />
<exclude name="**/tests/*" />
<exclude name="**/tests" />
</fileset>
</copy>
</target>
<target name="compile-tests" depends="compile-all">
<javac encoding="UTF-8" srcdir="${test.src.dir}" destdir="${build.test-classes.dir}" includes="**/*.java" excludes="**/*Generated.java" debug="true" debuglevel="source,lines,vars">
<classpath refid="test.classpath" />
</javac>
</target>
<target name="test" depends="compile-all,compile-tests">
<junit fork="yes" forkmode="perBatch" haltonfailure="true">
<batchtest>
<fileset dir="${test.src.dir}">
<exclude name="org/marc4j/test/utils/**"/>
</fileset>
</batchtest>
<formatter type="brief" usefile="false" />
<classpath refid="test.classpath" />
</junit>
</target>
<target name="jar" depends="compile-all">
<jar jarfile="${build.dir}/${jar.name}">
<manifest>
<section name="org/marc4j">
<attribute name="Specification-Title" value="marc4j"/>
<attribute name="Specification-Version" value="${specversion}"/>
<attribute name="Specification-Vendor" value="org.marc4j"/>
<attribute name="Implementation-Title" value="marc4j"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Team marc4j"/>
</section>
</manifest>
<fileset dir="${build.classes.dir}">
<include name="**/*.class" />
<exclude name="**/CodeTableGenerator.class" />
<exclude name="**/ReverseCodeTableGenerator.class" />
<exclude name="**/samples/**/*.*" />
<exclude name="**/solrmarc/**/*.class" />
<exclude name="**/test/**/*.*" />
<include name="**/*.properties" />
<exclude name="**/*.xml" />
</fileset>
</jar>
</target>
<target name="javadoc" depends="prepare">
<mkdir dir="${apidoc.dir}" />
<javadoc encoding="UTF-8" charset="UTF-8" docencoding="UTF-8" destdir="${apidoc.dir}" author="true" version="true" overview="overview.html" use="true" windowtitle="MARC4J API" doctitle="MARC4J API" bottom="Copyright © 2002-2006 Bas Peters. All Rights Reserved.">
<packageset dir="src" defaultexcludes="yes">
<exclude name="org/marc4j/samples" />
<exclude name="org/marc4j/test" />
</packageset>
<classpath refid="classpath" />
<link offline="true" href="http://java.sun.com/products/jdk/1.4/docs/api/" packagelistLoc="." />
<link href="http://java.sun.com/j2se/1.4.2/docs/api/" />
</javadoc>
</target>
<target name="clean" depends="init">
<delete dir="${dist.dir}" />
<delete dir="${build.dir}" />
</target>
<target name="distclean" depends="clean">
<delete dir="${lib.dir}"/>
<delete dir="${ivy.jar.dir}"/>
</target>
<target name="dist" depends="jar,javadoc">
<property name="prefix" value="${project.name}-${version}" />
<property name="tmp.dir" value="${dist.dir}/tmp" />
<property name="tmp.arc.dir" value="${tmp.dir}/${prefix}" />
<property name="dist.arc" value="${dist.dir}/${prefix}" />
<mkdir dir="${tmp.arc.dir}" />
<copy todir="${tmp.arc.dir}">
<fileset dir=".">
<include name="LICENSE.*" />
<include name="build.*" />
<exclude name="*.log" />
<include name="*.jar" />
<include name="*.html" />
</fileset>
</copy>
<copy todir="${tmp.arc.dir}" file="${build.dir}/${jar.name}"/>
<copy todir="${tmp.arc.dir}/${src.dir}">
<fileset dir="${src.dir}" >
<exclude name="**/CodeTableGenerated.java" />
</fileset>
</copy>
<copy todir="${tmp.arc.dir}/${test.src.dir}">
<fileset dir="${test.src.dir}" >
</fileset>
</copy>
<copy todir="${tmp.arc.dir}/${lib.dir}">
<fileset dir="${lib.dir}">
<exclude name="junit*.jar" />
</fileset>
</copy>
<copy todir="${tmp.arc.dir}/apidoc">
<fileset dir="${apidoc.dir}" />
</copy>
<tar tarfile="${dist.arc}.tar" basedir="${tmp.arc.dir}" />
<gzip zipfile="${dist.arc}.tar.gz" src="${dist.arc}.tar" />
<delete file="${dist.arc}.tar" />
<delete file="${dist.arc}.zip" />
<zip compress="true" basedir="${tmp.dir}" zipfile="${dist.arc}.zip" />
<delete dir="${tmp.dir}" />
</target>
<property name="ivy.install.version" value="2.3.0"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<target name="check-download" >
<available file="${ivy.jar.file}" property="skip.download"/>
</target>
<target name="download-ivy" depends="check-download" unless="skip.download">
<mkdir dir="${ivy.jar.dir}"/>
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="setup-ivy" depends="download-ivy" description="--> setup ivy" unless="prepared">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
</project>