lucene/build.xml

591 lines
25 KiB
XML
Raw Normal View History

<?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"/>
<property name="javadoc.link" value="http://java.sun.com/j2se/1.4/docs/api/"/>
<!-- Type of checksum to compute for distribution files -->
<property name="checksum.algorithm" value="md5" />
<!-- Build classpath -->
<path id="classpath">
<pathelement location="${build.dir}/classes/java"/>
</path>
<!-- Javadoc classpath -->
<path id="javadoc.classpath">
<path refid="classpath"/>
<pathelement location="${ant.home}/lib/ant.jar"/>
<!-- NOTE: gdata jars only used with jdk 5 but include them even for lower jdk -->
<fileset dir="contrib">
<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"/>
<pathelement path="${java.class.path}"/>
</path>
<patternset id="src.dist.patterns"
includes="src/,build.xml,*build*.xml,docs/,*.txt,contrib/,"
excludes="contrib/db/*/lib/,contrib/*/ext-libs/,src/site/build/"
/>
<patternset id="binary.build.dist.patterns"
includes="${final.name}.jar,${demo.war.name}.war,${demo.name}.jar,docs/,contrib/*/*.jar"
/>
<patternset id="binary.root.dist.patterns"
includes="src/demo/,src/jsp/,docs/,*.txt"
excludes="${build.demo.template}"
/>
<!-- ================================================================== -->
<!-- Prepares the build directory -->
<!-- ================================================================== -->
<!-- Overrides common.compile-core to add rmic -->
<target name="compile-core" depends="common.compile-core"
description="Compiles core classes, including rmic">
<rmic classname="org.apache.lucene.search.RemoteSearchable"
base="${build.dir}/classes/java" stubversion="1.2">
<classpath refid="classpath"/>
</rmic>
</target>
<target name="test-core" depends="common.test"
description="Runs unit tests for the core Lucene code"
/>
<target name="test" depends="test-core, test-contrib"
description="Runs all unit tests"
/>
<!-- ================================================================== -->
<!-- J A R -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar-demo" depends="compile-demo">
<jar
destfile="${build.dir}/${demo.name}.jar"
basedir="${build.dir}/classes/demo"
excludes="**/*.java">
<manifest>
<attribute name="Specification-Title" value="Lucene Search Engine: demos"/>
<!-- spec version must match "digit+{.digit+}*" -->
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor"
value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/>
<!-- impl version can be any string -->
<attribute name="Implementation-Version"
value="${version}"/>
<attribute name="Implementation-Vendor"
value="The Apache Software Foundation"/>
<attribute name="X-Compile-Source-JDK"
value="${javac.source}"/>
<attribute name="X-Compile-Target-JDK"
value="${javac.target}"/>
</manifest>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</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"/>
<manifest>
<attribute name="Specification-Title" value="Lucene Search Engine: demos"/>
<!-- spec version must match "digit+{.digit+}*" -->
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor"
value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/>
<!-- impl version can be any string -->
<attribute name="Implementation-Version"
value="${version}"/>
<attribute name="Implementation-Vendor"
value="The Apache Software Foundation"/>
<attribute name="X-Compile-Source-JDK"
value="${javac.source}"/>
<attribute name="X-Compile-Target-JDK"
value="${javac.target}"/>
</manifest>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</war>
</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>
<!-- GCJ -->
<target name="gcj" depends="jar,jar-demo">
<exec executable="make" dir="src/gcj" failonerror="true"/>
</target>
<!-- TODO: Remove dependency on demo from test -->
<target name="compile-test" depends="compile-demo,common.compile-test"/>
<!-- ================================================================== -->
<!-- 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="build-contrib">
<mkdir dir="${build.dir}/docs/api"/>
<invoke-javadoc
access="protected"
destdir="${build.dir}/docs/api"
/>
</target>
<target name="javadocs-internal" depends="build-contrib">
<mkdir dir="${build.dir}/docs/api-internal"/>
<invoke-javadoc
access="package"
destdir="${build.dir}/docs/api-internal"
/>
</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">
<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">
<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}"/>
</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">
<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"/>
<!-- ================================================================== -->
<!-- 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/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/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="src/demo/org/apache/lucene/demo/html" includes="*.java">
<containsregexp expression="Generated.*By.*JavaCC"/>
</fileset>
</delete>
</target>
<target name="javacc" depends="clean-javacc,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"/>
<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-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>
<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" depends="compile-test">
<contrib-crawl/>
</target>
<target name="test-contrib" depends="compile-test">
<!-- 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
-->
<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>
<macrodef name="invoke-javadoc">
<attribute name="access"/>
<attribute name="destdir"/>
<sequential>
<dirset dir="contrib/gdata-server/src/core/src/java" id="gdata-server-core">
<include name="**" if="build-1-5-contrib" />
</dirset>
<dirset dir="contrib/gdata-server/src/gom/src/java" id="gdata-server-gom">
<include name="**" if="build-1-5-contrib" />
</dirset>
<dirset dir="contrib/gdata-server/src/hivemind/src/java" id="gdata-server-hivemind">
<include name="**" if="build-1-5-contrib" />
</dirset>
<javadoc
overview="src/java/overview.html"
packagenames="org.apache.lucene.*"
destdir="@{destdir}"
access="@{access}"
encoding="${build.encoding}"
author="true"
version="true"
use="true"
source="${ant.java.version}"
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:"/>
<!-- 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... -->
<!-- with the minor exception of gdata which is managed by ref -->
<!-- ie: `find contrib/* -path \*src/java | grep -v gdata | sort` -->
<!-- if you make changes to the list of package sets, also -->
<!-- make sure the group list below is updated. -->
<packageset dir="contrib/analyzers/src/java"/>
<packageset dir="contrib/ant/src/java"/>
<packageset dir="contrib/benchmark/src/java"/>
<packageset dir="contrib/db/bdb-je/src/java"/>
<packageset dir="contrib/db/bdb/src/java"/>
<packageset dir="contrib/highlighter/src/java"/>
<packageset dir="contrib/lucli/src/java"/>
<packageset dir="contrib/memory/src/java"/>
<packageset dir="contrib/miscellaneous/src/java"/>
<packageset dir="contrib/queries/src/java"/>
<packageset dir="contrib/regex/src/java"/>
<packageset dir="contrib/similarity/src/java"/>
<packageset dir="contrib/snowball/src/java"/>
<packageset dir="contrib/spellchecker/src/java"/>
<packageset dir="contrib/surround/src/java"/>
<packageset dir="contrib/swing/src/java"/>
<packageset dir="contrib/wordnet/src/java"/>
<packageset dir="contrib/xml-query-parser/src/java"/>
<!-- end alpha sort -->
<packageset refid="gdata-server-core" />
<packageset refid="gdata-server-gom" />
<packageset refid="gdata-server-hivemind" />
<!-- 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*"/>
<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: DB" packages="org.apache.lucene.store.db*:org.apache.lucene.store.je*:com.sleepycat*"/>
<group title="contrib: Highlighter" packages="org.apache.lucene.search.highlight*"/>
<group title="contrib: GData Server (Java1.5)" packages="org.apache.lucene.gdata.*"/>
<group title="contrib: Lucli" packages="lucli*"/>
<group title="contrib: Memory" packages="org.apache.lucene.index.memory*"/>
<group title="contrib: Miscellaneous " 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: RegEx" packages="org.apache.lucene.search.regex*:org.apache.regexp*"/>
<!-- no group for similarity. -->
<!-- nothing in there at the moment, so no package structure -->
<group title="contrib: Snowball" packages="org.apache.lucene.analysis.snowball*:net.sf.snowball*"/>
<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: WordNet" packages="org.apache.lucene.wordnet*"/>
<group title="contrib: XML Query Parser" packages="org.apache.lucene.xmlparser*"/>
<classpath refid="javadoc.classpath"/>
</javadoc>
</sequential>
</macrodef>
<!-- Macro for building checksum files
This is only needed until the "format" option is supported
by ant's built in checksum task
-->
<macrodef name="lucene-checksum">
<attribute name="file"/>
<!-- NOTE: we use the value of @{file} in the names any properties
set because macro's don't have variables, and otherwise we
wouldn't be able to checksum more then one file per build
-->
<sequential>
<checksum file="@{file}"
property="@{file}.sum"
algorithm="${checksum.algorithm}" />
<basename file="@{file}" property="@{file}.base" />
<concat destfile="@{file}.${checksum.algorithm}"
force="yes"
append="false"
fixlastline="yes">
<header trimleading="yes">${@{file}.sum} </header>
<!-- empty fileset to trick concat -->
<fileset dir="." excludes="**" />
<footer trimleading="yes">${@{file}.base}
</footer>
</concat>
</sequential>
</macrodef>
</project>