-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
222 lines (193 loc) · 8.14 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
<project name="SolrMarc" default="jar" basedir=".">
<description>
A total rewrite of the SolrMarc project
</description>
<!-- set global properties for this build -->
<property file="build.properties" />
<property name="src" location="src"/>
<property name="src.tests" location="test/src"/>
<property name="test" location="test"/>
<property name="build" location="build"/>
<property name="build.tests" location="test/build"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="distlib" location="dist/lib"/>
<property name="reports.tests" location="logs"/>
<property name="custom.jar.name" value="solrmarc_core"/>
<!-- import other ant scripts -->
<property name="buildtools.path" location="buildtools" />
<import file="${buildtools.path}/parser_tasks.xml" optional="true" />
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="precompile" unless="precompile.already.run"
description="run jflex and cup to generate javafiles for parser and scanner" >
<jflex file="${src}/org/solrmarc/index/indexer/FullScanner.lex" verbose="true"
outdir="${src}/org/solrmarc/index/indexer/" nobak="true" />
<cup srcfile="${src}/org/solrmarc/index/indexer/FullConditionalParser.cup"
destdir="${src}"
package="org.solrmarc.index.indexer"
symbols="FullSym"
parser="FullConditionalParser"
/>
<property name="precompile.already.run" value="true" />
</target>
<target name="compile" depends="init,precompile" unless="compile.already.run"
description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
<javac target="1.7" source="1.7" srcdir="${src}" destdir="${build}" debug="true" debuglevel="lines,vars,source" >
<classpath >
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<classpath >
<fileset dir="lib-solrj">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<property name="compile.already.run" value="true" />
</target>
<target name="jar" depends="compile" unless="jar.already.run"
description="Build custom jar file containing custom code" >
<mkdir dir="${dist}" />
<path id="libjarfiles" >
<fileset dir="${lib}" includes="*.jar" />
</path>
<copy todir="${distlib}" flatten="true">
<path refid="libjarfiles"/>
</copy>
<!-- <manifestclasspath property="manifest.classpath" jarfile="${dist}/${custom.jar.name}.jar">
<classpath>
<fileset dir="${distlib}" includes="*.jar"/>
</classpath>
</manifestclasspath> -->
<jar destfile="${dist}/${custom.jar.name}_${version}.jar">
<manifest>
<attribute name="Main-Class" value="org.solrmarc.driver.Boot"/>
<attribute name="Version" value="${version}"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
<!-- <fileset dir="${basedir}" includes="log4j.properties" /> -->
<fileset dir="${build}" includes="**/*.class" />
</jar>
<echo message="jar built" />
<property name="jar.already.run" value="true" />
</target>
<target name="deploy" depends="jar" unless="jar.already.run"
description="Build custom jar file containing custom code and log4j.properties" >
<mkdir dir="${dist}" />
<path id="solrjjarfiles" >
<fileset dir="lib-solrj" includes="*.jar" />
</path>
<copy todir="${dist}/lib-solrj" flatten="true">
<path refid="solrjjarfiles"/>
</copy>
<mkdir dir="${dist}/index_java/" />
<copy todir="${dist}/index_java" >
<fileset dir="index_java" includes="src/**/*.java"/>
</copy>
<mkdir dir="${dist}/translation_maps" />
<copy todir="${dist}/translation_maps" >
<fileset dir="translation_maps" includes="*.properties"/>
</copy>
<mkdir dir="${dist}/index_scripts/" />
<copy todir="${dist}/index_scripts/" >
<fileset dir="index_scripts/" includes="*.bsh"/>
</copy>
<mkdir dir="${dist}/extra_data" />
<copy todir="${dist}/extra_data" >
<fileset dir="extra_data" includes="*"/>
</copy>
<mkdir dir="${dist}/resources" />
<copy todir="${dist}/resources" >
<fileset dir="resources" includes="*.properties"/>
</copy>
<copy todir="../VuFind_Config" >
<fileset dir="${dist}" includes="solrmarc_core.jar" />
</copy>
</target>
<target name="test-compile" description="compile the source of tests">
<!-- Compile the java code from ${src} into ${build} -->
<javac target="1.7" source="1.7" srcdir="${src.tests}" destdir="${build.tests}" debug="true" debuglevel="lines,vars,source" >
<classpath >
<fileset dir="dist">
<include name="${custom.jar.name}_${version}.jar"/>
</fileset>
</classpath>
<classpath >
<fileset dir="dist/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<classpath >
<fileset dir="lib-solrj">
<include name="**/*.jar"/>
</fileset>
</classpath>
<classpath >
<fileset dir="test/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<classpath >
<fileset dir="test/data/local_lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<jar destfile="${test}/build/${custom.jar.name}_tests.jar">
<manifest>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
<!-- <fileset dir="${basedir}" includes="log4j.properties" /> -->
<fileset dir="${test}/build" includes="**/*.class" />
</jar>
</target>
<target name="test" depends="test-compile">
<junit printsummary="yes" haltonfailure="false">
<classpath>
<fileset dir="${dist}">
<include name="${custom.jar.name}_${version}.jar"/>
</fileset>
<fileset dir="${dist}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${test}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${test}/build">
<include name="${custom.jar.name}_tests.jar"/>
</fileset>
<fileset dir="lib-solrj">
<include name="*.jar"/>
</fileset>
<pathelement location="${build}"/>
<pathelement location="${build.tests}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<sysproperty key="test.data.dir" path="${test}/data" />
<sysproperty key="log4j.debug" value="false" />
<formatter type="plain"/>
<batchtest fork="yes" todir="${reports.tests}">
<fileset dir="${src.tests}">
<include name="**/*Test*.java"/>
<exclude name="**/ConditionalParserTest.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="clean"
description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>