lucene/build.xml

742 lines
32 KiB
XML

<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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="core" default="default" basedir=".">
<property name="junit.includes" value="**/Test*.java"/>
<import file="common-build.xml"/>
<property name="build.demo.template" value="src/demo/demo-build.template"/>
<property name="demo.name" value="lucene-demos-${version}"/>
<property name="demo.war.name" value="luceneweb"/>
<!-- Build classpath -->
<path id="classpath">
<pathelement location="${build.dir}/classes/java"/>
</path>
<path id="tag.classpath">
<pathelement location="${build.dir}/${tag}/classes/java"/>
</path>
<path id="demo.classpath">
<path refid="classpath"/>
<pathelement location="${build.dir}/classes/demo"/>
</path>
<path id="test.classpath">
<path refid="classpath"/>
<path refid="junit-path"/>
<pathelement location="${build.dir}/classes/test"/>
</path>
<path id="junit.classpath">
<path refid="junit-path"/>
<pathelement location="${build.dir}/classes/test"/>
<pathelement location="${build.dir}/classes/java"/>
<pathelement path="${java.class.path}"/>
</path>
<patternset id="src.dist.patterns"
includes="src/,build.xml,*build*.xml,docs/,*.txt,contrib/,*pom.xml*,lib/"
excludes="contrib/db/*/lib/,contrib/*/ext-libs/,src/site/build/,contrib/benchmark/temp/**,contrib/benchmark/work/**"
/>
<patternset id="binary.build.dist.patterns"
includes="${final.name}.jar,${demo.war.name}.war,${demo.name}.jar,docs/,contrib/*/*.jar,contrib/*/*.war, contrib/*/*/*.jar"
/>
<patternset id="binary.root.dist.patterns"
includes="src/demo/,src/jsp/,docs/,*.txt,contrib/*/README*,**/CHANGES.txt,lib/servlet-api-*.jar"
excludes="${build.demo.template}"
/>
<!-- ================================================================== -->
<!-- Prepares the build directory -->
<!-- ================================================================== -->
<target name="test-core" depends="common.test"
description="Runs unit tests for the core Lucene code"
/>
<target name="test" depends="test-core, test-contrib, test-tag"
description="Runs all unit tests (core, contrib and back-compat)"
/>
<property name="tag" value="${compatibility.tag}"/>
<path id="tag.test.classpath">
<path refid="junit-path"/>
<pathelement location="${build.dir}/${tag}/${tag}.jar"/>
</path>
<path id="tag.junit.classpath">
<path refid="junit-path"/>
<pathelement location="${build.dir}/${tag}/classes/test"/>
<pathelement location="${build.dir}/${final.name}.jar"/>
<pathelement path="${java.class.path}"/>
</path>
<target name="download-tag"
description="Downloads a previous Lucene version. Specify tag version like this: -Dtag=lucene_2_4_back_compat_tests_20090127">
<sequential>
<mkdir dir="${tags.dir}/${tag}"/>
<exec dir="${tags.dir}/${tag}" executable="${svn.exe}"
failifexecutionfails="false">
<arg line="checkout http://svn.apache.org/repos/asf/lucene/java/tags/${tag}/src/"/>
</exec>
</sequential>
</target>
<target name="test-tag" depends="download-tag, compile-core, jar-core"
description="Runs tests of a previous Lucene version. Specify tag version like this: -Dtag=branches/lucene_2_9_back_compat_tests">
<sequential>
<available property="tag.available" file="${tags.dir}/${tag}/src/test" />
<fail unless="tag.available">
Specified tag '${tag}' could not be found in directory '${tags.dir}/${tag}'.
</fail>
<mkdir dir="${build.dir}/${tag}"/>
<!-- first compile tag classes -->
<compile
srcdir="${tags.dir}/${tag}/src/java"
destdir="${build.dir}/${tag}/classes/java"
javac.source="${javac.source.tag}" javac.target="${javac.target.tag}">
<classpath refid="tag.classpath"/>
</compile>
<!-- compile jar for tag -->
<jarify basedir="${build.dir}/${tag}/classes/java"
destfile="${build.dir}/${tag}/${tag}.jar" />
<!-- compile tag tests against tag jar -->
<compile-test-macro srcdir="${tags.dir}/${tag}/src/test" destdir="${build.dir}/${tag}/classes/test"
test.classpath="tag.test.classpath" javac.source="${javac.source.tag}" javac.target="${javac.target.tag}"/>
<!-- run tag tests against trunk jar -->
<test-macro dataDir="${tags.dir}/${tag}/src/test"
tempDir="${build.dir}/${tag}"
junit.classpath="tag.junit.classpath"/>
</sequential>
</target>
<target name="clean-tags"
description="Removes contents of the tags directory">
<delete dir="${tags.dir}"/>
</target>
<!-- ================================================================== -->
<!-- J A R -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar-demo" depends="compile-demo">
<sequential>
<build-manifest title="Lucene Search Engine: demos"/>
<jar
destfile="${build.dir}/${demo.name}.jar"
basedir="${build.dir}/classes/demo"
excludes="**/*.java"
manifest="${manifest.file}">
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</sequential>
</target>
<target name="jar-demo-src" depends="compile-demo">
<sequential>
<build-manifest title="Lucene Search Engine: demos"/>
<jar
destfile="${build.dir}/${demo.name}-src.jar"
basedir="src/demo"
manifest="${manifest.file}">
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</sequential>
</target>
<target name="war-demo" depends="jar-core,jar-demo">
<sequential>
<build-manifest title="Lucene Search Engine: demos"/>
<war destfile="${build.dir}/${demo.war.name}.war"
webxml="src/jsp/WEB-INF/web.xml"
manifest="${manifest.file}">
<fileset dir="src/jsp" excludes="WEB-INF/web.xml"/>
<lib dir="${build.dir}" includes="${demo.name}.jar"/>
<lib dir="${build.dir}" includes="${final.name}.jar"/>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</war>
</sequential>
</target>
<!-- ================================================================== -->
<!-- B U I L D D E M O -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="compile-demo" depends="compile-core">
<mkdir dir="${build.dir}/classes/demo"/>
<compile
srcdir="src/demo"
destdir="${build.dir}/classes/demo">
<classpath refid="demo.classpath"/>
</compile>
</target>
<!-- ================================================================== -->
<!-- D O C U M E N T A T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="docs" description="Build the website">
<echo>DEPRECATED - Doing Nothing. See http://wiki.apache.org/lucene-java/HowToUpdateTheWebsite</echo>
</target>
<target name="javadocs" description="Generate javadoc"
depends="javadocs-all, javadocs-core, javadocs-demo, javadocs-contrib">
<echo file="${javadoc.dir}/index.html" append="false">
<![CDATA[<html><head><title>${Name} ${version} Javadoc Index</title></head>
<body>
<h1>${Name} ${version} Javadoc Index</h1>
<ul>
<li><a href="all/index.html">All</a></li>
<li><a href="core/index.html">Core</a></li>
<li>Contrib packages:</li>
<ul>
]]></echo>
<contrib-crawl target="javadocs-index.html" failonerror="false"/>
<echo file="${javadoc.dir}/index.html" append="true"><![CDATA[
</ul>
<li><a href="demo/index.html">Demo</a></li>
</ul></body>]]></echo>
</target>
<target name="javadocs-core" description="Generate javadoc for core classes">
<sequential>
<mkdir dir="${javadoc.dir}/core"/>
<invoke-javadoc
destdir="${javadoc.dir}/core"
title="${Name} ${version} core API">
<sources>
<packageset dir="src/java"/>
<link href=""/>
</sources>
</invoke-javadoc>
<jarify basedir="${javadoc.dir}/core" destfile="${build.dir}/${final.name}-javadoc.jar"/>
</sequential>
</target>
<target name="javadocs-demo" description="Generate javadoc for demo classes">
<sequential>
<mkdir dir="${javadoc.dir}/demo"/>
<invoke-javadoc
destdir="${javadoc.dir}/demo"
title="${Name} ${version} demo API">
<sources>
<packageset dir="src/demo"/>
<link href=""/>
</sources>
</invoke-javadoc>
<jarify basedir="${javadoc.dir}/demo" destfile="${build.dir}/${demo.name}-javadoc.jar"/>
</sequential>
</target>
<target name="javadocs-contrib" description="Generate javadoc for contrib classes">
<contrib-crawl target="javadocs"
failonerror="false"/>
</target>
<target name="javadocs-all" description="Generate javadoc for core, demo and contrib classes" depends="build-contrib">
<sequential>
<mkdir dir="${javadoc.dir}/all"/>
<invoke-javadoc
destdir="${javadoc.dir}/all">
<sources>
<!-- TODO: find a dynamic way to do include multiple source roots -->
<packageset dir="src/java"/>
<packageset dir="src/demo"/>
<!-- please keep this list up to date, and in alpha order... -->
<!-- ie: `find contrib/* -path \*src/java | sort` -->
<!-- if you make changes to the list of package sets, also -->
<!-- make sure the group list below is updated. -->
<!-- Also remember to keep site.xml in sync. -->
<packageset dir="contrib/analyzers/common/src/java"/>
<packageset dir="contrib/analyzers/smartcn/src/java"/>
<packageset dir="contrib/ant/src/java"/>
<packageset dir="contrib/benchmark/src/java"/>
<packageset dir="contrib/collation/src/java"/>
<packageset dir="contrib/db/bdb-je/src/java"/>
<packageset dir="contrib/db/bdb/src/java"/>
<packageset dir="contrib/fast-vector-highlighter/src/java"/>
<packageset dir="contrib/highlighter/src/java"/>
<packageset dir="contrib/instantiated/src/java"/>
<packageset dir="contrib/lucli/src/java"/>
<packageset dir="contrib/memory/src/java"/>
<packageset dir="contrib/misc/src/java"/>
<packageset dir="contrib/queries/src/java"/>
<packageset dir="contrib/regex/src/java"/>
<packageset dir="contrib/remote/src/java"/>
<packageset dir="contrib/snowball/src/java"/>
<packageset dir="contrib/spatial/src/java"/>
<packageset dir="contrib/spellchecker/src/java"/>
<packageset dir="contrib/surround/src/java"/>
<packageset dir="contrib/swing/src/java"/>
<packageset dir="contrib/wikipedia/src/java"/>
<packageset dir="contrib/wordnet/src/java"/>
<packageset dir="contrib/xml-query-parser/src/java"/>
<packageset dir="contrib/queryparser/src/java"/>
<!-- end alpha sort -->
<!-- If the main javadoc Group listing includes an "Other -->
<!-- Packages" group after the ones listed here, then those -->
<!-- packages are not being matched by any of these rules -->
<group title="Core" packages="org.apache.*:org.apache.lucene.analysis:org.apache.lucene.analysis.standard*:org.apache.lucene.analysis.tokenattributes*"/>
<group title="Demo" packages="org.apache.lucene.demo*"/>
<group title="contrib: Analysis" packages="org.apache.lucene.analysis.*"/>
<group title="contrib: Ant" packages="org.apache.lucene.ant*"/>
<group title="contrib: Benchmark" packages="org.apache.lucene.benchmark*"/>
<group title="contrib: Collation" packages="org.apache.lucene.collation*"/>
<group title="contrib: DB" packages="org.apache.lucene.store.db*:org.apache.lucene.store.je*:com.sleepycat*"/>
<group title="contrib: Fast Vector Highlighter" packages="org.apache.lucene.search.vectorhighlight*"/>
<group title="contrib: Highlighter" packages="org.apache.lucene.search.highlight*"/>
<group title="contrib: Instantiated" packages="org.apache.lucene.store.instantiated*"/>
<group title="contrib: Lucli" packages="lucli*"/>
<group title="contrib: Memory" packages="org.apache.lucene.index.memory*"/>
<group title="contrib: Misc " packages="org.apache.lucene.misc*:org.apache.lucene.queryParser.analyzing*:org.apache.lucene.queryParser.precedence*"/>
<group title="contrib: Queries" packages="org.apache.lucene.search.similar*"/>
<group title="contrib: Query Parser" packages="org.apache.lucene.queryParser.*"/>
<group title="contrib: RegEx" packages="org.apache.lucene.search.regex*:org.apache.regexp*"/>
<group title="contrib: Snowball" packages="org.apache.lucene.analysis.snowball*:net.sf.snowball*"/>
<group title="contrib: Spatial" packages="org.apache.lucene.spatial*"/>
<group title="contrib: SpellChecker" packages="org.apache.lucene.search.spell*"/>
<group title="contrib: Surround Parser" packages="org.apache.lucene.queryParser.surround*"/>
<group title="contrib: Swing" packages="org.apache.lucene.swing*"/>
<group title="contrib: Wikipedia" packages="org.apache.lucene.wikipedia*"/>
<group title="contrib: WordNet" packages="org.apache.lucene.wordnet*"/>
<group title="contrib: XML Query Parser" packages="org.apache.lucene.xmlparser*"/>
</sources>
</invoke-javadoc>
</sequential>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package" depends="jar-core, javadocs, war-demo, build-contrib, init-dist, changes-to-html">
<copy file="${build.demo.template}" tofile="${build.dir}/build-demo.xml">
<filterset begintoken="@PLACEHOLDER_" endtoken="@">
<filter token="version" value="${version}"/>
<filter token="javac.source" value="${javac.source}"/>
<filter token="javac.target" value="${javac.target}"/>
</filterset>
</copy>
</target>
<target name="nightly" depends="test, package-tgz">
</target>
<!-- ================================================================== -->
<!-- Packages the distribution with zip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-zip" depends="package"
description="--> Generates the Lucene distribution as .zip">
<delete file="${dist.dir}/lucene-${version}.zip"/>
<zip destfile="${dist.dir}/lucene-${version}.zip">
<zipfileset prefix="lucene-${version}" dir=".">
<patternset refid="binary.root.dist.patterns"/>
</zipfileset>
<zipfileset dir="${build.dir}" includes="build-demo.xml" fullpath="lucene-${version}/build.xml"/>
<zipfileset prefix="lucene-${version}" dir="${build.dir}">
<patternset refid="binary.build.dist.patterns"/>
</zipfileset>
</zip>
<lucene-checksum file="${dist.dir}/lucene-${version}.zip"/>
</target>
<!-- ================================================================== -->
<!-- packages the distribution with tar-gzip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-tgz" depends="package"
description="--> Generates the lucene distribution as .tar.gz">
<delete file="${build.dir}/lucene-${version}.tar"/>
<delete file="${dist.dir}/lucene-${version}.tar.gz"/>
<tar tarfile="${build.dir}/lucene-${version}.tar" longfile="gnu">
<tarfileset prefix="lucene-${version}" dir=".">
<patternset refid="binary.root.dist.patterns"/>
</tarfileset>
<tarfileset dir="${build.dir}" includes="build-demo.xml" fullpath="lucene-${version}/build.xml"/>
<tarfileset prefix="lucene-${version}" dir="${build.dir}">
<patternset refid="binary.build.dist.patterns"/>
</tarfileset>
</tar>
<gzip zipfile="${dist.dir}/lucene-${version}.tar.gz"
src="${build.dir}/lucene-${version}.tar"
/>
<lucene-checksum file="${dist.dir}/lucene-${version}.tar.gz"/>
</target>
<!-- ================================================================== -->
<!-- packages the distribution with zip and tar-gzip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-all-binary" depends="package-zip, package-tgz"
description="--> Generates the .tar.gz and .zip distributions"/>
<!-- ================================================================== -->
<!-- same as package-all. it is just here for compatibility. -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="dist" depends="package-all-binary"/>
<!-- ================================================================== -->
<!-- S O U R C E D I S T R I B U T I O N -->
<!-- ================================================================== -->
<target name="init-dist" >
<!-- Package is not called first if packaging src standalone, so the dist.dir may not exist -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${maven.dist.dir}"/>
</target>
<!-- ================================================================== -->
<!-- Packages the sources with zip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-zip-src" depends="init, init-dist"
description="--> Generates the Lucene sources as .zip">
<zip destfile="${dist.dir}/lucene-${version}-src.zip">
<zipfileset prefix="lucene-${version}" dir=".">
<patternset refid="src.dist.patterns"/>
</zipfileset>
</zip>
<lucene-checksum file="${dist.dir}/lucene-${version}-src.zip"/>
</target>
<!-- ================================================================== -->
<!-- Packages the sources with tar-gzip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-tgz-src" depends="init, init-dist"
description="--> Generates the Lucene distribution as .tar.gz">
<delete file="${build.dir}/lucene-${version}-src.tar"/>
<delete file="${dist.dir}/lucene-${version}-src.tar.gz"/>
<tar tarfile="${build.dir}/lucene-${version}-src.tar" longfile="gnu">
<tarfileset prefix="lucene-${version}" dir=".">
<patternset refid="src.dist.patterns"/>
</tarfileset>
</tar>
<gzip zipfile="${dist.dir}/lucene-${version}-src.tar.gz"
src="${build.dir}/lucene-${version}-src.tar"
/>
<lucene-checksum file="${dist.dir}/lucene-${version}-src.tar.gz"/>
</target>
<!-- ================================================================== -->
<!-- Packages the sources with zip and tar-gzip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-all-src" depends="package-zip-src, package-tgz-src"
description="--> Generates the .tar.gz and .zip source distributions"/>
<!-- ================================================================== -->
<!-- same as package-all-src. it is just here for compatibility. -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="dist-src" depends="package-all-src"/>
<target name="dist-all" depends="dist, dist-src"/>
<target name="generate-maven-artifacts" depends="maven.ant.tasks-check, package, jar-src, jar-demo-src, javadocs">
<sequential>
<m2-deploy pom.xml="lucene-parent-pom.xml.template"/>
<m2-deploy pom.xml="lucene-core-pom.xml.template">
<artifact-attachments>
<attach file="${build.dir}/${final.name}-src.jar"
classifier="sources"/>
<attach file="${build.dir}/${final.name}-javadoc.jar"
classifier="javadoc"/>
</artifact-attachments>
</m2-deploy>
<m2-deploy pom.xml="lucene-demos-pom.xml.template">
<artifact-attachments>
<attach file="${build.dir}/${demo.name}-src.jar"
classifier="sources"/>
<attach file="${build.dir}/${demo.name}-javadoc.jar"
classifier="javadoc"/>
</artifact-attachments>
</m2-deploy>
<m2-deploy pom.xml="lucene-contrib-pom.xml.template"/>
<contrib-crawl target="dist-maven"/>
</sequential>
</target>
<!-- ================================================================== -->
<!-- Build the JavaCC files into the source tree -->
<!-- ================================================================== -->
<target name="jjdoc">
<mkdir dir="${build.dir}/docs/grammars"/>
<jjdoc target="src/java/org/apache/lucene/queryParser/QueryParser.jj"
outputfile="${build.dir}/docs/grammars/QueryParser.html"
javacchome="${javacc.home}"
/>
<jjdoc target="src/demo/org/apache/lucene/demo/html/HTMLParser.jj"
outputfile="${build.dir}/docs/grammars/HTMLParser.html"
javacchome="${javacc.home}"
/>
<jjdoc target="contrib/surround/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.jj"
outputfile="${build.dir}/docs/grammars/Surround_QueryParser.html"
javacchome="${javacc.home}"
/>
<jjdoc target="contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.jj"
outputfile="${build.dir}/docs/grammars/StandardSyntaxParser.html"
javacchome="${javacc.home}"
/>
</target>
<target name="clean-javacc">
<delete>
<fileset dir="src/java/org/apache/lucene/analysis/standard" includes="*.java">
<containsregexp expression="Generated.*By.*JavaCC"/>
<exclude name="ParseException.java"/>
</fileset>
<fileset dir="src/java/org/apache/lucene/queryParser" includes="*.java">
<containsregexp expression="Generated.*By.*JavaCC"/>
</fileset>
<fileset dir="contrib/surround/src/java/org/apache/lucene/queryParser/surround/parser" includes="*.java">
<containsregexp expression="Generated.*By.*JavaCC"/>
</fileset>
<fileset dir="contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser" includes="*.java">
<containsregexp expression="Generated.*By.*JavaCC"/>
</fileset>
<fileset dir="src/demo/org/apache/lucene/demo/html" includes="*.java">
<containsregexp expression="Generated.*By.*JavaCC"/>
</fileset>
</delete>
</target>
<target name="javacc" depends="clean-javacc,javacc-QueryParser,javacc-HTMLParser,javacc-contrib-queryparser, javacc-contrib-surround, javacc-contrib-precedence"/>
<target name="javacc-QueryParser" depends="init,javacc-check" if="javacc.present">
<sequential>
<invoke-javacc target="src/java/org/apache/lucene/queryParser/QueryParser.jj"
outputDir="src/java/org/apache/lucene/queryParser"/>
<!-- Change the inccorrect public ctors for QueryParser to be protected instead -->
<replaceregexp file="src/java/org/apache/lucene/queryParser/QueryParser.java"
byline="true"
match="public QueryParser\(CharStream "
replace="protected QueryParser(CharStream "/>
<replaceregexp file="src/java/org/apache/lucene/queryParser/QueryParser.java"
byline="true"
match="public QueryParser\(QueryParserTokenManager "
replace="protected QueryParser(QueryParserTokenManager "/>
</sequential>
</target>
<target name="javacc-HTMLParser" depends="init,javacc-check" if="javacc.present">
<invoke-javacc target="src/demo/org/apache/lucene/demo/html/HTMLParser.jj"
outputDir="src/demo/org/apache/lucene/demo/html"
/>
</target>
<target name="javacc-contrib-queryparser" depends="init,javacc-check" if="javacc.present">
<ant target="javacc"
dir="contrib/queryparser"
antfile="build.xml"
/>
</target>
<target name="javacc-contrib-surround" depends="init,javacc-check" if="javacc.present">
<ant target="javacc"
dir="contrib/surround"
antfile="build.xml"
/>
</target>
<target name="javacc-contrib-precedence" depends="init,javacc-check" if="javacc.present">
<ant target="javacc"
dir="contrib/misc"
antfile="build.xml"
/>
</target>
<!-- ================================================================== -->
<!-- Build the JFlex files into the source tree -->
<!-- ================================================================== -->
<target name="jflex" depends="clean-jflex,jflex-StandardAnalyzer" />
<target name="jflex-StandardAnalyzer" depends="init,jflex-check" if="jflex.present">
<taskdef classname="JFlex.anttask.JFlexTask" name="jflex">
<classpath location="${jflex.home}/lib/JFlex.jar" />
</taskdef>
<jflex file="src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.jflex"
outdir="src/java/org/apache/lucene/analysis/standard"
nobak="on" />
</target>
<target name="clean-jflex">
<delete>
<fileset dir="src/java/org/apache/lucene/analysis/standard" includes="*.java">
<containsregexp expression="generated.*by.*JFlex"/>
</fileset>
</delete>
</target>
<macrodef name="contrib-crawl">
<attribute name="target" default=""/>
<attribute name="failonerror" default="true"/>
<sequential>
<subant target="@{target}" failonerror="@{failonerror}">
<fileset dir="."
includes="contrib/*/build.xml"
/>
</subant>
</sequential>
</macrodef>
<target name="build-contrib"
description="Builds all contrib modules and their tests">
<contrib-crawl target="build-artifacts-and-tests"/>
</target>
<target name="test-contrib" depends="build-contrib">
<!-- Don't fail on error, instead check for flag file so we run
all the tests possible and can "ant generate-test-reports"
for all of them.
Because of this, we depend on "build-contrib" even though the
Individual contrib "test" targets probably have the
neccessary dependencies. If they fail to compile, we won't
know about it.
-->
<contrib-crawl target="test" failonerror="false"/>
<available property="contribs.failed" file="junitfailed.flag">
<filepath>
<dirset dir="${build.dir}/contrib/">
<include name="**/test/" />
</dirset>
</filepath>
</available>
<fail if="contribs.failed">Contrib tests failed!</fail>
</target>
<!-- Macro for building checksum files -->
<macrodef name="lucene-checksum">
<attribute name="file"/>
<sequential>
<checksum file="@{file}" algorithm="md5" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
<checksum file="@{file}" algorithm="sha1" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
</sequential>
</macrodef>
<!--
compile changes.txt into an html file
-->
<target name="changes-to-html">
<mkdir dir="${changes.target.dir}"/>
<exec executable="perl" input="CHANGES.txt" output="${changes.target.dir}/Changes.html" failonerror="true">
<arg value="${changes.src.dir}/changes2html.pl"/>
</exec>
<exec executable="perl" input="contrib/CHANGES.txt" output="${changes.target.dir}/Contrib-Changes.html" failonerror="true">
<arg value="${changes.src.dir}/changes2html.pl"/>
</exec>
<copy todir="${changes.target.dir}">
<fileset dir="${changes.src.dir}" includes="*.css"/>
</copy>
</target>
<!--
Committer helpers
-->
<property name="patch.file" value="${basedir}/../patches/${patch.name}"/>
<!-- Apply a patch. Assumes patch can be applied in the basedir.
-Dpatch.name assumes the patch is located in ${basedir}/../patches/${patch.name}
-Dpatch.file means the patch can be located anywhere on the file system
-->
<target name="apply-patch" depends="clean" description="Apply a patch file. Set -Dpatch.file, or -Dpatch.name when the patch is in the directory ../patches/">
<patch patchfile="${patch.file}" strip="0"/>
</target>
<target name="rat-sources-typedef">
<typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks">
<classpath>
<fileset dir="." includes="rat*.jar"/>
</classpath>
</typedef>
</target>
<target name="rat-sources" depends="rat-sources-typedef"
description="runs the tasks over src/java">
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks">
<fileset dir="src/java">
</fileset>
</rat:report>
</target>
</project>