lucene/solr/common-build.xml

176 lines
8.0 KiB
XML
Raw Normal View History

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="common-solr" default="default">
<description>
This file is designed for importing into a main build file, and not intended
for standalone use.
</description>
<dirname file="${ant.file.common-solr}" property="common-solr.dir"/>
<property name="Name" value="Solr" />
<property name="version" value="4.0-SNAPSHOT"/>
<property name="final.name" value="apache-${name}-${version}"/>
<!-- solr uses 1.6 -->
<property name="javac.source" value="1.6"/>
<property name="javac.target" value="1.6"/>
<!-- solr uses its own build/dist directories -->
<property name="build.dir" location="${common-solr.dir}/build"/>
<property name="dist.dir" location="${common-solr.dir}/dist"/>
<property name="tests.userdir" value="${common-solr.dir}/src/test-files"/>
<property name="javadoc.dir" location="${common-solr.dir}/build/docs/api"/>
<property name="javadoc.link" value="http://java.sun.com/javase/6/docs/api/"/>
<path id="additional.dependencies">
<fileset dir="${common-solr.dir}/lib" includes="**/*.jar"/>
<fileset dir="${common-solr.dir}/example/lib" includes="**/*.jar"/>
<fileset dir="lib" includes="**/*.jar" erroronmissingdir="false"/>
</path>
<pathconvert property="project.classpath" targetos="unix" refid="additional.dependencies"/>
<property name="tests.loggingfile" value="${common-solr.dir}/testlogging.properties"/>
<property name="tests.threadspercpu" value="2"/>
<import file="../lucene/contrib/contrib-build.xml"/>
<property name="tests.directory" value="random" />
<!-- solr depends on the following modules/contribs -->
<module-uptodate name="analysis/common" jarfile="${common.dir}/../modules/analysis/build/common/lucene-analyzers-common-${version}.jar"
property="analyzers-common.uptodate" classpath.property="analyzers-common.jar"/>
<module-uptodate name="analysis/phonetic" jarfile="${common.dir}/../modules/analysis/build/phonetic/lucene-analyzers-phonetic-${version}.jar"
property="analyzers-phonetic.uptodate" classpath.property="analyzers-phonetic.jar"/>
<module-uptodate name="suggest" jarfile="${common.dir}/../modules/suggest/build/lucene-suggest-${version}.jar"
property="suggest.uptodate" classpath.property="suggest.jar"/>
<module-uptodate name="grouping" jarfile="${common.dir}/../modules/grouping/build/lucene-grouping-${version}.jar"
property="grouping.uptodate" classpath.property="grouping.jar"/>
<contrib-uptodate name="highlighter" property="highlighter.uptodate" classpath.property="highlighter.jar"/>
<contrib-uptodate name="memory" property="memory.uptodate" classpath.property="memory.jar"/>
<contrib-uptodate name="misc" property="misc.uptodate" classpath.property="misc.jar"/>
<contrib-uptodate name="queries" property="queries.uptodate" classpath.property="queries.jar"/>
<contrib-uptodate name="spatial" property="spatial.uptodate" classpath.property="spatial.jar"/>
<path id="solr.base.classpath">
<pathelement path="${analyzers-common.jar}"/>
<pathelement path="${analyzers-phonetic.jar}"/>
<pathelement path="${highlighter.jar}"/>
<pathelement path="${memory.jar}"/>
<pathelement path="${misc.jar}"/>
<pathelement path="${queries.jar}"/>
<pathelement path="${spatial.jar}"/>
<pathelement path="${suggest.jar}"/>
<pathelement path="${grouping.jar}"/>
<pathelement location="${common-solr.dir}/build/classes/solrj"/>
<pathelement location="${common-solr.dir}/build/classes/webapp"/>
<pathelement location="${common-solr.dir}/build/classes/java"/>
<path refid="base.classpath"/>
</path>
<path id="classpath" refid="solr.base.classpath"/>
<path id="solr.test.base.classpath">
<pathelement path="${common-solr.dir}/build/classes/test-framework"/>
<pathelement path="${common-solr.dir}/build/classes/test"/>
<pathelement path="${tests.userdir}"/>
<path refid="test.base.classpath"/>
</path>
<path id="test.classpath" refid="solr.test.base.classpath"/>
<!-- TODO: lucene and solr should share this macro -->
<macrodef name="contrib-crawl">
<attribute name="target" default=""/>
<attribute name="failonerror" default="true"/>
<sequential>
<subant target="@{target}" failonerror="@{failonerror}">
<property name="core.compiled" value="true"/>
<property name="solr.core.compiled" value="true"/>
<fileset dir="." includes="contrib/*/build.xml"/>
</subant>
</sequential>
</macrodef>
<macrodef name="solr-contrib-uptodate">
<attribute name="name"/>
<attribute name="property" default="@{name}.uptodate"/>
<attribute name="classpath.property" default="@{name}.jar"/>
<!-- set jarfile only, if the target jar file has no generic name -->
<attribute name="jarfile" default="${common-solr.dir}/build/contrib/@{name}/@{name}-${version}.jar"/>
<sequential>
<!--<echo message="Checking '@{jarfile}' against source folder '${common.dir}/contrib/@{name}/src/java'"/>-->
<property name="@{classpath.property}" location="@{jarfile}"/>
<uptodate property="@{property}" targetfile="@{jarfile}">
<srcfiles dir="${common-solr.dir}/contrib/@{name}/src/java" includes="**/*.java"/>
</uptodate>
</sequential>
</macrodef>
<target name="validate" depends="validate-solr"/>
<target name="validate-solr" depends="check-legal-solr" unless="validated-solr"/>
<target name="check-legal-solr" depends="compile-tools">
<java classname="org.apache.lucene.validation.DependencyChecker" failonerror="true" fork="true">
<classpath>
<path refid="tools.runtime.classpath" />
</classpath>
<!-- TODO: it might be better to just automatically find all directories that contain jar files, but that could take a
long time. This should be faster, but we could miss a directory
-->
<!-- Solr -->
<arg value="-c" />
<arg value="${basedir}/lib" />
<arg value="-c" />
<arg value="${basedir}/contrib/analysis-extras/lib" />
<arg value="-c" />
<arg value="${basedir}/contrib/clustering/lib" />
<arg value="-c" />
<arg value="${basedir}/contrib/dataimporthandler/lib" />
<arg value="-c" />
<arg value="${basedir}/contrib/dataimporthandler-extras/lib" />
<arg value="-c" />
<arg value="${basedir}/contrib/extraction/lib" />
<arg value="-c" />
<arg value="${basedir}/contrib/uima/lib" />
<arg value="-c" />
<arg value="${basedir}/example/example-DIH/solr/db/lib" />
<arg value="-c" />
<arg value="${basedir}/example/example-DIH/solr/mail/lib" />
<arg value="-c" />
<arg value="${basedir}/example/example/lib" />
<arg value="-c" />
<arg value="${basedir}/src/test-files/solr/lib" />
</java>
</target>
<path id="tools.runtime.classpath">
<pathelement location="${common-solr.dir}/../lucene/build/classes/tools"/>
</path>
<target name="compile-tools" description="Compile the Test Framework and Validation tools">
<sequential>
<subant target="compile-tools" inheritall="false" failonerror="true">
<fileset dir="${common-solr.dir}/../lucene" includes="build.xml" />
</subant>
</sequential>
</target>
<target name="test" depends="compile-test,validate-solr,junit-mkdir,junit-sequential,junit-parallel" description="Runs unit tests"/>
</project>