<!--
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
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>
<property name="Name" value="Solr" />
<property name="version" value="3.6-SNAPSHOT"/>
<contains casesensitive="true" string="${version}" substring="-SNAPSHOT"/>
</condition>
<property name="fullnamever" value="${fullname}-${version}"/>
<property name="lucene-libs" location="${dest}/lucene-libs" />
<condition property="clover.enabled">
<and>
<isset property="run.clover"/>
<isset property="clover.present"/>
</and>
</condition>
<import file="${common-solr.dir}/lucene/contrib/contrib-build.xml"/>
<path id="additional.dependencies">
</path>
<!-- Solr Specification Version
This will be used in the Manifest file, and therefore must
match the pattern "digit+{.digit+}*"
By default, this should be set to "X.Y.M.${dateversion}"
where X.Y.M is the last version released (on this branch).
-->
<path id="solr.base.classpath">
<pathelement path="${analyzers-common.jar}"/>
<pathelement path="${analyzers-kuromoji.jar}"/>
<pathelement path="${analyzers-phonetic.jar}"/>
<pathelement path="${highlighter.jar}"/>
<pathelement path="${memory.jar}"/>
<pathelement path="${misc.jar}"/>
<pathelement path="${spatial.jar}"/>
<pathelement path="${spellchecker.jar}"/>
<pathelement path="${grouping.jar}"/>
<pathelement path="${queries.jar}"/>
<pathelement location="${common-solr.dir}/build/solr-solrj/classes/java"/>
<pathelement location="${common-solr.dir}/build/solr-core/classes/java"/>
<path refid="additional.dependencies"/>
<path refid="base.classpath"/>
</path>
<path id="solr.test.base.classpath">
<pathelement path="${common-solr.dir}/build/solr-test-framework/classes/java"/>
<pathelement path="${build.dir}/test-files"/>
<path refid="test.base.classpath"/>
</path>
<macrodef name="solr-contrib-uptodate">
<attribute name="name"/>
<attribute name="property" default="@{name}.uptodate"/>
<!-- set jarfile only, if the target jar file has no generic name -->
<attribute name="jarfile" default="${common-solr.dir}/build/contrib/solr-@{name}/apache-solr-@{name}-${version}.jar"/>
<sequential>
<!--<echo message="Checking '@{jarfile}' against source folder '${common.dir}/contrib/@{name}/src/java'"/>-->
<uptodate property="@{property}" targetfile="@{jarfile}">
</uptodate>
</sequential>
</macrodef>
<target name="validate" depends="compile-tools">
</target>
<target name="init-dist" >
<mkdir dir="${build.dir}"/>
<mkdir dir="${package.dir}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${maven.dist.dir}"/>
</target>
<target name="prep-lucene-jars"
depends="jar-lucene-core, jar-analyzers-common, jar-analyzers-kuromoji, jar-analyzers-phonetic, jar-spellchecker, jar-highlighter,
jar-memory, jar-misc, jar-spatial, jar-grouping, jar-queries">
<!-- TODO: why was this prop previously not set? <property name="solr.deps.compiled" value="true"/> -->
</target>
<target name="lucene-jars-to-solr" depends="prep-lucene-jars">
<sequential>
<copy todir="${lucene-libs}" preservelastmodified="true" flatten="true" failonerror="true" overwrite="true">
<fileset file="${lucene-core.jar}" />
<fileset file="${analyzers-common.jar}" />
<fileset file="${analyzers-kuromoji.jar}" />
<fileset file="${analyzers-phonetic.jar}" />
<fileset file="${spellchecker.jar}" />
<fileset file="${grouping.jar}" />
<fileset file="${queries.jar}" />
<fileset file="${highlighter.jar}" />
<fileset file="${memory.jar}" />
<fileset file="${misc.jar}" />
<fileset file="${spatial.jar}" />
</copy>
</sequential>
</target>
<!-- Shared core/solrj/test-framework/contrib targets -->
<macrodef name="solr-jarify" description="Builds a Solr JAR file">
<element name="nested" optional="true" implicit="true"/>
<sequential>
<jarify basedir="@{basedir}" destfile="@{destfile}"
title="@{title}" excludes="@{excludes}"
spec.version="@{spec.version}"
manifest.file="@{manifest.file}">
<nested/>
</jarify>
</sequential>
</macrodef>
<target name="jar-core" depends="compile-core">
<solr-jarify/>
</target>
<target name="compile-test" depends="sync-resources,compile-solr-test-framework,common.compile-test"/>
<target name="dist" depends="jar-core">
</target>
<target name="javadocs" depends="compile-core,define-lucene-javadoc-url">
<sequential>
<mkdir dir="${javadoc.dir}"/>
<mkdir dir="${dest}/META-INF/"/>
title="${Name} ${version} ${name} API">
<sources>
packagelistloc="${common.dir}/build/docs/api/all/"/>
<link href=""/>
<packageset dir="${src.dir}"/>
</sources>
</invoke-javadoc>
</sequential>
</target>
<target name="define-lucene-javadoc-url"
depends="define-lucene-javadoc-url-SNAPSHOT,define-lucene-javadoc-url-release"/>
<property name="lucene.javadoc.url"
</target>
<loadproperties>
<propertyresource name="version"/>
<filterchain>
<replaceregex pattern="[.]" replace="_" flags="g"/>
<prefixlines prefix="underscore.version="/>
</filterchain>
</loadproperties>
<property name="lucene.javadoc.url"
value="http://lucene.apache.org/java/${underscore.version}/api/all/"/>
</target>
<target name="jar-src" depends="init">
</target>
<target name="m2-deploy-solr-parent-pom" depends="filter-pom-templates"
unless="deployed.solr.parent.pom.uptodate">
</target>
<target name="dist-maven"
depends="filter-pom-templates, install-maven-tasks, m2-deploy-solr-parent-pom, dist-maven-common"/>
<!-- Solr core targets -->
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<target name="compile-test-solr-core" description="Compile solr core tests">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<target name="dist-core" depends="init-dist"
description="Creates the Solr JAR Distribution file.">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<!-- Solrj targets -->
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<target name="compile-test-solrj" description="Compile java client tests">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<target name="dist-solrj" depends="init-dist"
description="Creates the Solr-J JAR Distribution file.">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<!-- TODO: really a copy should work: but sync is currently safer
since some buggy tests don't create their own tempdir but
modify this target directory directly... -->
<target name="sync-resources">
<sync todir="${build.dir}/test-files">
<fileset dir="${tests.userdir}"/>
</sync>
</target>
<!-- Solr test-framework targets -->
<target name="compile-solr-test-framework" description="Compile the Solr test-framework" unless="solr.test.framework.compiled">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<!-- resolve jetty dependencies in the example (relied upon by compile!) -->
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<!-- Solr contrib targets -->
<target name="compile-contrib" description="Compile contrib modules">
<contrib-crawl target="compile-core"/>
</target>
<target name="compile-test-contrib" description="Compile contrib modules' tests">
<contrib-crawl target="compile-test"/>
</target>
<target name="contribs-add-to-war">
<mkdir dir="${dest}/web"/>
<delete dir="${dest}/web" includes="**/*" failonerror="false"/>
<contrib-crawl target="add-to-war"/>
</target>
</project>