~slub.team/goobi-indexserver/3.x

« back to all changes in this revision

Viewing changes to solr/build.xml

  • Committer: Sebastian Meyer
  • Date: 2012-08-03 09:12:40 UTC
  • Revision ID: sebastian.meyer@slub-dresden.de-20120803091240-x6861b0vabq1xror
Remove Lucene and Solr source code and add patches instead
Fix Bug #985487: Auto-suggestion for the search interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0"?>
2
 
<!--
3
 
Licensed to the Apache Software Foundation (ASF) under one or more
4
 
contributor license agreements.  See the NOTICE file distributed with
5
 
this work for additional information regarding copyright ownership.
6
 
The ASF licenses this file to You under the Apache License, Version 2.0
7
 
(the "License"); you may not use this file except in compliance with
8
 
the License.  You may obtain a copy of the License at
9
 
 
10
 
                 http://www.apache.org/licenses/LICENSE-2.0
11
 
 
12
 
Unless required by applicable law or agreed to in writing, software
13
 
distributed under the License is distributed on an "AS IS" BASIS,
14
 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 
See the License for the specific language governing permissions and
16
 
limitations under the License.
17
 
-->
18
 
<project name="solr" default="usage">
19
 
        <description>Solr</description>
20
 
 
21
 
        <target name="usage" description="Prints out instructions">
22
 
                <echo message="Welcome to the Solr project!" />
23
 
                <echo message="Use 'ant example' to create a runnable example configuration." />
24
 
                <echo message="Use 'ant run-example' to create and run the example." />
25
 
                <echo message="And for developers:"/>
26
 
                <echo message="Use 'ant clean' to clean compiled files." />
27
 
                <echo message="Use 'ant compile' to compile the source code." />
28
 
                <echo message="Use 'ant dist' to build the project WAR and JAR files." />
29
 
                <echo message="Use 'ant javadocs' to build javadocs under build/docs/api" />
30
 
                <echo message="Use 'ant generate-maven-artifacts' to generate maven artifacts." />
31
 
                <echo message="Use 'ant package' to generate zip, tgz for distribution." />
32
 
                <echo message="Use 'ant luke' to start luke.  see: http://luke.googlecode.com" />
33
 
                <echo message="Use 'ant test' to run unit tests." />
34
 
        </target>
35
 
 
36
 
        <import file="common-build.xml"/>
37
 
 
38
 
        <!-- ========================================================================= -->
39
 
        <!-- ============================== USER TASKS =============================== -->
40
 
        <!-- ========================================================================= -->
41
 
 
42
 
        <target name="example" description="Creates a runnable example configuration."
43
 
                                        depends="dist-war">
44
 
                <copy file="${dist}/${fullnamever}.war"
45
 
                                        tofile="${example}/webapps/${ant.project.name}.war"/>
46
 
                <delete includeemptydirs="true">
47
 
                        <fileset dir="${example}/work" includes="**/*"/>
48
 
                </delete>
49
 
                <echo>See ${example}/README.txt for how to run the Solr example configuration.</echo>
50
 
        </target>
51
 
 
52
 
        <target name="run-example" depends="example"
53
 
                                        description="Run Solr interactively, via Jetty.  -Dexample.debug=true to enable JVM debugger">
54
 
                <property name="example.solr.home" location="example/solr"/>
55
 
                <property name="example.data.dir" location="example/solr/data"/>
56
 
                <property name="example.debug.suspend" value="n"/>
57
 
                <property name="example.jetty.port" value="8983"/>
58
 
                <condition property="example.jvm.line" value="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=${example.debug.suspend},address=5005">
59
 
                        <isset property="example.debug"/>
60
 
                </condition>
61
 
                <property name="example.jvm.line" value=""/>
62
 
                <property name="example.heap.size" value="512M"/>
63
 
                <java jar="${example}/start.jar" fork="true" dir="${example}" maxmemory="${example.heap.size}">
64
 
                        <jvmarg line="${example.jvm.line}"/>
65
 
                        <sysproperty key="solr.solr.home" file="${example.solr.home}"/>
66
 
                        <sysproperty key="solr.data.dir" file="${example.data.dir}"/>
67
 
                        <sysproperty key="jetty.port" value="${example.jetty.port}"/>
68
 
                </java>
69
 
        </target>
70
 
 
71
 
        <!-- setup proxy for download tasks -->
72
 
        <condition property="proxy.specified">
73
 
                <or>
74
 
                        <isset property="proxy.host"/>
75
 
                        <isset property="proxy.port"/>
76
 
                        <isset property="proxy.user"/>
77
 
                </or>
78
 
        </condition>
79
 
 
80
 
        <target name="proxy.setup" if="proxy.specified">
81
 
                <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/>
82
 
        </target>
83
 
 
84
 
        <target name="compile-xml-query-parser">
85
 
                <ant dir="${common.dir}/contrib/xml-query-parser" target="compile-core" inheritAll="false">
86
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
87
 
                </ant>
88
 
        </target>
89
 
 
90
 
        <property  name="luke.version" value="1.0.1"/>
91
 
        <available file="luke/luke-${luke.version}.jar" property="luke.jar.exists" />
92
 
        <target name="luke-download" unless="luke.jar.exists" depends="proxy.setup,compile-xml-query-parser">
93
 
                <mkdir dir="luke"/>
94
 
                <get src="http://luke.googlecode.com/files/luke-${luke.version}.jar"
95
 
                                 dest="luke/luke-${luke.version}.jar"/>
96
 
        </target>
97
 
        <path id="luke.classpath">
98
 
                <pathelement location="${common.dir}/build/classes/java" />
99
 
                <pathelement location="${common.dir}/build/contrib/xml-query-parser/classes/java" />
100
 
        </path>
101
 
        <target name="luke" depends="luke-download">
102
 
                <java fork="true"
103
 
                                        classname="org.getopt.luke.Luke"
104
 
                                        logError="true"
105
 
                                        failonerror="true">
106
 
                        <classpath>
107
 
                                <fileset dir="luke">
108
 
                                        <include name="luke-${luke.version}.jar"/>
109
 
                                </fileset>
110
 
                                <path refid="classpath"/>
111
 
                                <path refid="luke.classpath"/>
112
 
                                <path refid="test.classpath"/>
113
 
                        </classpath>
114
 
                </java>
115
 
        </target>
116
 
 
117
 
        <!-- ========================================================================= -->
118
 
        <!-- ========================== BUILD/TEST TASKS ============================= -->
119
 
        <!-- ========================================================================= -->
120
 
 
121
 
        <target name="compile" description="Compile the source code."
122
 
                                        depends="compile-core, compile-contrib"/>
123
 
        <target name="test" description="Validate, then run core and solrj unit tests."
124
 
                                        depends="validate-solr, test-core"/>
125
 
        <target name="test-core" description="Runs the core and solrj unit tests."
126
 
                                        depends="test-solr-core, test-solrj"/>
127
 
        <target name="compile-test" description="Compile unit tests."
128
 
                                        depends="compile-solr-test-framework, compile-test-solr-core, compile-test-solrj, test-jsp"/>
129
 
        <target name="javadocs" description="Calls javadocs-all, javadocs-solrj, and javadocs-test-framework"
130
 
                                        depends="javadocs-all,javadocs-solrj,javadocs-test-framework"/>
131
 
        <target name="compile-core" depends="compile-solr-core" unless="solr.core.compiled"/>
132
 
 
133
 
        <!-- Solr core targets -->
134
 
        <target name="test-solr-core" description="Test solr core">
135
 
                <ant dir="core" target="test" inheritAll="false">
136
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
137
 
                </ant>
138
 
        </target>
139
 
 
140
 
        <!-- Solrj targets -->
141
 
        <target name="test-solrj" description="Test java client">
142
 
                <ant dir="solrj" target="test" inheritAll="false">
143
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
144
 
                </ant>
145
 
        </target>
146
 
        <target name="javadocs-solrj">
147
 
                <ant dir="solrj" target="javadocs" inheritAll="false">
148
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
149
 
                </ant>
150
 
        </target>
151
 
 
152
 
        <!-- test-framework targets -->
153
 
        <target name="javadocs-test-framework">
154
 
                <ant dir="test-framework" target="javadocs" inheritAll="false">
155
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
156
 
                </ant>
157
 
        </target>
158
 
 
159
 
        <!-- Webapp targets -->
160
 
        <target name="test-jsp">
161
 
                <ant dir="webapp" target="test" inheritall="false">
162
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
163
 
                </ant>
164
 
        </target>
165
 
 
166
 
        <!-- Clean targets -->
167
 
        <target name="clean" description="Cleans compiled files and other temporary artifacts.">
168
 
                <delete dir="build" />
169
 
                <delete dir="dist" />
170
 
                <delete dir="package" />
171
 
                <delete dir="example/solr/lib" />
172
 
        </target>
173
 
 
174
 
        <target name="clean-dest"
175
 
                                        description="Cleans out build/ but leaves build/docs/, dist/ and package/ alone.  This allows us to run nightly and clover together in Hudson">
176
 
                <delete includeemptydirs="true" >
177
 
                        <fileset dir="build">
178
 
                                <exclude name="docs/"/>
179
 
                        </fileset>
180
 
                </delete>
181
 
        </target>
182
 
 
183
 
        <!-- Clover targets -->
184
 
        <target name="clover" depends="clover.setup, clover.info"
185
 
                                        description="Instrument the Unit tests using Clover.  Requires a Clover license and clover.jar in the ANT classpath.  To use, specify -Drun.clover=true on the command line."/>
186
 
 
187
 
        <target name="clover.setup" if="clover.enabled">
188
 
                <taskdef resource="cloverlib.xml"/>
189
 
                <mkdir dir="${clover.db.dir}"/>
190
 
                <clover-setup initString="${clover.db.dir}/lucene_coverage.db">
191
 
                        <fileset dir="core/src/java"/>
192
 
                        <fileset dir="solrj/src/java"/>
193
 
                        <testsources dir="test-framework/src/java"/>
194
 
                        <testsources dir="core/src/test"/>
195
 
                        <testsources dir="solrj/src/test"/>
196
 
                </clover-setup>
197
 
        </target>
198
 
 
199
 
        <target name="clover.info" unless="clover.present">
200
 
                <echo>
201
 
                        Clover not found. Code coverage reports disabled.
202
 
                </echo>
203
 
        </target>
204
 
 
205
 
        <target name="clover.check">
206
 
        <fail unless="clover.present">
207
 
                ##################################################################
208
 
                        Clover not found.
209
 
                        Please make sure clover.jar is in ANT_HOME/lib, or made available
210
 
                        to Ant using other mechanisms like -lib or CLASSPATH.
211
 
                        ##################################################################
212
 
                </fail>
213
 
        </target>
214
 
 
215
 
        <!-- Run after Junit tests. -->
216
 
        <target name="generate-clover-reports" depends="clover.check, clover">
217
 
                <mkdir dir="${clover.report.dir}"/>
218
 
                <clover-report>
219
 
                         <current outfile="${clover.report.dir}/clover.xml"
220
 
                                                                title="${fullnamever}">
221
 
                                        <format type="xml"/>
222
 
                         </current>
223
 
                         <current outfile="${clover.report.dir}" title="${fullnamever}">
224
 
                                        <format type="html"/>
225
 
                         </current>
226
 
                </clover-report>
227
 
        </target>
228
 
 
229
 
        <!-- ========================================================================= -->
230
 
        <!-- ===================== DISTRIBUTION-RELATED TASKS ======================== -->
231
 
        <!-- ========================================================================= -->
232
 
 
233
 
        <target name="copy-to-stage">
234
 
                <copy-to-stage-macro artifacts.dir="${package.dir}"/>
235
 
        </target>
236
 
 
237
 
        <target name="dist"
238
 
                                        description="Creates the Solr distribution files."
239
 
                                        depends="dist-solrj, dist-core, dist-test-framework, dist-war" />
240
 
 
241
 
        <target name="dist-test-framework" depends="init-dist"
242
 
                                        description="Creates the Solr test-framework JAR.">
243
 
                <ant dir="test-framework" target="dist" inheritall="false">
244
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
245
 
                </ant>
246
 
        </target>
247
 
 
248
 
        <target name="dist-war"
249
 
                                        description="Creates the Solr WAR Distribution file.">
250
 
                <ant dir="webapp" target="dist" inheritall="false">
251
 
                        <propertyset refid="uptodate.and.compiled.properties"/>
252
 
                </ant>
253
 
        </target>
254
 
 
255
 
        <target name="prepare-release"
256
 
                                        depends="clean, package, generate-maven-artifacts, sign-artifacts"/>
257
 
 
258
 
        <!-- make a distribution -->
259
 
        <target name="package" depends="package-src-tgz,create-package"/>
260
 
 
261
 
        <!-- Makes a tarball from running "svn export" at the root level.    -->
262
 
        <!-- Copies NOTICE.txt and LICENSE.txt from solr/ to the root level. -->
263
 
        <target name="package-src-tgz" depends="init-dist"
264
 
                                        description="Packages the Solr Source Distribution">
265
 
                <property name="source.package.file"
266
 
                                                        value="${package.dir}/${fullnamever}-src.tgz"/>
267
 
                <delete file="${source.package.file}" failonerror="false" />
268
 
                <svn-export-source source.dir=".."/>
269
 
                <tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
270
 
                        <tarfileset dir="${svn.export.dir}"
271
 
                                                                        prefix="${fullnamever}"
272
 
                                                                        excludes="example/**/*.sh example/**/bin/"/>
273
 
                        <tarfileset dir="${svn.export.dir}"
274
 
                                                                        prefix="${fullnamever}"
275
 
                                                                        filemode="755"
276
 
                                                                        includes="example/**/*.sh example/**/bin/"/>
277
 
                        <tarfileset dir="${svn.export.dir}/solr" prefix="${fullnamever}"
278
 
                                                                        includes="NOTICE.txt,LICENSE.txt"/>
279
 
                </tar>
280
 
                <make-checksums file="${source.package.file}"/>
281
 
        </target>
282
 
 
283
 
        <target name="package-local-src-tgz"
284
 
                                        description="Packages the Solr and Lucene sources from the local working copy">
285
 
                <mkdir dir="${common-solr.dir}/build"/>
286
 
                <property name="source.package.file"
287
 
                                                        value="${common-solr.dir}/build/${fullnamever}-src.tgz"/>
288
 
                <delete file="${source.package.file}" failonerror="false" />
289
 
 
290
 
                <tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
291
 
                        <tarfileset dir=".." prefix="${fullnamever}" includes="*.txt *.xml" />
292
 
                        <tarfileset dir="." prefix="${fullnamever}" includes="LICENSE.txt NOTICE.txt"/>
293
 
                        <tarfileset dir="." prefix="${fullnamever}/solr"
294
 
                                                                        excludes="build ${package.dir}/** ${dist}/**
295
 
                                                                                                                example/webapps/*.war
296
 
                                                                                                                lib/README.committers.txt **/data/ **/logs/*
297
 
                                                                                                                **/*.sh **/bin/ scripts/
298
 
                                                                                                                .idea/ **/*.iml **/pom.xml" />
299
 
                        <tarfileset dir="." prefix="${fullnamever}/solr"
300
 
                                                                        includes="core/src/test-files/solr/lib/classes/empty-file-main-lib.txt" />
301
 
                        <tarfileset dir="." filemode="755" prefix="${fullnamever}/solr"
302
 
                                                                        includes="**/*.sh **/bin/ scripts/"
303
 
                                                                        excludes="build/**"/>
304
 
                        <tarfileset dir="../lucene" prefix="${fullnamever}/lucene">
305
 
                                <patternset refid="lucene.local.src.package.patterns"/>
306
 
                        </tarfileset>
307
 
                </tar>
308
 
        </target>
309
 
 
310
 
        <target name="create-package"
311
 
                                        description="Packages the Solr Binary Distribution"
312
 
                                        depends="init-dist, dist, example, javadocs">
313
 
                <mkdir dir="${dest}/${fullnamever}"/>
314
 
                <delete includeemptydirs="true">
315
 
                        <fileset dir="${example}/work" includes="**/*"/>
316
 
                        <fileset dir="${dest}/${fullnamever}" includes="**/*"/>
317
 
                </delete>
318
 
 
319
 
                <delete file="${package.dir}/${fullnamever}.tgz" failonerror="false" />
320
 
                <delete file="${package.dir}/${fullnamever}.zip" failonerror="false" />
321
 
 
322
 
                <mkdir dir="${dest}/contrib-lucene-libs-to-package"/>
323
 
                <delete dir="${dest}/contrib-lucene-libs-to-package" includes="**/*"/>
324
 
                <contrib-crawl target="add-lucene-libs-to-package"/>
325
 
 
326
 
                <tar destfile="${package.dir}/${fullnamever}.tgz" compression="gzip" longfile="gnu">
327
 
                        <tarfileset dir="."
328
 
                                                                        prefix="${fullnamever}"
329
 
                                                                        includes="LICENSE.txt NOTICE.txt CHANGES.txt README.txt example/**"
330
 
                                                                        excludes="lib/README.committers.txt **/data/ **/logs/* **/classes/ **/*.sh
331
 
                                                                                                                 **/bin/ **/*.iml **/*.ipr **/*.iws **/pom.xml **/*pom.xml.template" />
332
 
                        <tarfileset dir="${dest}/contrib-lucene-libs-to-package"
333
 
                                                                        prefix="${fullnamever}"
334
 
                                                                        includes="**" />
335
 
                        <tarfileset dir="."
336
 
                                                                        filemode="755"
337
 
                                                                        prefix="${fullnamever}"
338
 
                                                                        includes="example/**/*.sh example/**/bin/" />
339
 
                        <tarfileset dir="."
340
 
                                                                        prefix="${fullnamever}"
341
 
                                                                        includes="dist/*.jar dist/*.war dist/solrj-lib/*"
342
 
                                                                        excludes="**/*.tgz **/*.zip **/*.md5 **/*src*.jar **/*docs*.jar" />
343
 
                        <tarfileset dir="${dest}/docs"
344
 
                                                                        prefix="${fullnamever}/docs" />
345
 
                </tar>
346
 
                <make-checksums file="${package.dir}/${fullnamever}.tgz"/>
347
 
 
348
 
                <untar compression="gzip" src="${package.dir}/${fullnamever}.tgz" dest="${dest}"/>
349
 
 
350
 
                <!--
351
 
                                This is a list of text file patterns to convert to CRLF line-ending style.
352
 
                                Shell scripts and files included in shell scripts should not be converted.
353
 
                                NB: The line-ending conversion process will mangle non-UTF8-encoded files.
354
 
                         -->
355
 
                <fixcrlf srcdir="${dest}/${fullnamever}"
356
 
                                                 encoding="UTF-8"
357
 
                                                 eol="crlf"
358
 
                                                 includes="**/*.alg **/*.cfg **/*.cgi **/*.cpp **/*.css **/*.csv **/*.dtd
359
 
                                                                                                **/*.erb **/*.fcgi **/.htaccess **/*.htm **/*.html **/*.incl
360
 
                                                                                                **/*.java **/*.javacc **/*.jflex **/*.jflex-macro **/*.jj
361
 
                                                                                                **/*.js **/*.json **/*.jsp **/*LICENSE **/package-list **/*.pl
362
 
                                                                                                **/*.pom **/*pom.xml.template **/*.properties **/*.py
363
 
                                                                                                **/*.rake **/Rakefile **/*.rb **/*.rbbi **/README* **/*.rhtml
364
 
                                                                                                **/*.rslp **/*.rxml **/*.script **/*.svg **/*.tsv **/*.txt
365
 
                                                                                                **/UPGRADING **/USAGE **/*.uxf **/*.vm **/*.xcat **/*.xml
366
 
                                                                                                **/*.xsl **/*.xslt **/*.yml"
367
 
                                                 excludes="**/stopwordsWrongEncoding.txt **/gb18030-example.xml"
368
 
                                />
369
 
 
370
 
                <zip destfile="${package.dir}/${fullnamever}.zip">
371
 
                        <zipfileset dir="${dest}/${fullnamever}"
372
 
                                                                        prefix="${fullnamever}"
373
 
                                                                        excludes="**/*.sh **/bin/ src/scripts/" />
374
 
                        <zipfileset dir="${dest}/${fullnamever}"
375
 
                                                                        prefix="${fullnamever}"
376
 
                                                                        includes="**/*.sh **/bin/ src/scripts/"
377
 
                                                                        filemode="755" />
378
 
                </zip>
379
 
                <make-checksums file="${package.dir}/${fullnamever}.zip"/>
380
 
        </target>
381
 
 
382
 
        <target name="sign-artifacts">
383
 
                <sign-artifacts-macro artifacts.dir="${package.dir}"/>
384
 
        </target>
385
 
 
386
 
        <target name="javadocs-dep">
387
 
                <copy failonerror="false" todir="${dest}/docs">
388
 
                        <fileset dir="${common-solr.dir}/site" />
389
 
                </copy>
390
 
        </target>
391
 
 
392
 
        <target name="javadocs-all" depends="prep-lucene-jars,javadocs-dep"
393
 
                                        description="Generate javadoc for core and java client">
394
 
                <sequential>
395
 
                        <mkdir dir="${dest}/docs/api"/>
396
 
 
397
 
                        <path id="javadoc.classpath">
398
 
                                <path refid="classpath"/>
399
 
                                <pathelement location="${dest}/solr-solrj/classes/java"/>
400
 
                        </path>
401
 
 
402
 
                        <invoke-javadoc destdir="${dest}/docs/api"
403
 
                                                                                        overview="core/src/java/overview.html">
404
 
                                <sources>
405
 
                                        <packageset dir="core/src/java" />
406
 
                                        <packageset dir="solrj/src/java" />
407
 
                                        <group title="Core" packages="org.apache.*" />
408
 
                                        <group title="SolrJ" packages="org.apache.solr.common.*,org.apache.solr.client.solrj*" />
409
 
                                </sources>
410
 
                        </invoke-javadoc>
411
 
                </sequential>
412
 
        </target>
413
 
 
414
 
        <target name="generate-maven-artifacts">
415
 
                <taskdef uri="antlib:org.apache.maven.artifact.ant"
416
 
                                                 resource="org/apache/maven/artifact/ant/antlib.xml"
417
 
                                                 classpathref="maven-ant-tasks.classpath" />
418
 
                <sequential>
419
 
                        <ant target="get-maven-poms" dir=".." inheritall="false"/>
420
 
                        <m2-deploy pom.xml="pom.xml"/> <!-- Solr parent POM -->
421
 
                        <subant target="dist-maven" inheritall="false" >
422
 
                                <fileset dir="core" includes="build.xml"/>
423
 
                                <fileset dir="solrj" includes="build.xml"/>
424
 
                                <fileset dir="test-framework" includes="build.xml"/>
425
 
                                <fileset dir="webapp" includes="build.xml"/>
426
 
                        </subant>
427
 
                        <contrib-crawl target="dist-maven"/>
428
 
                </sequential>
429
 
        </target>
430
 
 
431
 
</project>