lucene/build.xml

146 lines
4.8 KiB
XML
Raw Normal View History

<!-- Solr build file -->
<project name="solr" default="usage" basedir=".">
<!-- Initialize property values: allow easy customization via build.properties -->
<property file="build.properties" />
<!-- 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" />
<!-- Default target: usage. Prints out instructions. -->
<target name="usage"
description="Prints out instructions">
<echo message="Welcome to the Solr project!" />
<echo message="Use 'ant build' to compile the source code." />
<echo message="Use 'ant dist' to build the project distribution files." />
<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}" />
</target>
<!-- ------------------------------------------------------------------------- -->
<!-- ===================== COMPILATION-RELATED TASKS ========================= -->
<!-- ------------------------------------------------------------------------- -->
<!-- The compilation classpath -->
<path id="compile.classpath">
<fileset dir="${lib}">
<include name="lucene-core-nightly.jar" />
<include name="lucene-snowball-nightly.jar" />
<include name="servlet-api-2.4.jar" />
<include name="xpp3-1.1.3.4.0.jar" />
</fileset>
</path>
<!-- Compile the project. -->
<target name="compile"
description="Compile the source code.">
<mkdir dir="${dest}" />
<javac destdir="${dest}"
classpathref="compile.classpath">
<src dir="${srcdir}/java" />
<src dir="${srcdir}/webapp" />
<!-- Should we include this here? A better name for this directory is needed anyways. -->
<src dir="${srcdir}/lucene_extras" />
</javac>
</target>
<!-- ------------------------------------------------------------------------- -->
<!-- ===================== TESTING-RELATED TASKS ============================= -->
<!-- ------------------------------------------------------------------------- -->
<!-- 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" />
</path>
<!-- Compile unit tests. -->
<target name="compileTests"
description="Compile unit tests."
depends="compile">
<mkdir dir="${dest}/tests" />
<javac destdir="${dest}/tests"
classpathref="test.compile.classpath">
<src dir="${src}/test" />
<src dir="${src}/apps/SolarTest/src" />
</javac>
</target>
<!-- Run unit tests. -->
<target name="test"
description="Runs the unit tests."
depends="compileTests">
<echo message="TO-DO later or after we convert tests to JUnit." />
</target>
<!-- ------------------------------------------------------------------------- -->
<!-- ===================== DISTRIBUTION-RELATED TASKS ======================== -->
<!-- ------------------------------------------------------------------------- -->
<!-- Creates the Solr distribution files. -->
<target name="dist"
description="Creates the Solr distribution files."
depends="dist-src, dist-war, dist-bin" />
<!-- Creates the demo WAR file. -->
<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">
<classes dir="${dest}" />
<lib dir="${lib}">
<exclude name="servlet-api-2.4.jar" />
</lib>
</war>
</target>
<!-- Creates the source distribution. -->
<target name="dist-src"
description="Creates the source distribution."
depends="clean">
<mkdir dir="${dist}" />
<zip destfile="${dist}/${ant.project.name}-${version}-src.zip"
basedir="${src}" />
</target>
<!-- Creates the binary distribution. -->
<target name="dist-bin"
description="Creates the binary distribution."
depends="clean, compile, dist-war">
<mkdir dir="${dist}" />
<jar destfile="${dist}/${ant.project.name}-${version}.jar"
basedir="${dest}" />
<zip destfile="${dist}/${ant.project.name}-${version}.zip"
basedir="${dist}" />
</target>
</project>