lucene/build.xml

161 lines
5.0 KiB
XML

<!-- 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 compile' 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="*.jar" />
</fileset>
</path>
<!-- Compile the project. -->
<target name="compile"
description="Compile the source code.">
<mkdir dir="${dest}" />
<javac destdir="${dest}"
classpathref="compile.classpath">
<src path="${src}/java" />
<src path="${src}/webapp" />
</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" />
<pathelement location="${dest}"/>
</path>
<path id="test.run.classpath">
<path refid="test.compile.classpath" />
<pathelement location="${dest}/tests"/>
</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 path="${src}/test" />
<src path="${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." />
<java classname="SolrTest" fork="true" dir="src/apps/SolarTest" failonerror="true">
<arg line="-test newtest.txt"/>
<classpath>
<path refid="test.run.classpath" />
</classpath>
</java>
</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 Solr 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-*.jar" />
</lib>
<fileset dir="${src}/webapp/resources" />
</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="${dest}" />
</target>
</project>