2006-01-29 10:16:56 -05:00
|
|
|
<!-- Solr build file -->
|
|
|
|
<project name="solr" default="usage" basedir=".">
|
|
|
|
<!-- Initialize property values: allow easy customization via build.properties -->
|
|
|
|
<property file="build.properties" />
|
|
|
|
|
2006-02-17 19:17:44 -05:00
|
|
|
<property name="Name" value="Solr" />
|
|
|
|
|
2006-01-29 10:16:56 -05:00
|
|
|
<!-- Solr version -->
|
|
|
|
<property name="version" value="1.0" />
|
|
|
|
|
|
|
|
<!-- 3rd party libraries for compilation -->
|
|
|
|
<property name="lib" value="lib" />
|
|
|
|
|
|
|
|
<!-- solr source files -->
|
|
|
|
<property name="src" value="src" />
|
|
|
|
|
|
|
|
<!-- Destination for compiled classes and binaries -->
|
|
|
|
<property name="dest" value="build" />
|
|
|
|
|
|
|
|
<!-- Destination for distribution files (demo WAR, src distro, etc.) -->
|
|
|
|
<property name="dist" value="dist" />
|
|
|
|
|
2006-02-15 20:05:55 -05:00
|
|
|
<!-- Example directory -->
|
|
|
|
<property name="example" value="example" />
|
|
|
|
|
2006-05-27 17:55:39 -04:00
|
|
|
<!-- Javadoc properties -->
|
|
|
|
<property name="year" value="2006" />
|
2006-02-17 19:17:44 -05:00
|
|
|
<property name="build.docs" value="${dest}/docs"/>
|
2006-05-27 20:41:33 -04:00
|
|
|
<property name="build.javadoc" value="${build.docs}/api"/>
|
|
|
|
<property name="javadoc.access" value="protected"/>
|
2006-02-17 19:17:44 -05:00
|
|
|
<property name="javadoc.link.java"
|
|
|
|
value="http://java.sun.com/j2se/1.5.0/docs/api/"/>
|
2006-05-26 21:35:44 -04:00
|
|
|
<property name="javadoc.link.junit"
|
|
|
|
value="http://junit.sourceforge.net/javadoc/"/>
|
|
|
|
<property name="javadoc.link.lucene"
|
|
|
|
value="http://lucene.apache.org/java/docs/api/"/>
|
2006-02-17 19:17:44 -05:00
|
|
|
<property name="javadoc.packages" value="org.apache.solr.*"/>
|
|
|
|
|
2006-05-27 17:55:39 -04:00
|
|
|
<!-- JUnit properties -->
|
2006-04-11 00:36:46 -04:00
|
|
|
<property name="junit.output.dir" location="${dest}/test-results"/>
|
|
|
|
<property name="junit.reports" location="${dest}/test-results/reports"/>
|
|
|
|
<property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
|
|
|
|
|
|
|
|
|
2006-01-29 10:16:56 -05:00
|
|
|
<!-- Default target: usage. Prints out instructions. -->
|
|
|
|
<target name="usage"
|
|
|
|
description="Prints out instructions">
|
|
|
|
<echo message="Welcome to the Solr project!" />
|
2006-01-29 10:50:23 -05:00
|
|
|
<echo message="Use 'ant compile' to compile the source code." />
|
2006-01-29 10:16:56 -05:00
|
|
|
<echo message="Use 'ant dist' to build the project distribution files." />
|
2006-02-23 17:20:55 -05:00
|
|
|
<echo message="Use 'ant example' to install solr.war in ./example" />
|
2006-01-29 10:16:56 -05:00
|
|
|
<echo message="Use 'ant clean' to clean compiled files." />
|
|
|
|
<echo message="Use 'ant test' to run unit tests." />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Clean: cleans compiled files and other temporary artifacts. -->
|
|
|
|
<target name="clean"
|
|
|
|
description="Cleans compiled files and other temporary artifacts.">
|
|
|
|
<delete dir="${dest}" />
|
2006-02-17 19:17:44 -05:00
|
|
|
<delete dir="${dist}" />
|
2006-01-29 10:16:56 -05:00
|
|
|
</target>
|
|
|
|
|
|
|
|
|
2006-01-29 10:50:23 -05:00
|
|
|
<!-- ========================================================================= -->
|
2006-01-29 10:16:56 -05:00
|
|
|
<!-- ===================== COMPILATION-RELATED TASKS ========================= -->
|
2006-01-29 10:50:23 -05:00
|
|
|
<!-- ========================================================================= -->
|
2006-01-29 10:16:56 -05:00
|
|
|
|
|
|
|
|
|
|
|
<!-- The compilation classpath -->
|
|
|
|
<path id="compile.classpath">
|
|
|
|
<fileset dir="${lib}">
|
2006-02-06 11:24:21 -05:00
|
|
|
<include name="*.jar" />
|
2006-01-29 10:16:56 -05:00
|
|
|
</fileset>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Compile the project. -->
|
|
|
|
<target name="compile"
|
|
|
|
description="Compile the source code.">
|
|
|
|
<mkdir dir="${dest}" />
|
2006-01-29 10:50:23 -05:00
|
|
|
|
2006-01-29 10:16:56 -05:00
|
|
|
<javac destdir="${dest}"
|
2006-02-24 20:21:36 -05:00
|
|
|
target="1.5"
|
2006-04-11 00:36:46 -04:00
|
|
|
source="1.5"
|
2006-05-27 17:55:39 -04:00
|
|
|
debug="on"
|
|
|
|
encoding="utf8"
|
2006-01-29 10:16:56 -05:00
|
|
|
classpathref="compile.classpath">
|
2006-01-29 10:50:23 -05:00
|
|
|
<src path="${src}/java" />
|
2006-04-11 00:36:46 -04:00
|
|
|
<src path="${src}/webapp/src" />
|
2006-01-29 10:50:23 -05:00
|
|
|
|
2006-01-29 10:16:56 -05:00
|
|
|
</javac>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
|
2006-09-13 10:33:28 -04:00
|
|
|
<target name="javadoc" depends="compile"
|
|
|
|
description="Generates javadoc documentation.">
|
2006-06-06 03:53:40 -04:00
|
|
|
|
2006-02-17 19:17:44 -05:00
|
|
|
<mkdir dir="${build.javadoc}"/>
|
2006-06-06 03:53:40 -04:00
|
|
|
|
|
|
|
<!-- we do this to make sure whatever classes where in ant's
|
|
|
|
classpath at runtime are in the classpath used by javadoc
|
|
|
|
(ie: junit.jar)
|
|
|
|
-->
|
|
|
|
<path id="javadoc.classpath">
|
|
|
|
<path refid="compile.classpath"/>
|
|
|
|
<!-- aparently ant.library.dir isn't allways set right? -->
|
|
|
|
<fileset dir="${ant.home}/lib">
|
|
|
|
<include name="**/*.jar"/>
|
|
|
|
</fileset>
|
|
|
|
<fileset dir="${ant.library.dir}">
|
|
|
|
<include name="**/*.jar"/>
|
|
|
|
</fileset>
|
|
|
|
</path>
|
|
|
|
|
2006-02-17 19:17:44 -05:00
|
|
|
<javadoc
|
|
|
|
destdir="${build.javadoc}"
|
|
|
|
author="true"
|
|
|
|
version="true"
|
|
|
|
use="true"
|
2006-05-27 17:55:39 -04:00
|
|
|
encoding="utf8"
|
2006-05-27 20:41:33 -04:00
|
|
|
access="${javadoc.access}"
|
2006-02-17 19:17:44 -05:00
|
|
|
windowtitle="${Name} ${version} API"
|
|
|
|
doctitle="${Name} ${version} API"
|
|
|
|
bottom="Copyright &copy; ${year} The Apache Software Foundation"
|
|
|
|
>
|
|
|
|
<packageset dir="${src}/java"/>
|
|
|
|
<packageset dir="${src}/webapp/src"/>
|
|
|
|
<link href="${javadoc.link.java}"/>
|
2006-05-26 21:35:44 -04:00
|
|
|
<link href="${javadoc.link.junit}"/>
|
|
|
|
<link href="${javadoc.link.lucene}"/>
|
2006-06-06 03:53:40 -04:00
|
|
|
<classpath refid="javadoc.classpath"/>
|
2006-02-17 19:17:44 -05:00
|
|
|
</javadoc>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
|
2006-01-29 10:50:23 -05:00
|
|
|
<!-- ========================================================================= -->
|
2006-01-29 10:16:56 -05:00
|
|
|
<!-- ===================== TESTING-RELATED TASKS ============================= -->
|
2006-01-29 10:50:23 -05:00
|
|
|
<!-- ========================================================================= -->
|
2006-01-29 10:16:56 -05:00
|
|
|
|
|
|
|
|
|
|
|
<!-- Classpath for unit test compilation. -->
|
|
|
|
<!-- For now, it's the same as main classpath. Later it will have JUnit, Clover, etc. -->
|
|
|
|
<path id="test.compile.classpath">
|
|
|
|
<path refid="compile.classpath" />
|
2006-02-07 17:04:39 -05:00
|
|
|
<pathelement location="${dest}"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<path id="test.run.classpath">
|
|
|
|
<path refid="test.compile.classpath" />
|
|
|
|
<pathelement location="${dest}/tests"/>
|
2006-01-29 10:16:56 -05:00
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Compile unit tests. -->
|
|
|
|
<target name="compileTests"
|
|
|
|
description="Compile unit tests."
|
|
|
|
depends="compile">
|
|
|
|
<mkdir dir="${dest}/tests" />
|
2006-02-07 17:04:39 -05:00
|
|
|
<javac
|
|
|
|
destdir="${dest}/tests"
|
2006-02-24 20:21:36 -05:00
|
|
|
target="1.5"
|
|
|
|
source="1.5"
|
2006-03-22 20:00:38 -05:00
|
|
|
debug="on"
|
2006-05-27 17:55:39 -04:00
|
|
|
encoding="utf8"
|
2006-02-07 17:04:39 -05:00
|
|
|
classpathref="test.compile.classpath">
|
|
|
|
<src path="${src}/test" />
|
2006-02-07 17:09:17 -05:00
|
|
|
<src path="${src}/apps/SolrTest/src" />
|
2006-01-29 10:16:56 -05:00
|
|
|
</javac>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Run unit tests. -->
|
|
|
|
<target name="test"
|
|
|
|
description="Runs the unit tests."
|
2006-04-11 00:36:46 -04:00
|
|
|
depends="compileTests, junit" />
|
|
|
|
|
|
|
|
<target name="legacyTest"
|
|
|
|
depends="compileTests" >
|
|
|
|
<!-- DEPRECATED: no description so it doesn't show up in project help -->
|
2006-02-07 17:09:17 -05:00
|
|
|
<java classname="SolrTest" fork="true" dir="src/apps/SolrTest" failonerror="true">
|
2006-06-10 12:05:12 -04:00
|
|
|
<arg line="-test newtest.txt -qargs qt=test"/>
|
2006-02-07 17:04:39 -05:00
|
|
|
<classpath>
|
|
|
|
<path refid="test.run.classpath" />
|
|
|
|
</classpath>
|
|
|
|
</java>
|
|
|
|
|
2006-01-29 10:16:56 -05:00
|
|
|
</target>
|
2006-04-11 00:36:46 -04:00
|
|
|
|
|
|
|
<target name="junit" depends="compileTests">
|
|
|
|
<!-- no description so it doesn't show up in -projecthelp -->
|
|
|
|
<mkdir dir="${junit.output.dir}"/>
|
|
|
|
|
|
|
|
<!-- :TODO: either SolrCore needs a way to specify the
|
|
|
|
solrconfig.xml, or all test are going to need to use the same
|
|
|
|
conf file, either way we need a specific run directory for
|
|
|
|
the tests.
|
|
|
|
-->
|
2006-09-13 10:33:28 -04:00
|
|
|
<junit printsummary="withOutAndErr"
|
2006-04-11 00:36:46 -04:00
|
|
|
haltonfailure="no"
|
|
|
|
errorProperty="tests.failed"
|
|
|
|
failureProperty="tests.failed"
|
2006-04-19 02:00:20 -04:00
|
|
|
dir="src/test/test-files/"
|
2006-04-11 00:36:46 -04:00
|
|
|
>
|
|
|
|
<syspropertyset>
|
|
|
|
<propertyref prefix="solr" />
|
|
|
|
</syspropertyset>
|
|
|
|
<classpath refid="test.run.classpath"/>
|
|
|
|
<formatter type="xml"/>
|
|
|
|
<batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
|
|
|
|
<fileset dir="src/test" includes="${junit.includes}"/>
|
|
|
|
</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>
|
|
|
|
|
2006-09-13 10:33:28 -04:00
|
|
|
<target name="test-reports"
|
|
|
|
description="Generates HTML test reports.">
|
2006-04-11 00:36:46 -04:00
|
|
|
<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>
|
2006-01-29 10:16:56 -05:00
|
|
|
|
|
|
|
|
2006-01-29 10:50:23 -05:00
|
|
|
<!-- ========================================================================= -->
|
2006-01-29 10:16:56 -05:00
|
|
|
<!-- ===================== DISTRIBUTION-RELATED TASKS ======================== -->
|
2006-01-29 10:50:23 -05:00
|
|
|
<!-- ========================================================================= -->
|
2006-01-29 10:16:56 -05:00
|
|
|
|
|
|
|
|
|
|
|
<!-- Creates the Solr distribution files. -->
|
|
|
|
<target name="dist"
|
|
|
|
description="Creates the Solr distribution files."
|
2006-02-17 19:17:44 -05:00
|
|
|
depends="dist-src, dist-war, dist-jar" />
|
2006-01-29 10:16:56 -05:00
|
|
|
|
2006-02-07 17:04:39 -05:00
|
|
|
<!-- Creates the Solr WAR file. -->
|
2006-01-29 10:16:56 -05:00
|
|
|
<target name="dist-war"
|
|
|
|
description="Creates the demo WAR file."
|
|
|
|
depends="compile">
|
|
|
|
<mkdir dir="${dist}" />
|
|
|
|
<war destfile="${dist}/${ant.project.name}-${version}.war"
|
|
|
|
webxml="${src}/webapp/WEB-INF/web.xml">
|
2006-02-17 19:17:44 -05:00
|
|
|
<classes dir="${dest}" includes="org/apache/**" />
|
2006-01-29 10:16:56 -05:00
|
|
|
<lib dir="${lib}">
|
2006-02-17 19:17:44 -05:00
|
|
|
<exclude name="servlet-api*.jar" />
|
2006-01-29 10:16:56 -05:00
|
|
|
</lib>
|
2006-01-29 10:50:23 -05:00
|
|
|
|
|
|
|
<fileset dir="${src}/webapp/resources" />
|
2006-01-29 10:16:56 -05:00
|
|
|
</war>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Creates the source distribution. -->
|
|
|
|
<target name="dist-src"
|
2006-02-17 19:17:44 -05:00
|
|
|
description="Creates the source distribution." >
|
2006-01-29 10:16:56 -05:00
|
|
|
<mkdir dir="${dist}" />
|
|
|
|
<zip destfile="${dist}/${ant.project.name}-${version}-src.zip"
|
|
|
|
basedir="${src}" />
|
|
|
|
</target>
|
|
|
|
|
2006-02-17 19:17:44 -05:00
|
|
|
<!-- Creates the solr jar. -->
|
|
|
|
<target name="dist-jar"
|
2006-01-29 10:16:56 -05:00
|
|
|
description="Creates the binary distribution."
|
2006-02-17 19:17:44 -05:00
|
|
|
depends="compile">
|
2006-01-29 10:16:56 -05:00
|
|
|
<mkdir dir="${dist}" />
|
|
|
|
<jar destfile="${dist}/${ant.project.name}-${version}.jar"
|
2006-02-17 19:17:44 -05:00
|
|
|
basedir="${dest}"
|
|
|
|
includes="org/apache/**" />
|
2006-01-29 10:16:56 -05:00
|
|
|
</target>
|
|
|
|
|
2006-02-15 20:05:55 -05:00
|
|
|
|
|
|
|
<target name="example"
|
|
|
|
depends="dist-war">
|
2006-05-04 08:53:31 -04:00
|
|
|
<copy file="${dist}/${ant.project.name}-${version}.war"
|
|
|
|
tofile="${example}/webapps/${ant.project.name}.war"/>
|
|
|
|
<copy todir="${example}/solr/bin">
|
|
|
|
<fileset dir="${src}/scripts">
|
|
|
|
<exclude name="scripts.conf"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
2006-05-09 12:27:51 -04:00
|
|
|
<chmod dir="${example}/solr/bin" perm="755" includes="**"/>
|
2006-02-15 20:05:55 -05:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="dist-example"
|
|
|
|
depends="example">
|
|
|
|
<zip destfile="${dist}/${ant.project.name}-${version}-example.zip">
|
|
|
|
<zipfileset dir="${example}"
|
|
|
|
prefix="${ant.project.name}-${example}"
|
|
|
|
excludes="data/ logs/*"
|
|
|
|
/>
|
|
|
|
</zip>
|
|
|
|
</target>
|
|
|
|
|
2006-02-17 19:17:44 -05:00
|
|
|
|
|
|
|
<!-- make a distribution -->
|
|
|
|
<target name="package"
|
2006-02-26 18:13:52 -05:00
|
|
|
depends="dist, example, javadoc">
|
2006-02-17 19:17:44 -05:00
|
|
|
<zip destfile="${dist}/${ant.project.name}-${version}.zip">
|
|
|
|
<zipfileset dir="."
|
|
|
|
prefix="${ant.project.name}-${version}"
|
|
|
|
includes="*.txt *.xml lib/** src/** example/**"
|
|
|
|
excludes="**/data/ **/logs/ **/classes/" />
|
|
|
|
<zipfileset dir="."
|
|
|
|
prefix="${ant.project.name}-${version}"
|
|
|
|
includes="dist/*.jar dist/*.war" />
|
|
|
|
<zipfileset dir="${dest}/docs/api/"
|
|
|
|
prefix="${ant.project.name}-${version}/docs/api/" />
|
|
|
|
</zip>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="nightly"
|
|
|
|
depends="test, package">
|
|
|
|
</target>
|
|
|
|
|
2006-02-06 11:24:21 -05:00
|
|
|
</project>
|
2006-02-15 20:05:55 -05:00
|
|
|
|