Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

overhaul of build system to facilitate building and packaging of contrib sub-projects. some work still to be done, but core Lucene build still working fine

Erik Hatcherc3847f26ea76
diff --git a/build.xml b/build.xml
index a47ea713f35..f36e72ce2f6 100644
--- a/build.xml
+++ b/build.xml
@@ -1,51 +1,22 @@
<?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="javac.source" value="1.3"/>
- <property name="javac.target" value="1.3"/>
-
- <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"/>
+<project name="lucene" default="default" basedir=".">
- <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"/>
+ <import file="common-build.xml"/>
- <property name="javacc.home" location="."/>
+ <!-- Import tests for deprecation compliance.
+ This will be removed for Lucene 2.0
+ -->
+ <import file="build-deprecated.xml"/>
- <property name="junit.output.dir" location="${build.dir}/test"/>
- <property name="junit.reports" location="${build.dir}/test/reports"/>
+ <property name="demo.name" value="${name}-demos-${version}"/>
+ <property name="demo.war.name" value="luceneweb"/>
+ <property name="javadoc.link" value="http://java.sun.com/j2se/1.4/docs/api/"/>
<!-- Build classpath -->
<path id="classpath">
<pathelement location="${build.dir}/classes/java"/>
- <fileset dir="lib">
- <include name="*.jar"/>
- </fileset>
</path>
<path id="demo.classpath">
@@ -58,11 +29,6 @@
<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"/>
@@ -74,93 +40,14 @@
<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"/>
- <compile
- srcdir="src/java"
- destdir="${build.dir}/classes/java">
- <classpath refid="classpath"/>
- </compile>
+ <!-- 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">
<classpath refid="classpath"/>
@@ -172,26 +59,6 @@
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
- <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
@@ -210,17 +77,6 @@
</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 -->
<!-- ================================================================== -->
@@ -242,110 +98,10 @@
</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"/>
- <compile
- srcdir="src/test-deprecated"
- destdir="${build.dir}/classes/test-deprecated">
- <classpath refid="test-deprecated.classpath"/>
- </compile>
- </target>
+ <!-- TODO: Remove dependency on demo from test -->
+ <target name="compile-test" depends="compile-demo,common.compile-test"/>
- <!-- ================================================================== -->
- <!-- 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"/>
- <compile
- srcdir="src/test"
- destdir="${build.dir}/classes/test">
- <classpath refid="test.classpath"/>
- </compile>
- </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 -->
@@ -406,52 +162,6 @@
</target>
- <!-- ================================================================== -->
- <!-- J A V A D O C -->
- <!-- ================================================================== -->
- <!-- -->
- <!-- ================================================================== -->
- <macrodef name="invoke-javadoc">
- <attribute name="access"/>
- <attribute name="destdir"/>
- <sequential>
- <javadoc
- overview="src/java/overview.html"
- packagenames="org.apache.lucene.*"
- destdir="@{destdir}"
- access="@{access}"
- 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:"/>
-
- <!-- TODO: find a dynamic way to do include multiple source roots -->
- <packageset dir="src/java"/>
- <packageset dir="contrib/analyzers/src/java"/>
- <packageset dir="contrib/WordNet/src/java"/>
- <packageset dir="contrib/highlighter/src/java"/>
- <packageset dir="contrib/similarity/src/java"/>
- <packageset dir="contrib/spellchecker/src/java"/>
- <packageset dir="contrib/snowball/src/java" excludes="net/"/>
- <packageset dir="contrib/swing/src/java"/>
-
- <group title="Core" packages="org.apache.*:org.apache.lucene.analysis:org.apache.lucene.analysis.standard*"/>
- <group title="Analysis" packages="org.apache.lucene.analysis.*"/>
- <group title="Snowball" packages="org.apache.lucene.analysis.snowball*"/>
- <group title="Highlighter" packages="org.apache.lucene.search.highlight*"/>
- <group title="MoreLikeThis" packages="org.apache.lucene.search.similar*"/>
- <group title="SpellChecker" packages="org.apache.lucene.search.spell*"/>
- <group title="WordNet" packages="org.apache.lucene.wordnet*"/>
- <group title="Swing" packages="org.apache.lucene.swing*"/>
- </javadoc>
- </sequential>
- </macrodef>
-
<target name="javadocs">
<mkdir dir="${build.dir}/docs/api"/>
<invoke-javadoc
@@ -468,6 +178,7 @@
/>
</target>
+
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
@@ -584,18 +295,6 @@
<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 -->
<!-- ================================================================== -->
@@ -632,39 +331,7 @@
<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>
-
- <macrodef name="compile">
- <attribute name="srcdir"/>
- <attribute name="destdir"/>
- <element name="nested" implicit="yes" optional="yes"/>
- <sequential>
- <javac
- encoding="${build.encoding}"
- srcdir="@{srcdir}"
- destdir="@{destdir}"
- deprecation="${javac.deprecation}"
- debug="${javac.debug}"
- source="${javac.source}"
- target="${javac.target}">
- <nested/>
- </javac>
- </sequential>
- </macrodef>
<target name="javacc-StandardAnalyzer" depends="init,javacc-check" if="javacc.present">
<!-- generate this in a build directory so we can exclude ParseException -->
@@ -699,13 +366,63 @@
/>
</target>
+ <macrodef name="contrib-crawl">
+ <attribute name="target" default=""/>
+ <sequential>
+ <subant target="@{target}" failonerror="true">
+ <property name="dist.dir" location="${dist.dir}"/>
+
+ <fileset dir="."
+ includes="contrib/*/build.xml"
+ />
+ </subant>
+ </sequential>
+ </macrodef>
+
<target name="build-contrib" depends="compile-test">
- <mkdir dir="${build.dir}/contrib"/>
- <ant antfile="contrib/build.xml" inheritall="false">
- <property name="dist.dir" location="${build.dir}/contrib"/>
- </ant>
+ <contrib-crawl/>
</target>
- <target name="default" depends="jar-core"/>
+ <macrodef name="invoke-javadoc">
+ <attribute name="access"/>
+ <attribute name="destdir"/>
+ <sequential>
+ <javadoc
+ overview="src/java/overview.html"
+ packagenames="org.apache.lucene.*"
+ destdir="@{destdir}"
+ access="@{access}"
+ 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:"/>
+
+ <!-- TODO: find a dynamic way to do include multiple source roots -->
+ <packageset dir="src/java"/>
+ <packageset dir="contrib/analyzers/src/java"/>
+ <packageset dir="contrib/WordNet/src/java"/>
+ <packageset dir="contrib/highlighter/src/java"/>
+ <packageset dir="contrib/similarity/src/java"/>
+ <packageset dir="contrib/spellchecker/src/java"/>
+ <packageset dir="contrib/snowball/src/java" excludes="net/"/>
+ <packageset dir="contrib/swing/src/java"/>
+
+ <group title="Core" packages="org.apache.*:org.apache.lucene.analysis:org.apache.lucene.analysis.standard*"/>
+ <group title="Analysis" packages="org.apache.lucene.analysis.*"/>
+ <group title="Snowball" packages="org.apache.lucene.analysis.snowball*"/>
+ <group title="Highlighter" packages="org.apache.lucene.search.highlight*"/>
+ <group title="MoreLikeThis" packages="org.apache.lucene.search.similar*"/>
+ <group title="SpellChecker" packages="org.apache.lucene.search.spell*"/>
+ <group title="WordNet" packages="org.apache.lucene.wordnet*"/>
+ <group title="Swing" packages="org.apache.lucene.swing*"/>
+ </javadoc>
+ </sequential>
+ </macrodef>
+
</project>
diff --git a/common-build.xml b/common-build.xml
new file mode 100644
index 00000000000..127df7e5a6f
--- /dev/null
+++ b/common-build.xml
@@ -0,0 +1,253 @@
+<?xml version="1.0"?>
+<project name="common">
+ <description>
+ This file is designed for importing into a main build file, and not intended
+ for standalone use.
+ </description>
+
+ <dirname file="${ant.file.common}" property="common.dir"/>
+
+ <!-- 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="${ant.project.name}"/>
+ <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="javac.source" value="1.3"/>
+ <property name="javac.target" value="1.3"/>
+
+ <property name="project.name" value="site"/> <!-- todo: is this used by anakia or something else? -->
+ <property name="build.encoding" value="utf-8"/>
+
+ <property name="src.dir" location="src/java"/>
+ <property name="build.dir" location="build"/>
+ <property name="dist.dir" location="dist"/>
+
+ <property name="javacc.home" location="."/>
+
+ <property name="junit.output.dir" location="${build.dir}/test"/>
+ <property name="junit.reports" location="${build.dir}/test/reports"/>
+
+
+ <available
+ property="javacc.present"
+ classname="org.javacc.parser.Main"
+ classpath="${javacc.home}/bin/lib/javacc.jar"
+ />
+
+ <available
+ property="junit.present"
+ classname="junit.framework.TestCase"
+ />
+
+ <target name="clean"
+ description="Removes contents of build and dist directories">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.dir}"/>
+ <delete file="velocity.log"/>
+ </target>
+
+ <!-- TODO: maybe make JavaCC checking specific to only the projects
+ that use it (Lucene core and contrib/miscellaneous
+ -->
+ <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">
+ </target>
+
+ <target name="javacc-check">
+ <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>
+
+
+ <target name="compile-core" depends="init"
+ description="Compiles core classes">
+ <compile
+ srcdir="src/java"
+ destdir="${build.dir}/classes/java">
+ <classpath refid="classpath"/>
+ </compile>
+ </target>
+
+ <target name="compile" depends="compile-core">
+ <!-- convenience target to compile core -->
+ </target>
+
+ <target name="jar-core" depends="compile-core"
+ description="Packages the JAR file">
+ <jar
+ destfile="${build.dir}/${final.name}.jar"
+ basedir="${build.dir}/classes/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="compile-test" depends="compile-core">
+ <compile
+ srcdir="src/test"
+ destdir="${build.dir}/classes/test">
+ <classpath refid="test.classpath"/>
+ </compile>
+
+ <!-- Copy any data files present to the classpath -->
+ <copy todir="${build.dir}/classes/test">
+ <fileset dir="src/test" excludes="**/*.java"/>
+ </copy>
+ </target>
+
+ <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"/>
+ <!-- TODO: create propertyset for test properties, so each project can have its own set -->
+ <sysproperty key="dataDir" file="src/test"/>
+ <sysproperty key="tempDir" file="${build.dir}/test"/>
+
+ <!-- contrib/ant IndexTaskTest needs these two system properties -->
+ <sysproperty key="docs.dir" file="src/test"/>
+ <sysproperty key="index.dir" file="${build.dir}/test/index"/>
+
+ <formatter type="xml"/>
+ <formatter type="brief" usefile="false"/>
+ <batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
+ <fileset dir="src/test" includes="**/Test*.java"/>
+ <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>
+
+ <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>
+
+ <target name="jar" depends="jar-core">
+ <!-- convenience target to package core JAR -->
+ </target>
+
+ <target name="jar-src" depends="init">
+ <jar destfile="${build.dir}/${final.name}-src.jar">
+ <fileset dir="." includes="src/"/>
+ </jar>
+ </target>
+
+ <target name="default" depends="jar-core"/>
+
+ <!--+
+ | M A C R O S
+ +-->
+ <macrodef name="compile">
+ <attribute name="srcdir"/>
+ <attribute name="destdir"/>
+ <element name="nested" implicit="yes" optional="yes"/>
+
+ <sequential>
+ <mkdir dir="@{destdir}"/>
+ <javac
+ encoding="${build.encoding}"
+ srcdir="@{srcdir}"
+ destdir="@{destdir}"
+ deprecation="${javac.deprecation}"
+ debug="${javac.debug}"
+ source="${javac.source}"
+ target="${javac.target}">
+ <nested/>
+ </javac>
+ </sequential>
+ </macrodef>
+
+ <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>
+
+</project>
+
diff --git a/contrib/WordNet/build.xml b/contrib/WordNet/build.xml
index 9c584770d0f..5cc45a57c6b 100644
--- a/contrib/WordNet/build.xml
+++ b/contrib/WordNet/build.xml
@@ -11,7 +11,7 @@
<available property="synindex.exists" file="${synindex.dir}" type="dir"/>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
<target name="index" depends="compile" description="Build WordNet index">
<fail if="synindex.exists">
@@ -21,7 +21,7 @@
<java classname="org.apache.lucene.wordnet.Syns2Index">
<classpath>
<path refid="compile.classpath"/>
- <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${build.dir}/classes"/>
</classpath>
<arg file="${prolog.file}"/>
@@ -42,7 +42,7 @@
<java classname="org.apache.lucene.wordnet.SynLookup">
<classpath>
<path refid="compile.classpath"/>
- <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${build.dir}/classes"/>
</classpath>
<arg file="${synindex.dir}"/>
@@ -62,7 +62,7 @@
<java classname="org.apache.lucene.wordnet.SynExpand">
<classpath>
<path refid="compile.classpath"/>
- <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${build.dir}/classes"/>
</classpath>
<arg file="${synindex.dir}"/>
diff --git a/contrib/analyzers/build.xml b/contrib/analyzers/build.xml
index ddd18df8f78..6b30ad583e7 100644
--- a/contrib/analyzers/build.xml
+++ b/contrib/analyzers/build.xml
@@ -6,5 +6,5 @@
Additional Analyzers
</description>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/contrib/ant/build.xml b/contrib/ant/build.xml
index db4617bf773..06888bf1c60 100644
--- a/contrib/ant/build.xml
+++ b/contrib/ant/build.xml
@@ -15,28 +15,5 @@
refid="additional.dependencies"
/>
- <!-- alias classpath for cleaner example in index target -->
- <path id="index.classpath">
- <path refid="test.classpath"/>
- </path>
-
- <import file="../common.xml"/>
-
- <property name="index.dir" location="${test.output.dir}/index"/>
- <property name="files.dir" location="${test.src.dir}"/>
-
- <target name="index" depends="compile">
- <taskdef name="index"
- classname="org.apache.lucene.ant.IndexTask"
- classpathref="index.classpath"
- />
-<!-- <typedef file="src/main/org/apache/lucene/ant/antlib.xml"
- uri="lucene:/org/apache/lucene/ant"
- classpathref="index.classpath"/> -->
-
- <index index="${index.dir}">
- <fileset dir="${files.dir}"/>
- </index>
- </target>
-
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/contrib/build.xml b/contrib/build.xml
deleted file mode 100644
index c56a1dd1557..00000000000
--- a/contrib/build.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<project name="sandbox" default="build-tree">
-
- <property name="dist.dir" location="dist"/>
-
- <macrodef name="crawl">
- <attribute name="target" default=""/>
- <sequential>
- <subant target="@{target}" failonerror="false">
- <property name="dist.dir" location="${dist.dir}"/>
-
- <fileset dir="."
- includes="*/build.xml"
- excludes="taglib/build.xml"
- />
- </subant>
- </sequential>
- </macrodef>
-
- <target name="clean">
- <crawl target="clean"/>
- </target>
-
- <target name="build-tree">
- <crawl/>
- </target>
-</project>
diff --git a/contrib/common.xml b/contrib/common.xml
deleted file mode 100644
index 3502de445de..00000000000
--- a/contrib/common.xml
+++ /dev/null
@@ -1,243 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="common">
-
- <!-- default values, intended to be overridden-->
- <property name="version" value="dev"/>
- <property name="Name" value="${ant.project.name}"/>
-
- <!-- not intended to be overridden-->
- <property name="src.dir" location="src/java"/>
- <property name="build.dir" location="build"/>
- <property name="build.classes.dir" location="${build.dir}/classes"/>
- <property name="build.javadoc" value="${build.dir}/docs/api"/>
- <property name="build.encoding" value="utf-8"/>
-
- <property name="release.host" value="www.apache.org"/>
- <property name="release.path" value="/www/cvs.apache.org/dist/jakarta/lucene/sandbox/${ant.project.name}"/>
-
- <property name="web.host" value="www.apache.org"/>
- <property name="web.path" value="/www/jakarta.apache.org/lucene/docs/lucene-sandbox/${ant.project.name}"/>
-
- <property name="javadoc.link.java" value="http://java.sun.com/j2se/1.4.1/docs/api/"/>
- <property name="javadoc.link.lucene" value="http://jakarta.apache.org/lucene/docs/api/"/>
-
- <property name="test.src.dir" location="src/test"/>
- <property name="test.output.dir" location="${build.dir}/test"/>
- <property name="test.classes.dir" location="${test.output.dir}/classes"/>
-
- <property name="dist.dir" location="dist"/>
- <property name="dist.name" value="${ant.project.name}-${version}"/>
- <property name="package.dir" location="dist/${dist.name}"/>
-
- <property name="junit.jar" location="${ant.home}/lib/junit.jar"/>
- <dirname file="${ant.file.common}" property="common.dir"/>
- <property name="lucene.dir" location="${common.dir}/.."/>
-
- <property name="build.debug" value="true"/>
- <property name="junit.fork" value="true"/>
-
- <property name="jakarta.site2.home" location="../../../jakarta-site2"/>
- <property name="project.name" value="site"/>
- <property name="docs.src" location="xdocs"/>
- <property name="docs.dest" location="docs"/>
-
- <path id="anakia.classpath">
- <fileset dir="${jakarta.site2.home}/lib">
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <!-- ========================================================== -->
- <!-- Datatype declarations -->
- <!-- ========================================================== -->
- <!-- TODO: define ${lucene.jar} for easier overriding -->
- <path id="compile.classpath">
- <fileset dir="${lucene.dir}" includes="build/lucene*.jar"/>
- <pathelement path="${project.classpath}"/>
- </path>
-
- <path id="test.classpath">
- <path refid="compile.classpath"/>
- <pathelement location="${junit.jar}"/>
- <pathelement location="${build.classes.dir}"/>
- <pathelement location="${test.classes.dir}"/>
- <pathelement location="${lucene.dir}/build/classes/test"/>
- </path>
-
-
- <target name="init">
- <echo message="Building ${ant.project.name}"/>
- <tstamp/>
-
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${build.classes.dir}"/>
- <mkdir dir="${dist.dir}"/>
-
- <mkdir dir="${test.output.dir}"/>
- <mkdir dir="${test.classes.dir}"/>
-
- <available property="has.tests" file="${test.src.dir}" type="dir"/>
- </target>
-
- <target name="clean"
- description="Deletes all previous build artifacts">
- <delete dir="${build.dir}"/>
- <delete dir="${build.classes.dir}"/>
- <delete dir="${dist.dir}"/>
- <delete dir="${package.dir}"/>
-
- <delete dir="${test.output.dir}"/>
- <delete dir="${test.classes.dir}"/>
- </target>
-
- <target name="dist" depends="compile" description="Create JAR">
- <jar jarfile="${dist.dir}/${dist.name}.jar"
- basedir="${build.classes.dir}"
- />
- </target>
-
- <target name="compile" depends="init">
- <javac destdir="${build.classes.dir}"
- debug="${build.debug}"
- includeAntRuntime="yes"
- deprecation="true"
- srcdir="${src.dir}"
- classpathref="compile.classpath"
- encoding="${build.encoding}"
- />
- <copy todir="${build.classes.dir}">
- <fileset dir="${src.dir}" excludes="**/*.java"/>
- </copy>
- </target>
-
- <target name="test-compile" depends="compile" if="has.tests">
- <javac destdir="${test.classes.dir}"
- debug="${build.debug}"
- deprecation="true"
- includeAntRuntime="yes"
- srcdir="src/test"
- classpathref="test.classpath"
- encoding="${build.encoding}"
- />
-
- <copy todir="${test.classes.dir}">
- <fileset dir="src/test" excludes="**/*.java"/>
- </copy>
- </target>
-
- <target name="test" depends="test-compile" if="has.tests">
- <junit printsummary="no"
- errorProperty="test.failed"
- failureProperty="test.failed"
- fork="${junit.fork}">
- <classpath refid="test.classpath"/>
- <sysproperty key="docs.dir" file="${test.classes.dir}"/>
- <sysproperty key="index.dir" file="${test.output.dir}/index"/>
- <sysproperty key="dataDir" file="${test.src.dir}"/>
- <formatter type="brief" usefile="false"/>
- <test name="${testcase}" if="testcase"/>
- <batchtest todir="${test.data.dir}" unless="testcase">
- <fileset dir="${test.classes.dir}"
- includes="**/*Test.class,**/Test*.class"
- />
- </batchtest>
- </junit>
-
- <fail if="test.failed">
- Unit tests failed. Check log or reports for details
- </fail>
-
- </target>
-
- <target name="default" depends="test,dist"/>
-
- <!-- ================================================================== -->
- <!-- Documentation -->
- <!-- ================================================================== -->
- <target name="javadoc" depends="compile">
- <mkdir dir="${build.javadoc}"/>
- <javadoc
- sourcepath="${src.dir}"
- overview="${src.dir}/overview.html"
- packagenames="*"
- destdir="${build.javadoc}"
- author="true"
- version="true"
- use="true"
- windowtitle="${Name} ${version} API"
- doctitle="${Name} ${version} API"
- encoding="${build.encoding}"
- >
- <link href="${javadoc.link.java}"/>
- <link href="${javadoc.link.lucene}"/>
- <tag name="todo" description="To Do:"/>
- <classpath refid="compile.classpath"/>
- </javadoc>
- </target>
-
- <!-- ================================================================== -->
- <!-- D I S T R I B U T I O N -->
- <!-- ================================================================== -->
- <!-- -->
- <!-- ================================================================== -->
- <target name="package" depends="dist, javadoc">
- <mkdir dir="${package.dir}"/>
- <mkdir dir="${package.dir}/docs"/>
- <mkdir dir="${package.dir}/docs/api"/>
- <mkdir dir="${docs.dest}"/>
- <copy todir="${package.dir}/docs/api">
- <fileset dir="${build.javadoc}"/>
- </copy>
-
- <copy todir="${package.dir}/docs">
- <fileset dir="${docs.dest}/"/>
- </copy>
-
- <copy todir="${package.dir}">
- <fileset dir=".">
- <include name="*.txt"/>
- </fileset>
- </copy>
-
- <copy todir="${package.dir}/src">
- <fileset dir="src"/>
- </copy>
- <copy todir="${package.dir}/" file="build.xml"/>
- <copy todir="${dist.dir}/" file="${common.dir}/common.xml"/>
-
- <copy file="${dist.dir}/${dist.name}.jar" todir="${package.dir}"/>
-
- <tar tarfile="${dist.dir}/${dist.name}.tar.gz" basedir="${dist.dir}/"
- compression="gzip" includes="${dist.name}/**,common.xml"/>
-
- </target>
-
- <!-- ================================================================== -->
- <!-- Copy release to server -->
- <!-- ================================================================== -->
- <target name="release" depends="package">
- <exec executable="ssh">
- <arg value="${release.host}"/>
- <arg value="mkdir"/>
- <arg value="${release.path}/${dist.name}"/>
- </exec>
- <exec executable="scp">
- <arg value="${dist.dir}/${dist.name}.jar"/>
- <arg value="${dist.dir}/${dist.name}.tar.gz"/>
- <arg value="${release.host}:${release.path}/${dist.name}"/>
- </exec>
- <exec executable="ssh">
- <arg value="${web.host}"/>
- <arg value="rm"/>
- <arg value="-rf"/>
- <arg value="${web.path}/api"/>
- </exec>
- <exec executable="scp">
- <arg value="-r"/>
- <arg value="${build.javadoc}"/>
- <arg value="${web.host}:${web.path}/api"/>
- </exec>
- </target>
-
-</project>
diff --git a/contrib/contrib-build.xml b/contrib/contrib-build.xml
new file mode 100644
index 00000000000..5a9c9a6b6fc
--- /dev/null
+++ b/contrib/contrib-build.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+
+<project name="contrib-build">
+ <echo>Building ${ant.project.name}...</echo>
+
+ <!-- TODO: adjust build.dir appropriately when a contrib project is run individually -->
+ <property name="build.dir" location="../../build/contrib/${ant.project.name}"/>
+
+ <import file="../common-build.xml"/>
+
+ <property name="lucene.jar" location="${common.dir}/build/lucene-${version}.jar"/>
+ <available property="lucene.jar.present" type="file" file="${lucene.jar}"/>
+
+ <path id="classpath">
+ <pathelement path="${lucene.jar}"/>
+ <pathelement path="${project.classpath}"/>
+ </path>
+
+ <path id="test.classpath">
+ <path refid="classpath"/>
+ <pathelement location="${junit.jar}"/>
+ <pathelement location="${build.dir}/classes/java"/>
+ </path>
+
+ <path id="junit.classpath">
+ <path refid="test.classpath"/>
+ <pathelement location="${build.dir}/classes/test"/>
+ <pathelement location="${build.dir}/classes/java"/>
+ </path>
+
+ <target name="build-lucene" unless="lucene.jar.present">
+ <!-- TODO: some tests need some of Lucene's own test classes too -->
+ <ant antfile="${common.dir}/build.xml" target="jar-core" inheritall="false"/>
+ </target>
+
+ <target name="init" depends="common.init,build-lucene"/>
+</project>
diff --git a/contrib/db/build.xml b/contrib/db/build.xml
index f1ab78fb5db..dac0e31b20d 100644
--- a/contrib/db/build.xml
+++ b/contrib/db/build.xml
@@ -18,7 +18,7 @@
refid="db-4.3.27"
/>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
<target name="get-db-jar" unless="db.jar.exists">
<mkdir dir="lib"/>
diff --git a/contrib/highlighter/build.xml b/contrib/highlighter/build.xml
index 11e95afddb3..f8cfe6644aa 100644
--- a/contrib/highlighter/build.xml
+++ b/contrib/highlighter/build.xml
@@ -6,5 +6,5 @@
Hits highlighter
</description>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/contrib/lucli/build.xml b/contrib/lucli/build.xml
index 5d25d27a79c..963d9385d53 100644
--- a/contrib/lucli/build.xml
+++ b/contrib/lucli/build.xml
@@ -20,10 +20,10 @@
<target name="dist" depends="compile" description="Create JAR">
<jar jarfile="${dist.dir}/${dist.name}.jar"
- basedir="${build.classes.dir}"
+ basedir="${build.dir}/classes"
manifest="META-INF/MANIFEST.MF"
/>
</target>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/contrib/miscellaneous/build.xml b/contrib/miscellaneous/build.xml
index b8228e7c85f..3d0874cc0f7 100644
--- a/contrib/miscellaneous/build.xml
+++ b/contrib/miscellaneous/build.xml
@@ -2,9 +2,11 @@
<project name="misc" default="default">
+ <!-- TODO: add javacc capability for PrecedenceQueryParser -->
+
<description>
Miscellaneous Lucene extensions
</description>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/contrib/similarity/build.xml b/contrib/similarity/build.xml
index 1eaac43e919..dbd10c98340 100755
--- a/contrib/similarity/build.xml
+++ b/contrib/similarity/build.xml
@@ -3,8 +3,8 @@
<project name="similarity" default="default">
<description>
- Hits highlighter
+ Similarity - MoreLikeThis
</description>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/contrib/snowball/build.xml b/contrib/snowball/build.xml
index e53098c5aa8..0a2eb662565 100644
--- a/contrib/snowball/build.xml
+++ b/contrib/snowball/build.xml
@@ -6,10 +6,7 @@
Snowball Analyzers
</description>
- <property name="version" value="1.1-dev"/>
- <property name="Name" value="Snowball Analyzers"/>
-
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
<property name="snowball.cvsroot" value=":pserver:[email protected]:/home/cvs"/>
<property name="snowball.cvs.password" value="anonymous"/>
diff --git a/contrib/spellchecker/build.xml b/contrib/spellchecker/build.xml
index 3f881fbd4e1..cebfd50a58a 100755
--- a/contrib/spellchecker/build.xml
+++ b/contrib/spellchecker/build.xml
@@ -6,5 +6,5 @@
Spell Checker
</description>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/contrib/swing/build.xml b/contrib/swing/build.xml
index 28ea90cc569..c9198fe87b6 100644
--- a/contrib/swing/build.xml
+++ b/contrib/swing/build.xml
@@ -6,7 +6,7 @@
Swing Models
</description>
- <import file="../common.xml"/>
+ <import file="../contrib-build.xml"/>
<target name="list-demo" depends="compile">
<java classname="org.apache.lucene.swing.models.ListSearcherSimulator"
diff --git a/lib/junit-3.8.1.jar b/lib/junit-3.8.1.jar
deleted file mode 100644
index 006376027b4..00000000000
--- a/lib/junit-3.8.1.jar
+++ /dev/null
@@ -1,2 +0,0 @@
-AnyObjectId[674d71e89ea154dbe2e3cd032821c22b39e8fd68] was removed in git history.
-Apache SVN contains full history.
\ No newline at end of file