forked from solrmarc/solrmarc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
244 lines (215 loc) · 11.5 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?xml version="1.0" encoding="UTF-8"?>
<!-- Top Level SolrMarc -->
<project basedir="." default="dist" name="SolrMarc Custom">
<!-- property files -->
<property file="build.properties" />
<property name="site.dir" value="local_build" />
<property name="buildtools.dir" value="buildtools" />
<property name="buildtools.path" location="${buildtools.dir}" />
<!-- import other ant scripts -->
<!-- import ant_extras.xml which defines several general purpose macros most drawn from the ant-contrib package -->
<property name="ant_extras.dist.dir" location="${buildtools.path}" />
<import file="${buildtools.path}/ant_extras.xml" />
<!-- import ant_init.xml which defines all of the macros used by the site initialization process -->
<import file="${buildtools.path}/ant_init.xml" />
<!-- import ant_package.xml which defines all of the macros used to create the source and binary distribution packages -->
<property name="ant_package.dist.dir" location="${buildtools.path}" />
<import file="${buildtools.path}/ant_package.xml" />
<property name="package.dir" value="package" />
<property name="version" value="2.9" />
<tstamp>
<format property="year" pattern="yyyy" />
<format property="DSTAMP" pattern="yyyy-MM-dd" />
<format property="TSTAMP" pattern="HH:mm:ss" />
<format property="dateversion" pattern="yyyy.MM.dd.HH.mm.ss" />
</tstamp>
<target name="clean" description="clean the generated directories">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<ant dir="${lib.dir}/solrmarc" target="clean" inheritAll="false" />
<if>
<and>
<isset property="site.dir" />
<available file="${site.dir}/build.xml" />
</and>
<then>
<ant dir="${site.dir}" target="clean" inheritAll="false" />
</then>
</if>
</target>
<target name="veryclean" depends="clean"
description="clean any generated files and restore the
project as near as possible to a just-downloaded state">
<property name="package.dir" value="package" />
<delete dir="${package.dir}" />
<delete dir="${site.dir}" />
</target>
<target name="init" depends="init_site" unless="init.already.run"
description="create (empty) generated directories">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
<property name="init.already.run" value="true" />
</target>
<target name="init_site" unless="init_site.already.run"
description="Initialize (or update) a local site based on an example">
<property name="solr.version" value="external" />
<property name="solr.version.external" value="true" />
<echo message="solr version: ${solr.version}" />
<build_solrmarc />
<check_site_dir_created propertytoset="init.site_dir_created" />
<init_site_props />
<if>
<isset property="init.site_dir_created" />
<then>
<echo message="site_dir ${site.dir} already inited skipping forward. " />
<property file="${site.dir}/build.properties" />
<check_up_to_date_vs_example />
<get_indexer_class />
</then>
<else>
<get_example_config_to_use property="example.configuration" />
<if>
<equals arg1="${example.configuration}" arg2="none" />
<then>
<init_from_empty_config />
<copy_test_solr_configuration />
</then>
<else>
<init_from_example example="${example.configuration}" />
<copy_test_solr_configuration />
</else>
</if>
</else>
</if>
<copy_solrmarc />
<property name="init_site.already.run" value="true" />
</target>
<target name="compile" depends="init"
description="Invoke target compile in the site specific directory">
<ant antfile="${site.dir}/build.xml" target="compile" inheritAll="false" />
</target>
<target name="build" depends="init"
description="Invoke target build in the site specific directory">
<ant antfile="${site.dir}/build.xml" target="build" inheritAll="false" >
</ant>
</target>
<target name="dist" depends="init"
description="Invoke target dist in the site specific directory">
<ant antfile="${site.dir}/build.xml" target="dist" inheritAll="false" >
<property name="dist.path" location="${dist.dir}" />
</ant>
</target>
<target name="package" description="Create both prebuilt binary distributions and a source distribution" >
<mkdir dir="${package.dir}" />
<packagesrc version="${version}" />
<packageprebuilt example="GenericBlacklight" binprefix="bin" version="${version}" />
<packageprebuilt example="GenericVuFind" binprefix="bin" version="${version}" />
<packageprebuilt example="none" binprefix="bin" acceptpromptdefaults="true" version="${version}" />
</target>
<target name="upload" description="Upload prebuilt binary distributions and a source distribution to googlecode" >
<if>
<available file="build.credentials.properties" />
<then>
<property file="build.credentials.properties" />
<fail unless="gc.username" message="Missing property 'gc.username' from file 'build.credentials.properties'."/>
<fail unless="gc.password" message="Missing property 'gc.password' from file 'build.credentials.properties'."/>
<uploadsrc username="${gc.username}" password="${gc.password}" version="${version}" />
<uploadprebuilt username="${gc.username}" password="${gc.password}" example="GenericBlacklight"
sitelabel="Blacklight site" version="${version}" />
<uploadprebuilt username="${gc.username}" password="${gc.password}" example="GenericVuFind"
sitelabel="VuFind site" version="${version}" />
<uploadprebuilt username="${gc.username}" password="${gc.password}" example="none"
sitelabel="Custom Configuration (for non-Blacklight and non-VuFind site)" version="${version}" />
</then>
<else>
<fail message="Can't find file 'build.credentials.properties'."/>
</else>
</if>
</target>
<target name="usage" description="Prints usage instructions">
<echo message="Welcome to the Solrmarc indexing project" />
<echo message="Use 'ant' to build the latest code" />
<echo message="For developers" />
<echo message="Use 'ant clean' to clean the compiled source directory" />
<echo message="Use 'ant package-src' to build a gzipped tarball of the source code for distribution" />
<echo message="Use 'ant package-prebuilt' to build a gzipped tarball of a pre-built, pre-configured, binary release" />
<echo message="Use 'ant test' to run unit tests" />
<echo message="To build and test an example configuration in its own sub directory do the following:" />
<echo message=" ant -Dsite.dir=test-GenericBlacklight -Ddist.path=dist dist test" />
<echo message="Use 'ant javadoc' to build SolrMarc API documentation" />
</target>
<!-- Site Testing Targets -->
<target name="test" depends="init" description="Run all three test suites in local build directory: smoketest, indextest and junittest">
<ant antfile="${site.dir}/build.xml" target="test" inheritAll="false" >
<property name="dist.path" location="${dist.dir}" />
</ant>
</target>
<target name="core_junittest" depends="init" description="Run junittest test suite in local build directory">
<ant antfile="${site.dir}/build.xml" target="core_junittest" inheritAll="false" >
<property name="dist.path" location="${dist.dir}" />
</ant>
</target>
<target name="site_junittest" depends="init" description="Run junittest test suite in local build directory">
<ant antfile="${site.dir}/build.xml" target="site_junittest" inheritAll="false" >
<property name="dist.path" location="${dist.dir}" />
</ant>
</target>
<target name="smoketest" depends="init" description="Run smoketest test suite in local build directory">
<ant antfile="${site.dir}/build.xml" target="smoketest" inheritAll="false" >
<property name="dist.path" location="${dist.dir}" />
</ant>
</target>
<target name="site_indextest" depends="init" description="Run indextest test suite in local build directory">
<ant antfile="${site.dir}/build.xml" target="site_indextest" inheritAll="false" >
<property name="dist.path" location="${dist.dir}" />
</ant>
</target>
<target name="core_indextest" depends="init" description="Run indextest test suite from top-level directory">
<ant antfile="${site.dir}/build.xml" target="core_indextest" inheritAll="false" >
<property name="dist.path" location="${dist.dir}" />
</ant>
</target>
<target name="runCoreTestsWithCoverage" description="Run tests for Core SolrMarc code with code coverage info">
<propertyregex property="site.dir" input="${site.dir}" regexp="local_build" replace="core-only" defaultValue="core-only" override="true" />
<antcall target="veryclean" >
<param name="site.dir" value="core-only"/>
<param name="build.dir" value="core-only/build"/>
<param name="dist.dir" value="core-only/dist"/>
</antcall>
<antcall target="init" inheritAll="false" >
<param name="site.dir" value="core-only"/>
<param name="input.continue.processing.with.not.uptodate" value="c"/>
<param name="example.configuration" value="none"/>
<param name="dist.path" value="dist"/>
<param name="custom.config.file.prefix" value="core"/>
<param name="exe.mem.args" value="-Xmx256m"/>
<param name="marc.encoding" value="MARC8"/>
<param name="use.builtin.solr" value="builtin"/>
</antcall>
<ant antfile="core-only/build.xml" target="testCoverage" inheritAll="false" >
<property name="site.dir" value="core-only"/>
<property name="dist.path" location="core-only/${dist.dir}" />
</ant>
</target>
<target name="junitreport"
description="Format junit test reports site in site directory">
<ant antfile="${site.dir}/build.xml" target="junitreport" inheritAll="false" />
</target>
<!-- Build Javadoc -->
<target name="javadoc"
description="Build java api documentation">
<javadoc packagenames="org.solrmarc.*"
sourcepath="lib/solrmarc/src"
destdir="docs/api"
windowtitle="SolrMarc API">
<classpath>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
<doctitle>SolrMarc API</doctitle>
<header>SolrMarc API</header>
<footer>SolrMarc API</footer>
</javadoc>
</target>
</project>