lucene/build.xml

679 lines
28 KiB
XML

<?xml version="1.0"?>
<project name="Lucene" default="default" basedir=".">
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it -->
<property file="${user.home}/lucene.build.properties"/>
<property file="${user.home}/build.properties"/>
<property file="${basedir}/build.properties"/>
<tstamp>
<format property="current.year" pattern="yyyy"/>
<format property="DSTAMP" pattern="yyyy-MM-dd"/>
<format property="TSTAMP" pattern="HH:mm:ss"/>
</tstamp>
<property name="name" value="lucene"/>
<property name="Name" value="Lucene"/>
<property name="version" value="1.9-rc1-dev"/>
<property name="year" value="2000-${current.year}"/>
<property name="final.name" value="${name}-${version}"/>
<property name="javac.deprecation" value="on"/>
<property name="javac.debug" value="on"/>
<property name="project.name" value="site"/> <!-- todo: is this used by anakia or something else? -->
<property name="javadoc.link" value="http://java.sun.com/j2se/1.4/docs/api/"/>
<property name="build.encoding" value="utf-8"/>
<property name="build.dir" location="build"/>
<property name="dist.dir" location="dist"/>
<property name="demo.name" value="${name}-demos-${version}"/>
<property name="demo.war.name" value="luceneweb"/>
<property name="javacc.home" location="."/>
<property name="junit.output.dir" location="${build.dir}/test"/>
<property name="junit.reports" location="${build.dir}/test/reports"/>
<!-- Build classpath -->
<path id="classpath">
<pathelement location="${build.dir}/classes/java"/>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="demo.classpath">
<path refid="classpath"/>
<pathelement location="${build.dir}/classes/demo"/>
</path>
<path id="test.classpath">
<path refid="demo.classpath"/>
<pathelement location="${build.dir}/classes/test"/>
</path>
<!-- classpath for deprecated test cases, should be removed when moving from 1.9 to 2.0 -->
<path id="test-deprecated.classpath">
<path refid="demo.classpath"/>
<pathelement location="${build.dir}/classes/test-deprecated"/>
</path>
<path id="junit.classpath">
<pathelement location="${build.dir}/classes/test"/>
<pathelement location="${build.dir}/classes/java"/>
<pathelement location="${build.dir}/classes/demo"/>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<!-- junit classpath for deprecated test cases, should be removed when moving from 1.9 to 2.0 -->
<path id="junit-deprecated.classpath">
<pathelement location="${build.dir}/classes/test-deprecated"/>
<pathelement location="${build.dir}/classes/java"/>
<pathelement location="${build.dir}/classes/demo"/>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<!-- ================================================================== -->
<!-- Prepares the build directory -->
<!-- ================================================================== -->
<target name="javacc-uptodate-check">
<uptodate property="javacc.files.uptodate">
<srcfiles dir="src" includes="**/*.jj" />
<mapper type="glob" from="*.jj" to="*.java"/>
</uptodate>
</target>
<target name="javacc-notice" unless="javacc.files.uptodate">
<echo>
One or more of the JavaCC .jj files is newer than its corresponding
.java file. Run the "javacc" target to regenerate the artifacts.
</echo>
</target>
<target name="init" depends="javacc-uptodate-check, javacc-notice">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<available
property="javacc.present"
classname="org.javacc.parser.Main"
classpath="${javacc.home}/bin/lib/javacc.jar"
/>
<available
property="junit.present"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
/>
</target>
<target name="javacc-check" depends="init">
<fail unless="javacc.present">
##################################################################
JavaCC not found.
JavaCC Home: ${javacc.home}
JavaCC JAR: ${javacc.jar}
Please download and install JavaCC from:
&lt;http://javacc.dev.java.net&gt;
Then, create a build.properties file either in your home
directory, or within the Lucene directory and set the javacc.home
property to the path where JavaCC is installed. For example,
if you installed JavaCC in /usr/local/java/javacc-3.2, then set the
javacc.home property to:
javacc.home=/usr/local/java/javacc-3.2
If you get an error like the one below, then you have not installed
things correctly. Please check all your paths and try again.
java.lang.NoClassDefFoundError: org.javacc.parser.Main
##################################################################
</fail>
</target>
<!-- ================================================================== -->
<!-- C O M P I L E -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="compile" depends="compile-core"/>
<target name="compile-core" depends="init"
description="Compiles core classes">
<mkdir dir="${build.dir}/classes/java"/>
<javac
encoding="${build.encoding}"
srcdir="src/java"
includes="org/**/*.java"
destdir="${build.dir}/classes/java"
deprecation="${javac.deprecation}"
debug="${javac.debug}">
<classpath refid="classpath"/>
</javac>
<rmic classname="org.apache.lucene.search.RemoteSearchable"
base="${build.dir}/classes/java">
<classpath refid="classpath"/>
</rmic>
</target>
<!-- ================================================================== -->
<!-- J A R -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="jar-core"/>
<target name="jar-core" depends="compile-core"
description="Generates the Jar file">
<jar
destfile="${build.dir}/${final.name}.jar"
basedir="${build.dir}/classes/java"
excludes="**/*.java">
<manifest>
<attribute name="Created-By" value="Apache Jakarta"/>
<section name="org/apache/lucene/">
<attribute name="Specification-Title" value="Lucene Search Engine"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="Lucene"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/>
<attribute name="Implementation-Version" value="build ${DSTAMP}"/>
<attribute name="Implementation-Vendor" value="Lucene"/>
</section>
</manifest>
</jar>
</target>
<target name="jar-demo" depends="compile-demo">
<jar
destfile="${build.dir}/${demo.name}.jar"
basedir="${build.dir}/classes/demo"
excludes="**/*.java"
/>
</target>
<target name="war-demo" depends="jar-core,jar-demo">
<war destfile="${build.dir}/${demo.war.name}.war"
webxml="src/jsp/WEB-INF/web.xml">
<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"/>
</war>
</target>
<!-- ================================================================== -->
<!-- J A R S O U R C E -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar-src" depends="init">
<jar destfile="${build.dir}/${final.name}-src.jar">
<fileset dir="." includes="src/"/>
</jar>
</target>
<!-- ================================================================== -->
<!-- B U I L D D E M O -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="compile-demo" depends="compile-core">
<mkdir dir="${build.dir}/classes/demo"/>
<javac
encoding="${build.encoding}"
srcdir="src/demo"
includes="**/*.java"
destdir="${build.dir}/classes/demo"
debug="${javac.debug}">
<classpath refid="demo.classpath"/>
</javac>
</target>
<!-- GCJ -->
<target name="gcj" depends="jar,jar-demo">
<exec executable="make" dir="src/gcj" failonerror="true"/>
</target>
<!-- ================================================================== -->
<!-- B U I L D D E P R E C A T E D T E S T -->
<!-- ================================================================== -->
<!-- should be removed when moving from lucene 1.9 to 2.0 -->
<!-- ================================================================== -->
<target name="compile-test-deprecated" depends="compile-core,compile-demo">
<mkdir dir="${build.dir}/classes/test-deprecated"/>
<javac
encoding="${build.encoding}"
srcdir="src/test-deprecated"
includes="**/*.java"
destdir="${build.dir}/classes/test-deprecated"
debug="true">
<classpath refid="test-deprecated.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- R U N D E P R E C A T E D T E S T S -->
<!-- ================================================================== -->
<!-- should be removed when moving from lucene 1.9 to 2.0 -->
<!-- ================================================================== -->
<target name="test-deprecated" depends="compile-test-deprecated" description="Runs deprecated unit tests">
<fail unless="junit.present">
##################################################################
JUnit not found.
Please make sure junit.jar is in ANT_HOME/lib, or made available
to Ant using other mechanisms like -lib or CLASSPATH.
##################################################################
</fail>
<mkdir dir="${junit.output.dir}"/>
<junit printsummary="off" haltonfailure="no"
errorProperty="tests.failed" failureProperty="tests.failed">
<classpath refid="junit-deprecated.classpath"/>
<sysproperty key="dataDir" file="src/test-deprecated"/>
<sysproperty key="tempDir" file="${build.dir}/test-deprecated"/>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
<fileset dir="src/test-deprecated" includes="**/Test*.java"/>
</batchtest>
<batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
<fileset dir="src/test-deprecated" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<!-- ================================================================== -->
<!-- B U I L D T E S T -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="compile-test" depends="compile-core,compile-demo">
<mkdir dir="${build.dir}/classes/test"/>
<javac
encoding="${build.encoding}"
srcdir="src/test"
includes="**/*.java"
destdir="${build.dir}/classes/test"
debug="true">
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- R U N T E S T S -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="test" depends="compile-test" description="Runs unit tests">
<fail unless="junit.present">
##################################################################
JUnit not found.
Please make sure junit.jar is in ANT_HOME/lib, or made available
to Ant using other mechanisms like -lib or CLASSPATH.
##################################################################
</fail>
<mkdir dir="${junit.output.dir}"/>
<junit printsummary="off" haltonfailure="no"
errorProperty="tests.failed" failureProperty="tests.failed">
<classpath refid="junit.classpath"/>
<sysproperty key="dataDir" file="src/test"/>
<sysproperty key="tempDir" file="${build.dir}/test"/>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
<fileset dir="src/test" includes="**/Test*.java" excludes="**/TestPrecedenceQueryParser.java"/>
</batchtest>
<batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
<fileset dir="src/test" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<!-- backwards compatible target - may be removed -->
<target name="test-unit" depends="test"/>
<target name="generate-test-reports" description="Generates test reports">
<mkdir dir="${junit.reports}"/>
<junitreport todir="${junit.output.dir}">
<fileset dir="${junit.output.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.reports}"/>
</junitreport>
</target>
<!-- ================================================================== -->
<!-- D O C U M E N T A T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="docs-prepare">
<fail unless="asf.site.home">
Set the property asf.site.home. This can be done using one of the following methods:
* run Ant with the switch -Dasf.site.home=/path/to/asf/site/module
* Add asf.site.home to a build.properties file in the top-level Lucene directory
</fail>
<available
classname="org.apache.velocity.anakia.AnakiaTask"
property="AnakiaTask.present">
<classpath id="anakia.classpath">
<fileset dir="${asf.site.home}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</available>
</target>
<target name="prepare-error" depends="docs-prepare" unless="AnakiaTask.present">
<echo>
AnakiaTask is not present! Please check to make sure that
you have asf.site.home (currently ${asf.site.home}) set correctly.
</echo>
</target>
<target name="docs" depends="prepare-error" if="AnakiaTask.present">
<taskdef
name="anakia"
classname="org.apache.velocity.anakia.AnakiaTask">
<classpath refid="anakia.classpath"/>
</taskdef>
<anakia
basedir="xdocs"
destdir="docs/"
extension=".html" style="./site.vsl"
projectFile="stylesheets/project.xml"
excludes="**/stylesheets/** empty.xml"
includes="**/*.xml"
lastModifiedCheck="true"
templatePath="${asf.site.home}/xdocs/stylesheets"
/>
<copy todir="docs/images" filtering="no">
<fileset dir="xdocs/images">
<include name="**/*.gif"/>
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
</target>
<!-- ================================================================== -->
<!-- J A V A D O C -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="javadocs">
<mkdir dir="${build.dir}/docs/api"/>
<javadoc
sourcepath="src/java"
overview="src/java/overview.html"
packagenames="org.apache.lucene.*"
destdir="${build.dir}/docs/api"
encoding="${build.encoding}"
author="true"
version="true"
use="true"
link="${javadoc.link}"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &amp;copy; ${year} Apache Software Foundation. All Rights Reserved."
>
<tag name="todo" description="To Do:"/>
</javadoc>
</target>
<target name="javadocs-internal">
<mkdir dir="${build.dir}/docs/api-internal"/>
<javadoc
sourcepath="src/java"
overview="src/java/overview.html"
packagenames="org.apache.lucene.*"
access="package"
destdir="${build.dir}/docs/api-internal"
encoding="${build.encoding}"
author="true"
version="true"
use="true"
link="${javadoc.link}"
windowtitle="${Name} ${version} public and internal API"
doctitle="${Name} ${version} public and internal API"
bottom="Copyright &amp;copy; ${year} Apache Software Foundation. All Rights Reserved."
>
<tag name="todo" description="To Do:"/>
</javadoc>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package" depends="jar-core, javadocs, war-demo"/>
<!-- ================================================================== -->
<!-- Packages the distribution with zip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-zip" depends="package"
description="--> Generates the Lucene distribution as .zip">
<delete file="${dist.dir}/${final.name}.zip"/>
<zip destfile="${dist.dir}/${final.name}.zip">
<zipfileset prefix="${final.name}" dir="."
includes="src/demo/,src/jsp/,build.xml,docs/,*.txt"/>
<zipfileset prefix="${final.name}" dir="${build.dir}"
includes="${final.name}.jar,${demo.war.name}.war,${demo.name}.jar,docs/"/>
</zip>
</target>
<!-- ================================================================== -->
<!-- packages the distribution with tar-gzip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-tgz" depends="package"
description="--> Generates the lucene distribution as .tar.gz">
<!-- todo: make includes patterns below into property to reuse in package-zip -->
<delete file="${build.dir}/${final.name}.tar"/>
<delete file="${dist.dir}/${final.name}.tar.gz"/>
<tar tarfile="${build.dir}/${final.name}.tar">
<tarfileset prefix="${final.name}" dir="."
includes="src/demo/,src/jsp/,build.xml,docs/,*.txt"/>
<tarfileset prefix="${final.name}" dir="${build.dir}"
includes="${final.name}.jar,${demo.war.name}.war,${demo.name}.jar,docs/"/>
</tar>
<gzip zipfile="${dist.dir}/${final.name}.tar.gz"
src="${build.dir}/${final.name}.tar"
/>
</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 -->
<!-- ================================================================== -->
<!-- ================================================================== -->
<!-- Packages the sources with zip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-zip-src" depends="init"
description="--> Generates the Lucene sources as .zip">
<zip destfile="${dist.dir}/${final.name}-src.zip">
<zipfileset prefix="${final.name}" dir="."
includes="src/,build.xml,lib/,docs/,*.txt"/>
</zip>
</target>
<!-- ================================================================== -->
<!-- Packages the sources with tar-gzip -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package-tgz-src" depends="init"
description="--> Generates the Lucene distribution as .tar.gz">
<delete file="${build.dir}/${final.name}-src.tar"/>
<delete file="${dist.dir}/${final.name}-src.tar.gz"/>
<tar tarfile="${build.dir}/${final.name}-src.tar">
<tarfileset prefix="${final.name}" dir="."
includes="src/,build.xml,lib/,docs/,*.txt"/>
</tar>
<gzip zipfile="${dist.dir}/${final.name}-src.tar.gz"
src="${build.dir}/${final.name}-src.tar"
/>
</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"/>
<!-- ================================================================== -->
<!-- C L E A N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="clean"
description="Removes contents of build and dist directories">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete file="velocity.log"/>
</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/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj"
outputfile="${build.dir}/docs/grammars/PrecedenceQueryParser.html"
javacchome="${javacc.home}"
/>
<jjdoc target="src/java/org/apache/lucene/analysis/standard/StandardTokenizer.jj"
outputfile="${build.dir}/docs/grammars/StandardTokenizer.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}"
/>
</target>
<target name="clean-javacc">
<delete>
<fileset dir="src">
<include name="java/org/apache/lucene/analysis/standard/StandardTokenizer.java"/>
<include name="java/org/apache/lucene/queryParser/QueryParser.java"/>
<include name="java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java"/>
<include name="demo/org/apache/lucene/demo/html/HTMLParser.java"/>
</fileset>
</delete>
</target>
<target name="javacc" depends="clean-javacc,javacc-StandardAnalyzer,javacc-QueryParser,javacc-PrecedenceQueryParser,javacc-HTMLParser"/>
<macrodef name="invoke-javacc">
<attribute name="target"/>
<attribute name="outputDir"/>
<sequential>
<javacc
target="@{target}"
outputDirectory="@{outputDir}"
debugTokenManager="${javacc.debug.tokenmgr}"
debugParser="${javacc.debug.parser}"
debuglookahead="${javacc.debug.lookahead}"
javacchome="${javacc.home}"
/>
</sequential>
</macrodef>
<target name="javacc-StandardAnalyzer" depends="init,javacc-check" if="javacc.present">
<!-- generate this in a build directory so we can exclude ParseException -->
<mkdir dir="${build.dir}/gen/org/apache/lucene/analysis/standard"/>
<invoke-javacc target="src/java/org/apache/lucene/analysis/standard/StandardTokenizer.jj"
outputDir="${build.dir}/gen/org/apache/lucene/analysis/standard"
/>
<copy todir="src/java/org/apache/lucene/analysis/standard">
<fileset dir="${build.dir}/gen/org/apache/lucene/analysis/standard">
<include name="*.java"/>
<exclude name="ParseException.java"/>
</fileset>
</copy>
</target>
<target name="javacc-QueryParser" depends="init,javacc-check" if="javacc.present">
<invoke-javacc target="src/java/org/apache/lucene/queryParser/QueryParser.jj"
outputDir="src/java/org/apache/lucene/queryParser"
/>
</target>
<target name="javacc-PrecedenceQueryParser" depends="init,javacc-check" if="javacc.present">
<invoke-javacc target="src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj"
outputDir="src/java/org/apache/lucene/queryParser/precedence"
/>
</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="default" depends="jar-core"/>
</project>