lucene/build.xml

230 lines
7.1 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" />
<property name="Name" value="Solr" />
<!-- 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" />
<!-- Example directory -->
<property name="example" value="example" />
<property name="build.docs" value="${dest}/docs"/>
<property name="javadoc.link.java"
value="http://java.sun.com/j2se/1.5.0/docs/api/"/>
<property name="javadoc.packages" value="org.apache.solr.*"/>
<property name="build.javadoc" value="${build.docs}/api"/>
<!-- 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 example' to install solr.war in ./example" />
<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}" />
<delete dir="${dist}" />
</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}"
target="1.5"
source="1.5"
classpathref="compile.classpath">
<src path="${src}/java" />
<src path="${src}/webapp" />
</javac>
</target>
<target name="javadoc" depends="compile">
<mkdir dir="${build.javadoc}"/>
<javadoc
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &amp;copy; ${year} The Apache Software Foundation"
>
<packageset dir="${src}/java"/>
<packageset dir="${src}/webapp/src"/>
<link href="${javadoc.link.java}"/>
<classpath refid="compile.classpath"/>
</javadoc>
</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"
target="1.5"
source="1.5"
classpathref="test.compile.classpath">
<src path="${src}/test" />
<src path="${src}/apps/SolrTest/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/SolrTest" 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-jar" />
<!-- 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}" includes="org/apache/**" />
<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." >
<mkdir dir="${dist}" />
<zip destfile="${dist}/${ant.project.name}-${version}-src.zip"
basedir="${src}" />
</target>
<!-- Creates the solr jar. -->
<target name="dist-jar"
description="Creates the binary distribution."
depends="compile">
<mkdir dir="${dist}" />
<jar destfile="${dist}/${ant.project.name}-${version}.jar"
basedir="${dest}"
includes="org/apache/**" />
</target>
<target name="example"
depends="dist-war">
<copy file="${dist}/${ant.project.name}-${version}.war" tofile="${example}/webapps/${ant.project.name}.war"/>
</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>
<!-- make a distribution -->
<target name="package"
depends="dist, example, javadoc">
<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>
</project>