lucene/lucene/common-build.xml

1297 lines
54 KiB
XML

<?xml version="1.0"?>
<!--
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" xmlns:artifact="antlib:org.apache.maven.artifact.ant"
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
This file is designed for importing into a main build file, and not intended
for standalone use.
</description>
<dirname file="${ant.file.common}" property="common.dir"/>
<property name="dev-tools.dir" value="${common.dir}/../dev-tools"/>
<property name="prettify.dir" value="${common.dir}/tools/prettify"/>
<property name="maven.build.dir" value="${build.dir}/maven"/>
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it -->
<property file="${user.home}/lucene.build.properties"/>
<property file="${user.home}/build.properties"/>
<property file="${basedir}/build.properties"/>
<property file="${common.dir}/build.properties"/>
<tstamp>
<format property="current.year" pattern="yyyy"/>
<format property="DSTAMP" pattern="yyyy-MM-dd"/>
<format property="TSTAMP" pattern="HH:mm:ss"/>
<!-- datetime format that is safe to treat as part of a dotted version -->
<format property="dateversion" pattern="yyyy.MM.dd.HH.mm.ss" />
</tstamp>
<property name="name" value="${ant.project.name}"/>
<property name="Name" value="Lucene"/>
<property name="dev.version" value="4.0-SNAPSHOT"/>
<property name="tests.luceneMatchVersion" value="4.0"/>
<property name="version" value="${dev.version}"/>
<property name="spec.version" value="${version}"/>
<property name="year" value="2000-${current.year}"/>
<property name="final.name" value="lucene-${name}-${version}"/>
<property name="common.classpath.excludes" value="**/*.txt,**/*.template,**/*.sha1" />
<property name="ivy.bootstrap.version" value="2.2.0" />
<property name="ivy.resource" value="org/apache/ivy/ant/antlib.xml" />
<available resource="${ivy.resource}" property="ivy.available" />
<property name="junit.jar" value="junit-4.10.jar"/>
<property name="junit-location.jar" value="${common.dir}/test-framework/lib/${junit.jar}"/>
<path id="junit-path">
<pathelement location="${junit-location.jar}"/>
</path>
<path id="ant-path">
<fileset dir="${common.dir}/test-framework/lib" includes="ant-*.jar"/>
</path>
<!-- default arguments to pass to JVM executing tests -->
<property name="testmethod" value=""/>
<property name="args" value=""/>
<property name="tests.threadspercpu" value="1" />
<condition property="tests.sequential">
<or>
<isset property="testcase"/>
<equals arg1="${tests.threadspercpu}" arg2="0"/>
</or>
</condition>
<property name="tests.multiplier" value="1" />
<property name="tests.codec" value="random" />
<property name="tests.postingsformat" value="random" />
<property name="tests.locale" value="random" />
<property name="tests.timezone" value="random" />
<property name="tests.directory" value="random" />
<property name="tests.linedocsfile" value="europarl.lines.txt.gz" />
<property name="tests.iter" value="1" />
<property name="tests.iter.min" value="${tests.iter}" />
<property name="tests.seed" value="random" />
<property name="tests.loggingfile" value="/dev/null"/>
<property name="tests.nightly" value="false" />
<property name="tests.weekly" value="false" />
<property name="tests.slow" value="false" />
<property name="tests.cleanthreads.sysprop" value="perMethod"/>
<property name="tests.asserts.gracious" value="false"/>
<property name="tests.verbose" value="false"/>
<property name="tests.infostream" value="${tests.verbose}"/>
<property name="tests.heapsize" value="512M"/>
<property name="javac.deprecation" value="off"/>
<property name="javac.debug" value="on"/>
<property name="javac.source" value="1.6"/>
<property name="javac.target" value="1.6"/>
<property name="javac.source.backwards" value="1.6"/>
<property name="javac.target.backwards" value="1.6"/>
<!-- clover wants to run with -lib, otherwise we prefer a repeatable
classpath -->
<property name="javac.includeAntRuntime" value="${run.clover}"/>
<property name="javac.args" value="-Xlint -Xlint:-deprecation -Xlint:-serial"/>
<property name="bootclasspath" value=""/>
<property name="javadoc.link" value="http://download.oracle.com/javase/6/docs/api/"/>
<property name="javadoc.link.junit" value="http://junit.sourceforge.net/javadoc/"/>
<property name="javadoc.packagelist.dir" value="${common.dir}/tools/javadoc"/>
<available file="${javadoc.packagelist.dir}/java6/package-list" property="javadoc.java6.packagelist.exists"/>
<property name="javadoc.access" value="protected"/>
<property name="javadoc.charset" value="utf-8"/>
<property name="javadoc.dir" value="${common.dir}/build/docs/api"/>
<property name="javadoc.maxmemory" value="512m" />
<!-- Javadoc classpath -->
<path id="javadoc.classpath">
<path refid="classpath"/>
<pathelement location="${ant.home}/lib/ant.jar"/>
<fileset dir=".">
<exclude name="build/**/*.jar"/>
<include name="**/lib/*.jar"/>
</fileset>
</path>
<property name="changes.src.dir" value="${common.dir}/site/changes"/>
<property name="changes.target.dir" value="${common.dir}/build/docs/changes"/>
<property name="project.name" value="site"/> <!-- todo: is this used by anakia or something else? -->
<property name="build.encoding" value="utf-8"/>
<property name="src.dir" location="src/java"/>
<property name="tests.src.dir" location="src/test"/>
<property name="tests-framework.src.dir" location="${common.dir}/test-framework/src/java"/>
<property name="build.dir" location="build"/>
<!-- Needed in case a contrib needs the original build, also for compile-tools to be called from contrib -->
<property name="common.build.dir" location="${common.dir}/build"/>
<property name="tests.lockdir" location="${common.build.dir}"/>
<property name="dist.dir" location="${common.dir}/dist"/>
<property name="maven.dist.dir" location="${dist.dir}/maven"/>
<property name="m2.repository.url" value="file://${maven.dist.dir}"/>
<property name="m2.repository.private.key" value="${user.home}/.ssh/id_dsa"/>
<property name="javacc.home" location="${common.dir}"/>
<property name="jflex.home" location="${common.dir}"/>
<path id="jflex.classpath">
<fileset dir="${jflex.home}/">
<!-- for a JFlex trunk checkout: -->
<include name="jflex/target/*.jar"/>
<!-- for a JFlex distribution (not yet available): -->
<include name="lib/*.jar"/>
</fileset>
</path>
<path id="javacc.classpath">
<fileset dir="${javacc.home}/">
<include name="bin/lib/*.jar"/>
</fileset>
</path>
<property name="backwards.dir" location="backwards"/>
<property name="build.dir.backwards" location="${build.dir}/backwards"/>
<property name="junit.output.dir" location="${build.dir}/test"/>
<property name="junit.output.dir.backwards" location="${build.dir.backwards}/test"/>
<property name="junit.reports" location="${build.dir}/test/reports"/>
<property name="junit.reports.backwards" location="${build.dir.backwards}/test/reports"/>
<property name="junit.excludes" value="**/Abstract*"/>
<condition property="junit.details.formatter"
value="org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"
else="org.apache.lucene.util.LuceneJUnitResultFormatter">
<isset property="tests.sequential"/>
</condition>
<property name="junit.parallel.selector" value="org.apache.lucene.util.LuceneJUnitDividingSelector"/>
<property name="manifest.file" location="${build.dir}/MANIFEST.MF"/>
<!--
we attempt to exec svnversion to get details build information
for jar manifests. this property can be set at runtime to an
explicit path as needed, or ant will just try to find it in the
default PATH. (this is useful for Hudson)
-->
<property name="svnversion.exe" value="svnversion" />
<property name="svn.exe" value="svn" />
<property name="hg.exe" value="hg" />
<property name="moman.url" value="https://bitbucket.org/jpbarrette/moman" />
<property name="moman.rev" value="120" />
<property name="python.exe" value="python" />
<property name="gpg.exe" value="gpg" />
<property name="gpg.key" value="CODE SIGNING KEY" />
<property name="filtered.pom.templates.dir" location="${common.dir}/build/poms"/>
<property name="clover.db.dir" location="${common.dir}/build/test/clover/db"/>
<property name="clover.report.dir" location="${common.dir}/build/test/clover/reports"/>
<!-- a reasonable default exclusion set, can be overridden for special cases -->
<property name="rat.excludes" value="**/TODO,**/*.txt"/>
<available
property="clover.present"
classname="com.cenqua.clover.tasks.CloverReportTask"
/>
<condition property="clover.enabled">
<and>
<isset property="run.clover"/>
<isset property="clover.present"/>
</and>
</condition>
<propertyset id="uptodate.and.compiled.properties" dynamic="true">
<propertyref regex=".*\.uptodate$$"/>
<propertyref regex=".*\.compiled$$"/>
</propertyset>
<patternset id="lucene.local.src.package.patterns"
includes="src/,index.html,*build*.xml,docs/,*.txt,contrib/,lib/,backwards/"
excludes="**/pom.xml,**/*.iml,site/build/"
/>
<!-- Default exclude sources and javadoc jars from Ivy fetch to save time and bandwidth -->
<condition property="ivy.exclude.types"
value=""
else="source|javadoc">
<isset property="fetch.sources.javadocs"/>
</condition>
<!-- Import custom ANT tasks. -->
<import file="${common.dir}/tools/custom-tasks.xml" />
<target name="clean"
description="Removes contents of build and dist directories">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete file="velocity.log"/>
</target>
<!-- TODO: maybe make JavaCC checking specific to only the projects
that use it (Lucene core and contrib/misc
-->
<target name="javacc-uptodate-check">
<uptodate property="javacc.files.uptodate">
<srcfiles dir="${src.dir}" includes="**/*.jj" />
<mapper type="glob" from="*.jj" to="*.java"/>
</uptodate>
</target>
<target name="javacc-notice" depends="javacc-uptodate-check" unless="javacc.files.uptodate">
<echo>
One or more of the JavaCC .jj files is newer than its corresponding
.java file. Run the "javacc" target to regenerate the artifacts.
</echo>
</target>
<target name="init" depends="resolve">
<!-- currently empty -->
</target>
<target name="resolve" depends="ivy-availability-check,ivy-fail">
<!-- todo, make this a property or something.
only special cases need bundles -->
<ivy:retrieve type="jar,bundle" log="download-only"/>
</target>
<target name="ivy-availability-check" unless="ivy.available">
<echo>
This build requires Ivy and Ivy could not be found in your ant classpath.
(Due to classpath issues and the recursive nature of the Lucene/Solr
build system, a local copy of Ivy can not be used an loaded dynamically
by the build.xml)
You can either manually install a copy of Ivy ${ivy.bootstrap.version} in your ant classpath:
http://ant.apache.org/manual/install.html#optionalTasks
Or this build file can do it for you by running the Ivy Bootstrap target:
ant ivy-bootstrap
Either way you will only have to install Ivy one time.
'ant ivy-bootstrap' will install a copy of Ivy into your Ant User Library:
${user.home}/.ant/lib
If you would prefer, you can have it installed into an alternative
directory using the "-Divy_install_path=/some/path/you/choose" option,
but you will have to specify this path every time you build Lucene/Solr
in the future...
ant ivy-bootstrap -Divy_install_path=/some/path/you/choose
...
ant -lib /some/path/you/choose clean compile
...
ant -lib /some/path/you/choose clean compile
If you have already run ivy-bootstrap, and still get this message, please
try using the "--noconfig" option when running ant, or editing your global
ant config to allow the user lib to be loaded. See the wiki for more details:
http://wiki.apache.org/lucene-java/HowToContribute#antivy
</echo>
</target>
<target name="ivy-fail" unless="ivy.available">
<fail>Ivy is not available</fail>
</target>
<target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir">
<property name="ivy_install_path" location="${user.home}/.ant/lib" />
<mkdir dir="${ivy_install_path}"/>
<echo message="installing ivy ${ivy.bootstrap.version} to ${ivy_install_path}"/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.bootstrap.version}/ivy-${ivy.bootstrap.version}.jar"
dest="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar" usetimestamp="true"/>
</target>
<target name="jflex-uptodate-check">
<uptodate property="jflex.files.uptodate">
<srcfiles dir="${src.dir}" includes="**/*.jflex" />
<mapper type="glob" from="*.jflex" to="*.java"/>
</uptodate>
</target>
<target name="jflex-notice" depends="jflex-uptodate-check" unless="jflex.files.uptodate">
<echo>
One or more of the JFlex .jflex files is newer than its corresponding
.java file. Run the "jflex" target to regenerate the artifacts.
</echo>
</target>
<target name="javacc-check">
<available property="javacc.present" classname="org.javacc.parser.Main">
<classpath refid="javacc.classpath"/>
</available>
<fail unless="javacc.present">
##################################################################
JavaCC not found.
JavaCC Home: ${javacc.home}
Please download and install JavaCC 4.1 from:
&lt;http://javacc.dev.java.net&gt;
Then, create a build.properties file either in your home
directory, or within the Lucene directory and set the javacc.home
property to the path where JavaCC is installed. For example,
if you installed JavaCC in /usr/local/java/javacc-4.1, then set the
javacc.home property to:
javacc.home=/usr/local/java/javacc-4.1
If you get an error like the one below, then you have not installed
things correctly. Please check all your paths and try again.
java.lang.NoClassDefFoundError: org.javacc.parser.Main
##################################################################
</fail>
</target>
<target name="jflex-check">
<available property="jflex.present" classname="jflex.anttask.JFlexTask">
<classpath refid="jflex.classpath"/>
</available>
<fail unless="jflex.present">
##################################################################
JFlex not found.
JFlex Home: ${jflex.home}
Please install the jFlex 1.5 version (currently not released)
from its SVN repository:
svn co http://jflex.svn.sourceforge.net/svnroot/jflex/trunk jflex
cd jflex
mvn install
Then, create a build.properties file either in your home
directory, or within the Lucene directory and set the jflex.home
property to the path where the JFlex trunk checkout is located
(in the above example its the directory called "jflex").
##################################################################
</fail>
</target>
<target name="compile-core" depends="init, clover"
description="Compiles core classes">
<compile
srcdir="${src.dir}"
destdir="${build.dir}/classes/java">
<classpath refid="classpath"/>
</compile>
<!-- Copy the resources folder (if existent) -->
<copy todir="${build.dir}/classes/java">
<fileset dir="${src.dir}/../resources" erroronmissingdir="no"/>
</copy>
</target>
<target name="compile" depends="compile-core">
<!-- convenience target to compile core -->
</target>
<target name="jar-core" depends="compile-core"
description="Packages the JAR file">
<jarify/>
</target>
<macrodef name="m2-deploy" description="Builds a Maven artifact">
<element name="artifact-attachments" optional="yes"/>
<attribute name="pom.xml"/>
<attribute name="jar.file" default="${build.dir}/${final.name}.jar"/>
<sequential>
<artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
<artifact:pom id="maven.project" file="@{pom.xml}"/>
<artifact:deploy file="@{jar.file}">
<artifact-attachments/>
<remoteRepository id="${m2.repository.id}" url="${m2.repository.url}"/>
<pom refid="maven.project"/>
</artifact:deploy>
</sequential>
</macrodef>
<macrodef name="m2-deploy-with-pom-template" description="Builds a Maven artifact given a POM template">
<attribute name="pom.xml"/>
<attribute name="jar.file"/>
<sequential>
<copy file="@{pom.xml}" tofile="${maven.build.dir}/pom.xml" overwrite="true">
<filterset begintoken="@" endtoken="@">
<filter token="version" value="${version}"/>
</filterset>
</copy>
<artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
<artifact:pom id="maven.project" file="${maven.build.dir}/pom.xml" />
<artifact:deploy file="@{jar.file}">
<remoteRepository id="${m2.repository.id}" url="${m2.repository.url}"/>
<pom refid="maven.project"/>
</artifact:deploy>
</sequential>
</macrodef>
<macrodef name="build-manifest" description="Builds a manifest file">
<attribute name="title"/>
<attribute name="implementation.title"/>
<attribute name="spec.version"/>
<attribute name="manifest.file" default="${manifest.file}"/>
<sequential>
<manifest file="@{manifest.file}">
<!--
http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Manifest
http://java.sun.com/j2se/1.5.0/docs/guide/versioning/spec/versioning2.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Package.html
http://java.sun.com/j2se/1.5.0/docs/api/java/util/jar/package-summary.html
http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html
-->
<!-- Don't set 'Manifest-Version' it identifies the version of the
manifest file format, and should always be 1.0 (the default)
Don't set 'Created-by' attribute, its purpose is
to identify the version of java used to build the jar,
which ant will do by default.
Ant will happily override these with bogus strings if you
tell it to, so don't.
NOTE: we don't use section info because all of our manifest data
applies to the entire jar/war ... no package specific info.
-->
<attribute name="Extension-Name" value="@{implementation.title}"/>
<attribute name="Specification-Title" value="@{title}"/>
<!-- spec version must match "digit+{.digit+}*" -->
<attribute name="Specification-Version" value="@{spec.version}"/>
<attribute name="Specification-Vendor"
value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="@{implementation.title}"/>
<!-- impl version can be any string -->
<attribute name="Implementation-Version"
value="${version} ${svnversion} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>
<attribute name="Implementation-Vendor"
value="The Apache Software Foundation"/>
<attribute name="X-Compile-Source-JDK" value="${javac.source}"/>
<attribute name="X-Compile-Target-JDK" value="${javac.target}"/>
</manifest>
</sequential>
</macrodef>
<macrodef name="jarify" description="Builds a JAR file">
<attribute name="basedir" default="${build.dir}/classes/java"/>
<attribute name="destfile" default="${build.dir}/${final.name}.jar"/>
<attribute name="title" default="Lucene Search Engine: ${ant.project.name}"/>
<attribute name="excludes" default="**/pom.xml,**/*.iml"/>
<attribute name="metainf.source.dir" default="${common.dir}"/>
<attribute name="implementation.title" default="org.apache.lucene"/>
<attribute name="spec.version" default="${spec.version}"/>
<attribute name="manifest.file" default="${manifest.file}"/>
<element name="nested" optional="true" implicit="true"/>
<sequential>
<!-- If possible, include the svnversion -->
<exec dir="." executable="${svnversion.exe}"
outputproperty="svnversion" failifexecutionfails="false">
<arg line="."/>
</exec>
<build-manifest title="@{title}"
implementation.title="@{implementation.title}"
spec.version="@{spec.version}"
manifest.file="@{manifest.file}"/>
<jar destfile="@{destfile}"
basedir="@{basedir}"
manifest="@{manifest.file}"
excludes="@{excludes}">
<metainf dir="@{metainf.source.dir}" includes="LICENSE.txt,NOTICE.txt"/>
<nested />
</jar>
</sequential>
</macrodef>
<macrodef name="module-uptodate">
<attribute name="name"/>
<attribute name="property"/>
<attribute name="jarfile"/>
<attribute name="module-src-name" default="@{name}"/>
<sequential>
<uptodate property="@{property}" targetfile="@{jarfile}">
<srcfiles dir="${common.dir}/../modules/@{module-src-name}/src/java" includes="**/*.java"/>
</uptodate>
</sequential>
</macrodef>
<property name="lucene-core.jar" value="${common.dir}/build/core/lucene-core-${version}.jar"/>
<target name="check-lucene-core-uptodate" unless="lucene-core.uptodate">
<uptodate property="lucene-core.uptodate" targetfile="${lucene-core.jar}">
<srcfiles dir="${common.dir}/core/src/java" includes="**/*.java"/>
</uptodate>
</target>
<target name="jar-lucene-core" unless="lucene-core.uptodate" depends="check-lucene-core-uptodate">
<ant dir="${common.dir}/core" target="jar-core" inheritAll="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<property name="lucene-core.uptodate" value="true"/>
</target>
<property name="queryparser.jar" value="${common.dir}/../modules/queryparser/build/lucene-queryparser-${version}.jar"/>
<target name="check-queryparser-uptodate" unless="queryparser.uptodate">
<module-uptodate name="queryparser" jarfile="${queryparser.jar}" property="queryparser.uptodate"/>
</target>
<target name="jar-queryparser" unless="queryparser.uptodate" depends="check-queryparser-uptodate">
<ant dir="${common.dir}/../modules/queryparser" target="jar-core" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<property name="queryparser.uptodate" value="true"/>
</target>
<property name="analyzers-common.jar" value="${common.dir}/../modules/analysis/build/common/lucene-analyzers-common-${version}.jar"/>
<target name="check-analyzers-common-uptodate" unless="analyzers-common.uptodate">
<module-uptodate name="analysis/common" jarfile="${analyzers-common.jar}" property="analyzers-common.uptodate"/>
</target>
<target name="jar-analyzers-common" unless="analyzers-common.uptodate" depends="check-analyzers-common-uptodate">
<ant dir="${common.dir}/../modules/analysis/common" target="jar-core" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<property name="analyzers-common.uptodate" value="true"/>
</target>
<property name="queries.jar" value="${common.dir}/../modules/queries/build/lucene-queries-${version}.jar"/>
<target name="check-queries-uptodate" unless="queries.uptodate">
<module-uptodate name="queries" jarfile="${queries.jar}" property="queries.uptodate"/>
</target>
<target name="jar-queries" unless="queries.uptodate" depends="check-queries-uptodate">
<ant dir="${common.dir}/../modules/queries" target="jar-core" inheritAll="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<property name="queries.uptodate" value="true"/>
</target>
<target name="compile-lucene-core" unless="core.compiled">
<ant dir="${common.dir}/core" target="compile-core" inheritAll="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<property name="core.compiled" value="true"/>
</target>
<target name="compile-test-framework" unless="lucene.test.framework.compiled">
<ant dir="${common.dir}/test-framework" target="compile-core" inheritAll="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<property name="lucene.test.framework.compiled" value="true"/>
</target>
<target name="compile-tools">
<ant dir="${common.dir}/tools" target="compile-core" inheritAll="false"/>
</target>
<target name="compile-test" depends="compile-core,compile-test-framework">
<compile-test-macro srcdir="${tests.src.dir}" destdir="${build.dir}/classes/test"
test.classpath="test.classpath"/>
</target>
<macrodef name="compile-test-macro" description="Compiles junit tests.">
<attribute name="srcdir"/>
<attribute name="destdir"/>
<attribute name="test.classpath"/>
<attribute name="javac.source" default="${javac.source}"/>
<attribute name="javac.target" default="${javac.target}"/>
<sequential>
<compile
srcdir="@{srcdir}"
destdir="@{destdir}"
javac.source="@{javac.source}"
javac.target="@{javac.source}">
<classpath refid="@{test.classpath}"/>
</compile>
<!-- Copy any data files present to the classpath -->
<copy todir="@{destdir}">
<fileset dir="@{srcdir}" excludes="**/*.java"/>
</copy>
</sequential>
</macrodef>
<macrodef name="test-macro" description="Executes junit tests.">
<attribute name="junit.output.dir" default="${junit.output.dir}"/>
<attribute name="junit.classpath" default="junit.classpath"/>
<attribute name="dataDir" default="${tests.src.dir}"/>
<attribute name="tempDir" default="${build.dir}/test"/>
<attribute name="threadNum" default="1"/>
<attribute name="threadTotal" default="1"/>
<attribute name="tests.nightly" default="${tests.nightly}"/>
<attribute name="tests.weekly" default="${tests.weekly}"/>
<attribute name="tests.slow" default="${tests.slow}"/>
<attribute name="tests.multiplier" default="${tests.multiplier}"/>
<sequential>
<condition property="runall">
<not><or>
<isset property="testcase" />
<isset property="testpackage" />
<isset property="testpackageroot" />
</or></not>
</condition>
<!-- <mkdir dir="@{tempDir}/@{pattern}"/>
This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
-->
<touch file="@{tempDir}/@{threadNum}/quiet.ant" verbose="false" mkdirs="true"/>
<junit printsummary="off" haltonfailure="no" maxmemory="${tests.heapsize}" tempdir="@{tempDir}/@{threadNum}"
errorProperty="tests.failed" failureProperty="tests.failed" forkmode="perBatch" dir="@{tempDir}/@{threadNum}"
filtertrace="false">
<classpath refid="@{junit.classpath}"/>
<assertions>
<enable package="org.apache.lucene"/>
<enable package="org.apache.solr"/>
</assertions>
<jvmarg line="${args}"/>
<!-- allow tests to control debug prints -->
<sysproperty key="tests.verbose" value="${tests.verbose}"/>
<!-- even more debugging -->
<sysproperty key="tests.infostream" value="${tests.infostream}"/>
<!-- directory for formatter lock -->
<sysproperty key="tests.lockdir" value="${tests.lockdir}"/>
<!-- set the codec tests should run with -->
<sysproperty key="tests.codec" value="${tests.codec}"/>
<!-- set the postingsformat tests should run with -->
<sysproperty key="tests.postingsformat" value="${tests.postingsformat}"/>
<!-- set the locale tests should run with -->
<sysproperty key="tests.locale" value="${tests.locale}"/>
<!-- set the timezone tests should run with -->
<sysproperty key="tests.timezone" value="${tests.timezone}"/>
<!-- set the directory tests should run with -->
<sysproperty key="tests.directory" value="${tests.directory}"/>
<!-- set the line file source for oal.util.LineFileDocs -->
<sysproperty key="tests.linedocsfile" value="${tests.linedocsfile}"/>
<!-- set the number of times tests should run -->
<sysproperty key="tests.iter" value="${tests.iter}"/>
<!-- set the minimum number of times tests should run unless failure -->
<sysproperty key="tests.iter.min" value="${tests.iter.min}"/>
<!-- set the test seed -->
<sysproperty key="tests.seed" value="${tests.seed}"/>
<!-- set the Version that tests should run against -->
<sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
<!-- for lucene we can be strict, and we don't want false fails even across methods -->
<sysproperty key="tests.cleanthreads" value="${tests.cleanthreads.sysprop}"/>
<!-- logging config file -->
<sysproperty key="java.util.logging.config.file" value="${tests.loggingfile}"/>
<!-- set whether or not nightly tests should run -->
<sysproperty key="tests.nightly" value="@{tests.nightly}"/>
<!-- set whether or not weekly tests should run -->
<sysproperty key="tests.weekly" value="@{tests.weekly}"/>
<!-- set whether or not slow tests should run -->
<sysproperty key="tests.slow" value="@{tests.slow}"/>
<!-- set whether tests framework should not require java assertions enabled -->
<sysproperty key="tests.asserts.gracious" value="${tests.asserts.gracious}"/>
<!-- TODO: create propertyset for test properties, so each project can have its own set -->
<sysproperty key="tests.multiplier" value="@{tests.multiplier}"/>
<sysproperty key="tempDir" file="@{tempDir}/@{threadNum}"/>
<sysproperty key="lucene.version" value="${dev.version}"/>
<sysproperty key="testmethod" value="${testmethod}"/>
<sysproperty key="jetty.testMode" value="1"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
<formatter type="xml"/>
<formatter classname="${junit.details.formatter}" usefile="false"/>
<batchtest fork="yes" todir="@{junit.output.dir}" if="runall">
<fileset dir="@{dataDir}" includes="**/Test*.java,**/*Test.java" excludes="${junit.excludes}">
<custom classname="${junit.parallel.selector}" classpathref="@{junit.classpath}">
<param name="divisor" value="@{threadTotal}" />
<param name="part" value="@{threadNum}" />
</custom>
</fileset>
</batchtest>
<batchtest fork="yes" todir="@{junit.output.dir}" if="testpackage">
<fileset dir="@{dataDir}" includes="**/${testpackage}/**/Test*.java,**/${testpackage}/**/*Test.java" excludes="${junit.excludes}">
<custom classname="${junit.parallel.selector}" classpathref="@{junit.classpath}">
<param name="divisor" value="@{threadTotal}" />
<param name="part" value="@{threadNum}" />
</custom>
</fileset>
</batchtest>
<batchtest fork="yes" todir="@{junit.output.dir}" if="testpackageroot">
<fileset dir="@{dataDir}" includes="**/${testpackageroot}/Test*.java,**/${testpackageroot}/*Test.java" excludes="${junit.excludes}">
<custom classname="${junit.parallel.selector}" classpathref="@{junit.classpath}">
<param name="divisor" value="@{threadTotal}" />
<param name="part" value="@{threadNum}" />
</custom>
</fileset>
</batchtest>
<batchtest fork="yes" todir="@{junit.output.dir}" if="testcase">
<fileset dir="@{dataDir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</sequential>
</macrodef>
<target name="test" depends="compile-test,validate,junit-mkdir,junit-sequential,junit-parallel" description="Runs unit tests"/>
<target name="junit-mkdir">
<mkdir dir="${junit.output.dir}"/>
</target>
<target name="junit-sequential" if="tests.sequential">
<test-macro/>
</target>
<target name="junit-parallel" unless="tests.sequential">
<parallel threadsPerProcessor="${tests.threadspercpu}">
<test-macro threadNum="1" threadTotal="4"/>
<test-macro threadNum="2" threadTotal="4"/>
<test-macro threadNum="3" threadTotal="4"/>
<test-macro threadNum="4" threadTotal="4"/>
</parallel>
</target>
<!--
If you want clover test code coverage, run this before the tests. You need clover.jar and the license in your ANT classspath and you need to specify -Drun.clover=true on the command line.
See http://issues.apache.org/jira/browse/LUCENE-721
-->
<target name="clover" depends="clover.setup, clover.info" description="Instrument the Unit tests using Clover. Requires a Clover 2.x license and clover.jar in the ANT classpath. To use, specify -Drun.clover=true on the command line."/>
<target name="clover.setup" if="clover.enabled">
<taskdef resource="cloverlib.xml"/>
<mkdir dir="${clover.db.dir}"/>
<clover-setup initString="${clover.db.dir}/lucene_coverage.db" encoding="${build.encoding}">
<fileset dir="${src.dir}">
<include name="org/apache/**/*.java" />
</fileset>
<testsources dir="${tests-framework.src.dir}">
<include name="org/apache/**/*.java" />
</testsources>
<testsources dir="${tests.src.dir}">
<include name="org/apache/**/*.java" />
</testsources>
</clover-setup>
</target>
<target name="clover.info" unless="clover.present">
<echo>
Clover not found. Code coverage reports disabled.
</echo>
</target>
<target name="clover.check">
<fail unless="clover.present">
##################################################################
Clover not found.
Please make sure clover.jar is in ANT_HOME/lib, or made available
to Ant using other mechanisms like -lib or CLASSPATH.
##################################################################
</fail>
</target>
<target name="generate-test-reports" description="Generates test reports">
<mkdir dir="${junit.reports}"/>
<junitreport todir="${junit.output.dir}">
<!-- this fileset let's the task work for individual contribs,
as well as the project as a whole
-->
<fileset dir="${build.dir}">
<include name="**/test/TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.reports}"/>
</junitreport>
<mkdir dir="${junit.reports.backwards}"/>
<junitreport todir="${junit.output.dir.backwards}">
<!-- this fileset let's the task work for individual contribs,
as well as the project as a whole
-->
<fileset dir="${build.dir.backwards}">
<include name="**/test/TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.reports.backwards}"/>
</junitreport>
</target>
<target name="jar" depends="jar-core">
<!-- convenience target to package core JAR -->
</target>
<target name="jar-src">
<sequential>
<mkdir dir="${build.dir}" />
<jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar">
<fileset dir="${src.dir}/../resources" erroronmissingdir="no"/>
</jarify>
</sequential>
</target>
<target name="default" depends="jar-core"/>
<available type="file" file="pom.xml" property="pom.xml.present"/>
<!-- TODO, this is really unintuitive how we depend on a target that does not exist -->
<target name="javadocs">
<fail message="You must redefine the javadocs task to do something!!!!!"/>
</target>
<target name="install-maven-tasks" unless="maven-tasks.uptodate" depends="ivy-availability-check,ivy-fail">
<property name="maven-tasks.uptodate" value="true"/>
<ivy:cachepath organisation="org.apache.maven" module="maven-ant-tasks" revision="2.1.3"
inline="true" conf="master" type="jar" pathid="maven-ant-tasks.classpath"/>
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath"/>
</target>
<target name="dist-maven"
depends="filter-pom-templates, install-maven-tasks, m2-deploy-lucene-parent-pom, dist-maven-common"/>
<target name="dist-maven-common"
depends="jar-core, jar-src, javadocs, install-maven-tasks, filter-pom-templates">
<sequential>
<property name="top.level.dir" location="${common.dir}/.."/>
<pathconvert property="pom.xml">
<mapper>
<chainedmapper>
<globmapper from="${top.level.dir}*" to="${filtered.pom.templates.dir}*"/>
<globmapper from="*build.xml" to="*pom.xml"/>
</chainedmapper>
</mapper>
<path location="${ant.file}"/>
</pathconvert>
<m2-deploy pom.xml="${pom.xml}">
<artifact-attachments>
<attach file="${build.dir}/${final.name}-src.jar"
classifier="sources"/>
<attach file="${build.dir}/${final.name}-javadoc.jar"
classifier="javadoc"/>
</artifact-attachments>
</m2-deploy>
</sequential>
</target>
<target name="filter-pom-templates" unless="filtered.pom.templates.uptodate">
<mkdir dir="${filtered.pom.templates.dir}"/>
<copy todir="${common.dir}/build/poms" overwrite="true">
<fileset dir="${common.dir}/../dev-tools/maven"/>
<filterset begintoken="@" endtoken="@">
<filter token="version" value="${version}"/>
</filterset>
<globmapper from="*.template" to="*"/>
</copy>
<property name="filtered.pom.templates.uptodate" value="true"/>
</target>
<target name="m2-deploy-lucene-parent-pom" depends="filter-pom-templates,m2-deploy-grandparent-pom"
unless="deployed.lucene.parent.pom.uptodate">
<m2-deploy pom.xml="${filtered.pom.templates.dir}/lucene/pom.xml"/> <!-- Lucene parent POM -->
<property name="deployed.lucene.parent.pom.uptodate" value="true"/>
</target>
<target name="m2-deploy-grandparent-pom" depends="filter-pom-templates"
unless="deployed.grandparent.pom.uptodate">
<m2-deploy pom.xml="${filtered.pom.templates.dir}/pom.xml"/> <!-- Lucene/Solr grandparent POM -->
<property name="deployed.grandparent.pom.uptodate" value="true"/>
</target>
<target name="stage-maven-artifacts">
<sequential>
<property name="output.build.xml" location="${build.dir}/stage_maven_build.xml"/>
<property name="dev-tools.scripts.dir" value="../dev-tools/scripts"/>
<exec dir="." executable="perl" failonerror="true" outputproperty="stage.maven.script.output">
<arg value="${dev-tools.scripts.dir}/write.stage.maven.build.xml.pl"/>
<arg value="${maven.dist.dir}"/> <!-- Maven distribution artifacts directory -->
<arg value="${output.build.xml}"/> <!-- Ant build file to be written -->
<arg value="${common.dir}/common-build.xml"/> <!-- Imported from the ant file to be written -->
</exec>
<echo message="${stage.maven.script.output}"/>
</sequential>
<echo>Invoking target stage-maven in ${output.build.xml} now...</echo>
<ant target="stage-maven" antfile="${output.build.xml}" inheritall="false">
<property name="m2.repository.id" value="${m2.repository.id}"/>
<property name="m2.repository.url" value="${m2.repository.url}"/>
</ant>
</target>
<!-- TODO: add cool detector like the ivy one? this requires you have rat -->
<target name="rat-sources-typedef">
<typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks">
<classpath>
<fileset dir="." includes="rat*.jar"/>
</classpath>
</typedef>
</target>
<target name="rat-sources" depends="rat-sources-typedef"
description="runs the tasks over source and test files">
<sequential>
<!-- create a temp file for the log to go to -->
<tempfile property="rat.sources.logfile"
prefix="rat"
destdir="${java.io.tmpdir}"/>
<!-- run rat, going to the file -->
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
reportFile="${rat.sources.logfile}">
<fileset dir="${src.dir}" excludes="${rat.excludes}"/>
<fileset dir="${tests.src.dir}" excludes="${rat.excludes}" erroronmissingdir="false"/>
<!-- some modules have a src/tools/[java,test] -->
<fileset dir="src/tools/java" excludes="${rat.excludes}" erroronmissingdir="false"/>
<fileset dir="src/tools/test" excludes="${rat.excludes}" erroronmissingdir="false"/>
<!-- bsd-like stuff -->
<rat:substringMatcher licenseFamilyCategory="BSD "
licenseFamilyName="Modified BSD License">
<!-- brics automaton -->
<pattern substring="Copyright (c) 2001-2009 Anders Moeller"/>
<!-- snowball -->
<pattern substring="Copyright (c) 2001, Dr Martin Porter"/>
<!-- UMASS kstem -->
<pattern substring="THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF MASSACHUSETTS AND OTHER CONTRIBUTORS"/>
<!-- Egothor -->
<pattern substring="Egothor Software License version 1.00"/>
<!-- JaSpell -->
<pattern substring="Copyright (c) 2005 Bruno Martins"/>
</rat:substringMatcher>
<!-- mit-like -->
<rat:substringMatcher licenseFamilyCategory="MIT "
licenseFamilyName="The MIT License">
<!-- ICU license -->
<pattern substring="Permission is hereby granted, free of charge, to any person obtaining a copy"/>
</rat:substringMatcher>
<rat:substringMatcher licenseFamilyCategory="GEN "
licenseFamilyName="Generated">
<!-- svg files generated by gnuplot -->
<pattern substring="Produced by GNUPLOT"/>
<!-- snowball stemmers generated by snowball compiler -->
<pattern substring="This file was generated automatically by the Snowball to Java compiler"/>
<!-- uima tests generated by JCasGen -->
<pattern substring="First created by JCasGen"/>
</rat:substringMatcher>
<!-- built in approved licenses -->
<rat:approvedLicense familyName="Apache License Version 2.0"/>
<rat:approvedLicense familyName="The MIT License"/>
<rat:approvedLicense familyName="Modified BSD License"/>
<rat:approvedLicense familyName="Generated"/>
</rat:report>
<!-- now print the output, for review -->
<loadfile property="rat.output" srcFile="${rat.sources.logfile}"/>
<echo>${rat.output}</echo>
<delete>
<fileset file="${rat.sources.logfile}">
<containsregexp expression="^0 Unknown Licenses"/>
</fileset>
</delete>
<!-- fail if we didnt find the pattern -->
<fail message="Rat problems were found!">
<condition>
<available file="${rat.sources.logfile}"/>
</condition>
</fail>
</sequential>
</target>
<!--+
| M A C R O S
+-->
<macrodef name="compile">
<attribute name="srcdir"/>
<attribute name="destdir"/>
<attribute name="javac.source" default="${javac.source}"/>
<attribute name="javac.target" default="${javac.target}"/>
<attribute name="includeantruntime" default="${javac.includeAntRuntime}" />
<element name="nested" implicit="yes" optional="yes"/>
<sequential>
<mkdir dir="@{destdir}"/>
<javac
includeAntRuntime="@{includeantruntime}"
encoding="${build.encoding}"
bootclasspath="${bootclasspath}"
srcdir="@{srcdir}"
destdir="@{destdir}"
deprecation="${javac.deprecation}"
debug="${javac.debug}"
source="@{javac.source}"
target="@{javac.target}">
<nested/>
<!-- <compilerarg line="-Xmaxwarns 10000000"/>
<compilerarg line="-Xmaxerrs 10000000"/> -->
<!-- for generics in Java 1.5: -->
<compilerarg line="${javac.args}"/>
</javac>
</sequential>
</macrodef>
<macrodef name="invoke-javacc">
<attribute name="target"/>
<attribute name="outputDir"/>
<sequential>
<mkdir dir="@{outputDir}"/>
<javacc
target="@{target}"
outputDirectory="@{outputDir}"
debugTokenManager="${javacc.debug.tokenmgr}"
debugParser="${javacc.debug.parser}"
debuglookahead="${javacc.debug.lookahead}"
javacchome="${javacc.home}"
jdkversion="${javac.source}"
/>
<fixcrlf srcdir="@{outputDir}" includes="*.java" encoding="UTF-8">
<containsregexp expression="Generated.*By.*JavaCC"/>
</fixcrlf>
</sequential>
</macrodef>
<property name="failonjavadocwarning" value="true"/>
<macrodef name="invoke-javadoc">
<element name="sources" optional="yes"/>
<attribute name="destdir"/>
<attribute name="title" default="${Name} ${version} API"/>
<attribute name="overview" default="${src.dir}/overview.html"/>
<sequential>
<antcall target="download-java6-javadoc-packagelist"/>
<delete file="@{destdir}/stylesheet.css" failonerror="false"/>
<copy todir="@{destdir}" file="${prettify.dir}/prettify.js" overwrite="false" />
<record name="@{destdir}/log_javadoc.txt" action="start" append="no"/>
<javadoc
overview="@{overview}"
bootclasspath="${bootclasspath}"
packagenames="org.apache.lucene.*,org.apache.solr.*"
destdir="@{destdir}"
access="${javadoc.access}"
encoding="${build.encoding}"
charset="${javadoc.charset}"
docencoding="${javadoc.charset}"
author="true"
version="true"
use="true"
failonerror="true"
source="${ant.java.version}"
windowtitle="${Name} ${version} API"
doctitle="@{title}"
maxmemory="${javadoc.maxmemory}"
bottom="Copyright &amp;copy; ${year} Apache Software Foundation. All Rights Reserved.">
<tag name="lucene.experimental"
description="WARNING: This API is experimental and might change in incompatible ways in the next release."/>
<tag name="lucene.internal"
description="NOTE: This API is for internal purposes only and might change in incompatible ways in the next release."/>
<link offline="true" packagelistLoc="${javadoc.dir}"/>
<link offline="true" href="${javadoc.link}" packagelistLoc="${javadoc.packagelist.dir}/java6"/>
<bottom><![CDATA[
<script src='{@docRoot}/prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
]]></bottom>
<sources />
<classpath refid="javadoc.classpath"/>
</javadoc>
<record name="@{destdir}/log_javadoc.txt" action="stop"/>
<!-- append prettify.css -->
<concat destfile="@{destdir}/stylesheet.css" append="true">
<filelist dir="${prettify.dir}" files="prettify.css"/>
</concat>
<delete>
<fileset file="@{destdir}/log_javadoc.txt">
<or>
<not>
<containsregexp expression="\[javadoc\]\s*[1-9][0-9]*\s*warning"/>
</not>
<and>
<!-- allow 1 warning, if there is also a bootstrap warning generated by Java7 -->
<containsregexp expression="\[javadoc\]\s*warning.*bootstrap"/>
<containsregexp expression="\[javadoc\]\s*1\s*warning"/>
</and>
</or>
</fileset>
</delete>
<fail message="Javadocs warnings were found!">
<condition>
<and>
<available file="@{destdir}/log_javadoc.txt"/>
<istrue value="${failonjavadocwarning}"/>
</and>
</condition>
</fail>
</sequential>
</macrodef>
<macrodef name="contrib-crawl">
<attribute name="target" default=""/>
<attribute name="failonerror" default="true"/>
<sequential>
<subant target="@{target}" failonerror="@{failonerror}" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
<fileset dir="." includes="contrib/*/build.xml"/>
</subant>
</sequential>
</macrodef>
<target name="download-java6-javadoc-packagelist" unless="javadoc.java6.packagelist.exists">
<mkdir dir="${javadoc.packagelist.dir}/java6"/>
<get src="${javadoc.link}/package-list"
dest="${javadoc.packagelist.dir}/java6/package-list" ignoreerrors="true"/>
</target>
<!-- VALIDATION work -->
<!-- Generic placeholder target for if we add other validation tasks -->
<target name="validate">
</target>
<property name="svn.export.dir" location="${build.dir}/svn-export"/>
<macrodef name="svn-export-source"
description="Runs 'svn export' with the same URL and revision as the current working copy.">
<attribute name="source.dir"/>
<sequential>
<delete dir="${svn.export.dir}" includeemptydirs="true" failonerror="false"/>
<get-svn-info directory="@{source.dir}"/>
<exec dir="@{source.dir}" executable="${svn.exe}" failonerror="true">
<arg value="export"/>
<arg value="--native-eol"/>
<arg value="LF"/>
<arg value="-r"/>
<arg value="${svn.Revision}"/>
<arg value="${svn.URL}"/>
<arg value="${svn.export.dir}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="get-svn-info"
description="Populates properties svn.URL and svn.Revision using 'svn info'.">
<attribute name="directory"/>
<sequential>
<exec dir="." executable="${svnversion.exe}" outputproperty="svn.ver"/>
<fail message="A subversion checkout is required for this target">
<condition>
<equals arg1="${svn.ver}" arg2="exported"/>
</condition>
</fail>
<exec dir="@{directory}" executable="${svn.exe}" outputproperty="svn.info" failonerror="true">
<arg value="info"/>
</exec>
<loadproperties>
<propertyresource name="svn.info"/>
<filterchain>
<linecontainsregexp>
<regexp pattern="(URL|Revision):"/>
</linecontainsregexp>
<replacestring from=": " to="="/>
<prefixlines prefix="svn."/>
</filterchain>
</loadproperties>
</sequential>
</macrodef>
<macrodef name="make-checksums" description="Macro for building checksum files">
<attribute name="file"/>
<sequential>
<echo>Building checksums for '@{file}'</echo>
<checksum file="@{file}" algorithm="md5" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
<checksum file="@{file}" algorithm="sha1" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
</sequential>
</macrodef>
<macrodef name="sign-artifacts-macro">
<attribute name="artifacts.dir"/>
<sequential>
<delete failonerror="false">
<fileset dir="@{artifacts.dir}">
<include name="**/*.asc"/>
</fileset>
</delete>
<available property="gpg.input.handler" classname="org.apache.tools.ant.input.SecureInputHandler"
value="org.apache.tools.ant.input.SecureInputHandler"/>
<!--else:--><property name="gpg.input.handler" value="org.apache.tools.ant.input.DefaultInputHandler"/>
<input message="Enter GPG keystore password: >" addproperty="gpg.passphrase">
<handler classname="${gpg.input.handler}" />
</input>
<apply executable="${gpg.exe}" inputstring="${gpg.passphrase}"
dest="@{artifacts.dir}" type="file" maxparallel="1" verbose="yes">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="--batch"/>
<arg value="--armor"/>
<arg value="--default-key"/>
<arg value="${gpg.key}"/>
<arg value="--output"/>
<targetfile/>
<arg value="--detach-sig"/>
<srcfile/>
<fileset dir="@{artifacts.dir}">
<include name="**/*.jar"/>
<include name="**/*.war"/>
<include name="**/*.zip"/>
<include name="**/*.tgz"/>
<include name="**/*.pom"/>
</fileset>
<globmapper from="*" to="*.asc"/>
</apply>
</sequential>
</macrodef>
<property name="rc" value="rc0"/>
<property name="remote.staging.dir" value="public_html/staging_area/${rc}/${version}"/>
<property name="keyfile" value="${user.home}/.ssh/id_rsa"/>
<property name="scp.user" value="${user.name}"/>
<!--keys.dir is the location of the https://svn.apache.org/repos/asf/lucene/java/dist/ directory-->
<property name="keys.dir" value="${common.dir}/../../dist"/>
<macrodef name="copy-to-stage-macro">
<attribute name="artifacts.dir"/>
<sequential>
<sshexec host="people.apache.org"
username="${scp.user}"
keyfile="${keyfile}"
command="mkdir -p ${remote.staging.dir}"/>
<echo>Uploading artifacts to ${scp.user}@people.apache.org:${remote.staging.dir}</echo>
<scp todir="${scp.user}@people.apache.org:${remote.staging.dir}"
username="${scp.user}"
keyfile="${keyfile}"
verbose="true">
<fileset dir="${artifacts.dir}"/>
<fileset dir="${keys.dir}">
<include name="KEYS"/>
</fileset>
</scp>
</sequential>
</macrodef>
</project>