lucene/build.xml

520 lines
22 KiB
XML
Raw Normal View History

<?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"/>
<property name="name" value="lucene"/>
<property name="Name" value="Lucene"/>
<property name="version" value="1.3-rc2-dev"/>
<property name="year" value="2000-2003"/> <!-- todo: make this dynamic -->
<property name="final.name" value="${name}-${version}"/>
<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.compiler.pedantic" value="false"/>
<property name="build.encoding" value="ISO-8859-1"/>
<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="javacc.jar.dir" location="${javacc.home}/bin/lib"/>
<property name="javacc.jar" location="${javacc.jar.dir}/javacc.jar"/>
<property name="javacc.main.class" value="org.javacc.parser.Main"/>
<property name="jakarta.site2.home" location="../jakarta-site2"/>
<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>
<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>
<path id="anakia.classpath">
<fileset dir="${jakarta.site2.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<!-- ================================================================== -->
<!-- Prepares the build directory -->
<!-- ================================================================== -->
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<available
property="javacc.present"
classname="${javacc.main.class}"
classpath="${javacc.jar}"
/>
<available
property="junit.present"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
/>
<tstamp>
<format property="DSTAMP" pattern="yyyy-MM-dd"/>
<format property="TSTAMP" pattern="HH:mm:ss"/>
</tstamp>
</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-core" depends="init">
<mkdir dir="${build.dir}/classes/java"/>
<javac
encoding="${build.encoding}"
srcdir="src/java"
includes="org/**/*.java"
destdir="${build.dir}/classes/java"
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-core" depends="compile-core">
<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} ${TSTAMP}"/>
<attribute name="Implementation-Vemdpr" 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">
<!-- todo: convert this to use war task instead -->
<jar destfile="${build.dir}/${demo.war.name}.war">
<fileset dir="src/jsp"/>
<zipfileset prefix="WEB-INF/lib" dir="${build.dir}" includes="${demo.name}.jar"/>
<zipfileset prefix="WEB-INF/lib" dir="${build.dir}" includes="${final.name}.jar"/>
</jar>
</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>
<!-- ================================================================== -->
<!-- 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" if="junit.present">
<mkdir dir="${junit.output.dir}"/>
<junit printsummary="off" haltonfailure="no"
errorProperty="tests.failed" failureProperty="tests.failed">
<classpath refid="junit.classpath"/>
<!-- <formatter type="plain"/> todo: does anyone use these text files? -->
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
<fileset dir="src/test" includes="**/Test*.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="Generate 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">
<available
classname="org.apache.velocity.anakia.AnakiaTask"
property="AnakiaTask.present"
classpathref="anakia.classpath"
/>
</target>
<target name="prepare-error" depends="docs-prepare" unless="AnakiaTask.present">
<echo>
AnakiaTask is not present! Please check to make sure that
you have jakarta.site2.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="${jakarta.site2.home}/xdocs/stylesheets"
>
</anakia>
<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>
<!-- ================================================================== -->
<!-- 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">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- ================================================================== -->
<!-- Build the JavaCC files into the source tree -->
<!-- ================================================================== -->
<target name="javacc" depends="javacc-StandardAnalyzer,javacc-QueryParser,javacc-HTMLParser"/>
<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"/>
<antcall target="invoke-javacc">
<param name="target" location="src/java/org/apache/lucene/analysis/standard/StandardTokenizer.jj"/>
<param name="output.dir" location="${build.dir}/gen/org/apache/lucene/analysis/standard"/>
</antcall>
<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">
<antcall target="invoke-javacc">
<param name="target" location="src/java/org/apache/lucene/queryParser/QueryParser.jj"/>
<param name="output.dir" location="src/java/org/apache/lucene/queryParser"/>
</antcall>
</target>
<target name="javacc-HTMLParser" depends="init,javacc-check" if="javacc.present">
<antcall target="invoke-javacc">
<param name="target" location="src/demo/org/apache/lucene/demo/html/HTMLParser.jj"/>
<param name="output.dir" location="src/demo/org/apache/lucene/demo/html"/>
</antcall>
</target>
<target name="invoke-javacc">
<java classname="${javacc.main.class}" fork="true">
<classpath path="${javacc.jar}"/>
<sysproperty key="install.root" file="${javacc.home}"/>
<arg value="-OUTPUT_DIRECTORY:${output.dir}"/>
<arg value="${target}"/>
</java>
</target>
<target name="default" depends="jar-core"/>
</project>