Permalink
Fetching contributors…
Cannot retrieve contributors at this time
1414 lines (1202 sloc) 53.1 KB
<!--
Builds main components and applications of Carrot2 3.x.
Carrot2 Workbench is built using a dedicated script.
-->
<project name="carrot2.master" default="test">
<!-- Basedir relative to this build file -->
<dirname property="carrot2.master.basedir" file="${ant.file.carrot2.master}"/>
<tstamp>
<format property="build.tstamp" pattern="yyyyMMddHHmmss" />
</tstamp>
<!-- Tmp dir -->
<property name="tmp.dir" location="tmp" />
<!-- Directory with flattened lib files, to be visible in imported scripts -->
<property name="lib.flattened" location="${tmp.dir}/lib" />
<!-- ant contrib -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<fileset dir="${carrot2.master.basedir}/etc/ant/" includes="ant-contrib-*.jar" />
</classpath>
</taskdef>
<!-- Import local properties and version -->
<property name="local.properties" location="${carrot2.master.basedir}/local.properties" />
<property file="${local.properties}" />
<property file="${carrot2.master.basedir}/carrot2.version" />
<property file="${carrot2.master.basedir}/etc/version/carrot2.basenames" />
<!-- Import other build scripts. -->
<import file="${carrot2.master.basedir}/applications/carrot2-webapp/build.xml" />
<import file="${carrot2.master.basedir}/applications/carrot2-dcs/build.xml" />
<import file="${carrot2.master.basedir}/applications/carrot2-cli/build.xml" />
<import file="${carrot2.master.basedir}/doc/build.xml" />
<import file="${carrot2.master.basedir}/etc/maven/build.xml" />
<import file="${carrot2.master.basedir}/etc/solr/build.xml" />
<import file="${carrot2.master.basedir}/lib/org.carrot2.antlib/build.xml" />
<import file="${carrot2.master.basedir}/etc/ant/common/readme.xml" />
<import file="${carrot2.master.basedir}/etc/ant/common/rcp-defaults.xml" />
<import file="${carrot2.master.basedir}/workbench/build-conf/build.xml" />
<!-- Derive version numbers for other components. -->
<import file="${carrot2.master.basedir}/etc/ant/common/derive-versions.xml" />
<derive-versions prefix="carrot2" />
<!-- Source code and lib dirs -->
<property name="core.dir" location="${carrot2.master.basedir}/core" />
<property name="applications.dir" location="${carrot2.master.basedir}/applications" />
<property name="workbench.dir" location="${carrot2.master.basedir}/workbench" />
<property name="lib.dir" location="${carrot2.master.basedir}/lib" />
<property name="etc.dir" location="${carrot2.master.basedir}/etc" />
<property name="dist.dir" location="${tmp.dir}/distribution" />
<!-- Output dirs -->
<property name="build.dir" location="${tmp.dir}/classes" />
<property name="build.dir.tests" location="${tmp.dir}/classes-test" />
<property name="build.dir.clover" location="${tmp.dir}/classes-clover" />
<property name="build.dir.findbugs" location="${tmp.dir}/classes-findbugs" />
<property name="jar.dir" location="${tmp.dir}/jar" />
<property name="api.dir" location="${tmp.dir}/api" />
<property name="javadoc.dir" location="${tmp.dir}/javadoc" />
<property name="tests.report.dir" location="${tmp.dir}/test-report" />
<property name="coverage.report.dir" location="${tmp.dir}/coverage-report" />
<property name="duplication.report.dir" location="${tmp.dir}/duplication-report" />
<property name="findbugs.report.dir" location="${tmp.dir}/findbugs-report" />
<property name="compatibility.report.dir" location="${tmp.dir}/compatibility-report" />
<!-- Java API distribution -->
<property name="api.dist.base" value="${carrot2.java-api.base}" />
<!-- Extra tools the build can use if available -->
<condition property="clover.runwith" value="true">
<and>
<istrue value="${clover.enabled}" />
<available file="${clover.home}" type="dir" />
</and>
</condition>
<property name="clover.jar" location="${clover.home}/lib/clover.jar" />
<property name="pmd.jar" location="${pmd.home}/lib/" />
<property name="smartsprites.home" location="${carrot2.master.basedir}/etc/smartsprites" />
<property name="workbench.build.dir" location="tmp/workbench" />
<property name="workbench.tests.html.report.dir" location="${workbench.build.dir}/test-report" />
<property name="workbench.tests.txt.report.dir" location="${workbench.build.dir}/test-report-txt" />
<!-- Compilation presets. -->
<presetdef name="javac">
<javac deprecation="false" debug="true"
target="1.6" source="1.6"
encoding="UTF-8" includeantruntime="true" optimize="true"/>
</presetdef>
<!-- Source files to compile for tests. -->
<path id="src.test.folders">
<dirset dir="${core.dir}" includes="**/src-test" />
<dirset dir="${applications.dir}" includes="**/src">
<exclude name="carrot2-dcs/examples/java/**" />
</dirset>
<dirset dir="${applications.dir}" includes="**/src-test" />
</path>
<!-- Core source files to compile for production -->
<path id="src.core.folders">
<dirset dir="${core.dir}" includes="**/src" />
</path>
<!-- We'll be using Carrot2 internal Xalan for XSLTs -->
<path id="classpath.xalan">
<fileset dir="${carrot2.master.basedir}/lib/org.apache.xml" includes="*.jar" />
</path>
<presetdef name="xslt.xinclude">
<xslt>
<classpath refid="classpath.xalan" />
<factory name="org.apache.xalan.processor.TransformerFactoryImpl" />
<sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
value="org.apache.xerces.parsers.XIncludeParserConfiguration" />
</xslt>
</presetdef>
<!--
Source files for coverage calculation. The auto-generated code is excluded from the
list. Also, if external API tests are disabled, the document source classes are
also excluded from coverage calculation.
-->
<fileset id="src.coverage" dir="${carrot2.master.basedir}">
<include name="core/**/*.java" />
<include name="applications/**/*.java" />
<exclude name="**/carrot2-examples/**/*.java" if="tests.externalservices" />
<exclude name="**/carrot2-source-etools/**/*.java" if="tests.externalservices" />
<exclude name="**/carrot2-source-google/**/*.java" if="tests.externalservices" />
<exclude name="**/carrot2-source-microsoft/**/*.java" if="tests.externalservices" />
<exclude name="**/carrot2-source-opensearch/**/*.java" if="tests.externalservices" />
<exclude name="**/carrot2-source-microsoft/src/com/microsoft/msnsearch/**/*.java" />
<exclude name="**/carrot2-core/src/org/carrot2/core/CachingController.java" />
<exclude name="**/carrot2-core/src/org/carrot2/core/SimpleController.java" />
</fileset>
<patternset id="lib.test">
<include name="core/**/*.jar" />
<include name="lib/**/*.jar" />
<exclude name="lib/org.slf4j/slf4j-nop*" />
<include name="applications/carrot2-dcs/**/*.jar" />
<include name="applications/carrot2-webapp/lib/*.jar" />
<include name="applications/carrot2-benchmarks/lib/*.jar" />
</patternset>
<!-- Excludes both JAR and LICENSE files -->
<patternset id="lib.core.excludes">
<exclude name="lib/**/easymock*" />
<exclude name="lib/**/fest-*" />
<exclude name="lib/**/servlet-api-*.jar" />
<exclude name="lib/**/jsr305*" />
<exclude name="lib/org.junit4*/**" />
<exclude name="lib/org.carrot2*/**" />
<exclude name="lib/org.gargoylesoftware.htmlunit/**" />
<exclude name="lib/com.thoughtworks.qdox/**" />
<exclude name="lib/org.apache.velocity/**" />
<exclude name="lib/org.apache.oro/**" />
<exclude name="lib/com.planetj.compression/**" />
<exclude name="lib/org.eclipse.jetty/**" />
<exclude name="lib/org.kohsuke.args4j/**" />
<exclude name="lib/org.apache.xml/**" />
<exclude name="lib/com.google.guava/ri*" />
<exclude name="lib/org.slf4j/slf4j-log4j12*" />
<exclude name="lib/org.apache.log4j/*" />
</patternset>
<patternset id="lib.core">
<include name="lib/**/*.jar" />
<include name="core/carrot2-util-matrix/lib/*.jar" />
<patternset refid="lib.core.excludes" />
</patternset>
<patternset id="lib.core.mini">
<include name="lib/**/mahout-*.jar" />
<include name="lib/**/mahout.LICENSE" />
<include name="lib/**/colt.LICENSE" />
<include name="lib/**/commons-lang*" />
<include name="lib/**/ehcache*" />
<include name="lib/**/guava*" />
<include name="lib/**/jackson*" />
<include name="lib/**/lucene-snowball*" />
<include name="lib/**/lucene.LICENSE" />
<include name="lib/**/hppc-*.jar" />
<include name="lib/**/hppc*.LICENSE" />
<include name="lib/**/slf4j-api*.jar" />
<include name="lib/**/slf4j-nop*.jar" />
<include name="lib/**/slf4j.LICENSE" />
</patternset>
<patternset id="licenses.core">
<include name="lib/**/*.LICENSE" />
<patternset refid="lib.core.excludes" />
<include name="core/carrot2-util-matrix/lib/*.LICENSE" />
</patternset>
<!-- All JARs required by the core code -->
<fileset dir="${carrot2.master.basedir}" id="lib.core.files">
<patternset refid="lib.core" />
</fileset>
<fileset dir="${carrot2.master.basedir}" id="lib.test.files">
<patternset refid="lib.test" />
</fileset>
<path id="lib.classpath">
<fileset refid="lib.test.files" />
</path>
<!-- Extra classpath entries for unit tests -->
<path id="test.classpath">
<path refid="lib.classpath" />
<path location="${core.dir}/carrot2-component-suites/suites" />
<path location="${core.dir}/carrot2-util-log4j/src" />
<!-- Prepend classpath with clover-ified classes, if available. -->
<path location="${build.dir.clover}" />
<path location="${build.dir.tests}" />
<path location="${build.dir}" />
<path location="${clover.jar}" />
</path>
<!-- Path to the Carrot2 core JAR -->
<path id="core.jar.classpath">
<fileset dir="${jar.dir}">
<include name="carrot2-core-${carrot2.version}.jar" />
</fileset>
</path>
<path id="javadoc.classpath">
<path refid="lib.classpath" />
<!-- Include our own compiled sources so that we can exclude some classes from javadoc
and still compile without warnings. -->
<path refid="core.jar.classpath" />
<!-- Include ANT's JAR for ANT tasks. -->
<path location="${ant.home}/lib/ant.jar" />
</path>
<antversion property="ant.version" />
<fail message="Use ANT 1.8.2 or later. Your ANT is: ${ant.version}">
<condition><not><antversion atleast="1.8.2" /></not></condition>
</fail>
<!--
Output cleanup.
-->
<target name="clean" depends="coverage.clean" description="Cleans all build results">
<delete dir="${tmp.dir}" failonerror="false" />
</target>
<!--
Core.
-->
<target name="compile">
<mkdir dir="${build.dir}" />
<!-- Compile the rest. -->
<javac destdir="${build.dir}">
<src refid="src.core.folders" />
<classpath refid="lib.classpath" />
</javac>
</target>
<!-- Tests. -->
<target name="compile.test">
<mkdir dir="${build.dir.tests}" />
<javac destdir="${build.dir.tests}">
<src refid="src.test.folders" />
<classpath location="${build.dir}" />
<classpath refid="lib.classpath" />
</javac>
</target>
<!-- FindBugs. -->
<target name="compile.findbugs">
<mkdir dir="${build.dir.findbugs}" />
<javac destdir="${build.dir.findbugs}">
<src refid="src.core.folders" />
<classpath refid="lib.classpath" />
</javac>
<javac destdir="${build.dir.findbugs}">
<src refid="src.test.folders" />
<classpath location="${build.dir.findbugs}" />
<classpath refid="lib.classpath" />
</javac>
</target>
<target name="compatibility" depends="core">
<!-- This will not work anymore if we release a bugfix off the branch. -->
<mkdir dir="tmp/compatibility" />
<get src="http://repo1.maven.org/maven2/org/carrot2/carrot2-core/maven-metadata.xml" dest="tmp/compatibility/maven-metadata.xml" />
<xmlproperty file="tmp/compatibility/maven-metadata.xml" collapseAttributes="true" keepRoot="false" />
<get src="http://download.carrot2.org/stable/${versioning.latest}/carrot2-java-api-${versioning.latest}.zip"
dest="tmp/compatibility/carrot2-java-api-${versioning.latest}.zip" />
<unzip src="tmp/compatibility/carrot2-java-api-${versioning.latest}.zip" dest="tmp/compatibility">
<patternset>
<include name="**/*.jar" />
</patternset>
</unzip>
<taskdef classpath="${etc.dir}/clirr/clirr-core-0.6-fixed.jar" resource="clirrtask.properties"/>
<mkdir dir="${compatibility.report.dir}" />
<clirr failOnBinError="false" failOnSrcError="false">
<origfiles dir="tmp/compatibility/carrot2-java-api-${versioning.latest}/lib/required" includes="carrot2-core-${versioning.latest}.jar" />
<origClassPath>
<fileset dir="tmp/compatibility/carrot2-java-api-${versioning.latest}/lib" />
</origClassPath>
<newfiles dir="tmp/api" includes="**/carrot2-core-${carrot2.version}.jar" />
<newClassPath>
<fileset dir="tmp/api/lib" />
</newClassPath>
<apiclasses>
<exclude name="**/org/carrot2/util/xsltfilter/**" />
<exclude name="**/*Descriptor$*/**" />
<exclude name="**/*Descriptor*/**" />
<exclude name="**/org/carrot2/util/attribute/AttributeBinder**" />
<exclude name="**/org/carrot2/util/httpclient/**" />
<exclude name="**/org/carrot2/util/log4j/**" />
<exclude name="**/org/carrot2/util/simplexml/**" />
<exclude name="**/org/carrot2/util/factory/**" />
</apiclasses>
<formatter type="plain" outfile="${compatibility.report.dir}/api-compatibility.txt" />
<formatter type="xml" outfile="${compatibility.report.dir}/api-compatibility.xml" />
</clirr>
<xslt.xinclude in="${compatibility.report.dir}/api-compatibility.xml"
out="${compatibility.report.dir}/api-compatibility.html"
style="${etc.dir}/clirr/clirr2html.xsl">
<classpath>
<fileset dir="${lib.dir}/org.apache.xml">
<include name="*.jar" />
</fileset>
</classpath>
<param name="current" expression="${carrot2.version}" />
<param name="baseline" expression="${versioning.latest}" />
</xslt.xinclude>
</target>
<!--
Core resources.
-->
<target name="resources">
<mkdir dir="${build.dir}" />
<copy todir="${build.dir}" includeemptydirs="false">
<fileset dir="${core.dir}">
<include name="**/src/**" />
<include name="**/src-resources/**" />
<exclude name="**/*.java" />
<exclude name="**/*.clover" />
<exclude name="**/carrot2-util-log4j/**" />
</fileset>
<regexpmapper from="^.*src(-resources)?(.*)$$" to="\2" />
</copy>
</target>
<!--
Test resources.
-->
<target name="resources.test"
depends="resources, carrot2.dcs.resources.test">
<mkdir dir="${build.dir.tests}" />
<copy todir="${build.dir.tests}" includeemptydirs="false">
<fileset dir="${core.dir}">
<include name="**/src-test/**" />
<exclude name="**/*.java" />
<exclude name="**/*.clover" />
<exclude name="**/carrot2-util-log4j/**" />
</fileset>
<fileset dir="${applications.dir}">
<include name="**/src-test/**" />
</fileset>
<regexpmapper from="^.*src(-test)?(.*)$$" to="\2" />
</copy>
</target>
<!--
Unit tests.
-->
<target name="test"
depends="compile, resources, compile.test, compile.coverage, resources.test"
description="Runs all unit tests.">
<delete dir="${tests.report.dir}" failonerror="false" />
<mkdir dir="${tests.report.dir}" />
<property name="jira.report.dir" location="${tmp.dir}/test-report-jira" />
<delete dir="${jira.report.dir}" failonerror="false" />
<mkdir dir="${jira.report.dir}" />
<condition property="carrot2.xml.feed.url.base.internal"
value="${carrot2.xml.feed.url.base}"
else="">
<isset property="carrot2.xml.feed.url.base" />
</condition>
<!-- junit4 -->
<taskdef resource="junit4.antlib.xml" loaderref="junit4.loader">
<classpath>
<fileset dir="${carrot2.master.basedir}">
<include name="lib/org.junit4-ext/junit*.jar" />
<include name="lib/com.carrotsearch.randomizedtesting/*.jar" />
</fileset>
</classpath>
</taskdef>
<!-- defaults. -->
<property name="tests.nightly" value="false" />
<!-- Values: number of cpus to use, 'max' to use all available cores or 'auto' for sensible
defaults depending on the number of cores. -->
<property name="tests.cpus" value="auto" />
<junit4 haltonfailure="false"
failureproperty="tests.failed"
tempdir="${tmp.dir}"
parallelism="${tests.cpus}"
shuffleOnSlave="true"
leaveTemporary="false"
>
<listeners>
<report-console
showThrowable="true"
showStackTraces="true"
showErrorStream="true"
showOutputStream="true"
showStatusOk="true"
showStatusError="true"
showStatusFailure="true"
showStatusIgnored="true"
showSuiteSummary="false"
/>
<!-- Store execution times-->
<report-execution-times file="${tmp.dir}/execution-hints.log" historyLength="5" />
<report-ant-xml dir="${jira.report.dir}">
<tokenfilter>
<replaceregex pattern='\s+\{[^\}]*\}'
replace='' flags="gs" />
</tokenfilter>
</report-ant-xml>
<report-json file="${tests.report.dir}/index.html" />
</listeners>
<balancers>
<execution-times>
<file file="${carrot2.master.basedir}/etc/tests/carrot2-hints.log" />
<file file="${tmp.dir}/execution-hints.log" />
</execution-times>
</balancers>
<jvmarg value="-ea" />
<classpath refid="test.classpath" />
<sysproperty key="tests.externalservices" value="${tests.externalservices}" />
<sysproperty key="tests.nightly" value="${tests.nightly}" />
<sysproperty key="carrot2.xml.feed.url.base" value="${carrot2.xml.feed.url.base.internal}" />
<sysproperty key="dcs.test.web.dir.prefix" value="${applications.dir}/carrot2-dcs" />
<sysproperty key="log4j.configuration" value="log4j-tests.xml" />
<fileset dir="${build.dir.tests}">
<include name="**/*Test.class" />
</fileset>
</junit4>
<fail message="Tests failed. See ${tests.report.dir} for report." if="tests.failed" />
</target>
<!--
Code duplication detection.
-->
<path id="pmd.classpath">
<fileset dir="${pmd.home}/lib" includes="*.jar" />
</path>
<target name="pmd.tasks" if="pmd.home">
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.classpath" />
</target>
<target name="duplication"
depends="pmd.tasks"
if="pmd.home"
description="Generates code duplication report">
<mkdir dir="${duplication.report.dir}" />
<cpd minimumTokenCount="100"
outputFile="${duplication.report.dir}/duplication.xml"
format="xml"
encoding="UTF-8">
<fileset dir="${core.dir}">
<include name="**/*.java" />
<exclude name="carrot2-source-microsoft/src/com/microsoft/msnsearch/**" />
</fileset>
<fileset dir="${applications.dir}">
<include name="**/*.java" />
</fileset>
<fileset dir="${workbench.dir}">
<include name="**/*.java" />
</fileset>
</cpd>
<xslt.xinclude in="${duplication.report.dir}/duplication.xml"
style="${etc.dir}/cpd/cpd2html.xsl"
out="${duplication.report.dir}/index.html" />
</target>
<!--
FindBugs static analysis.
-->
<target name="findbugs"
depends="compile.findbugs"
if="findbugs.home"
description="Generates FindBugs report">
<taskdef name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.home}/lib/findbugs-ant.jar" />
<mkdir dir="${findbugs.report.dir}" />
<!-- Delete some classes we don't want to have analyzed -->
<delete>
<fileset dir="${build.dir.findbugs}">
<include name="com/microsoft/msnsearch/**/*.class" />
<include name="**/ExtendedWhitespaceTokenizerImpl.class" />
</fileset>
</delete>
<fileset id="lib.contents" dir="${carrot2.master.basedir}" includes="lib/**/*.jar" />
<property name="lib.jars" refid="lib.contents" />
<findbugs home="${findbugs.home}"
jvmargs="-Xmx512m"
excludeFilter="${etc.dir}/findbugs/excludes.xml"
effort="max"
output="xml:withMessages"
outputFile="${findbugs.report.dir}/findbugs.xml">
<auxClasspath path="${lib.jars}" />
<class location="${build.dir.findbugs}" />
</findbugs>
<xslt.xinclude in="${findbugs.report.dir}/findbugs.xml"
style="${etc.dir}/findbugs/findbugs2html.xsl"
out="${findbugs.report.dir}/index.html" />
</target>
<!--
Code coverage calculation.
-->
<target name="clover.tasks" if="clover.runwith">
<taskdef resource="cloverlib.xml" classpath="${clover.jar}" />
</target>
<target name="coverage.clean" depends="clover.tasks" if="clover.runwith">
<clover-clean />
</target>
<target name="coverage" if="clover.runwith" depends="clover.tasks">
<clover-report>
<current outfile="${coverage.report.dir}" title="Carrot2 ${carrot2.version}">
<format type="html" />
</current>
</clover-report>
<clover-report>
<current outfile="${coverage.report.dir}/coverage.xml" title="Carrot2 ${carrot2.version} Unit Test Coverage Report">
<format type="xml" />
</current>
</clover-report>
</target>
<target name="compile.coverage" depends="clover.tasks" if="clover.runwith">
<clover-setup enabled="true" instrumentationLevel="method">
<fileset refid="src.coverage" />
</clover-setup>
<mkdir dir="${build.dir.clover}" />
<javac destdir="${build.dir.clover}">
<src refid="src.core.folders" />
<classpath refid="lib.classpath" />
</javac>
<javac destdir="${build.dir.clover}">
<src refid="src.test.folders" />
<classpath location="${build.dir.clover}" />
<classpath refid="lib.classpath" />
</javac>
<clover-setup enabled="false" />
</target>
<!--
JavaDoc generation.
-->
<property name="overview.dir" location="${tmp.dir}/javadoc-overview" />
<target name="javadoc" depends="jar, javadoc.overview" description="Generates JavaDocs for all core classes">
<delete dir="${javadoc.dir}" failonerror="false" />
<property name="tmp.src" location="${tmp.dir}/src" />
<mkdir dir="${javadoc.dir}" />
<javadoc destdir="${javadoc.dir}"
access="protected"
version="true"
use="false"
encoding="UTF-8"
docencoding="UTF-8"
includenosourcepackages="true"
windowtitle="Carrot2 v${carrot2.version} API Documentation (JavaDoc)"
doctitle="Carrot&lt;sup&gt;2&lt;/sup&gt; v${carrot2.version} API Documentation"
header="&lt;div class='logo'&gt;Carrot&lt;sup&gt;2&lt;/sup&gt; v${carrot2.version} &lt;br&gt;API Documentation&lt;/div&gt;"
footer="&lt;div class='logo'&gt;Please refer to project documentation at &lt;br&gt;&lt;a target='_top' href=http://project.carrot2.org&gt;http://project.carrot2.org&lt;/a&gt;&lt;/div&gt;"
bottom="&lt;center&gt;Copyright (c) Dawid Weiss, Stanislaw Osinski &lt;/center&gt;&lt;script type=&quot;text/javascript&quot;&gt; var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;); document.write(unescape(&quot;%3Cscript src='&quot; + gaJsHost + &quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E&quot;)); &lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; var pageTracker = _gat._getTracker(&quot;UA-317750-1&quot;); pageTracker._trackPageview(); &lt;/script&gt;"
overview="${overview.dir}/overview.html"
failonerror="true"
stylesheetfile="${etc.dir}/javadoc/stylesheet.css"
useexternalfile="true">
<classpath refid="javadoc.classpath" />
<sourcefiles>
<fileset dir="core">
<include name="**/src/**/*.java" />
<include name="**/src/**/doc-files" />
<exclude name="**/org/carrot2/core/test/**" />
<exclude name="**/com/microsoft/msnsearch/**" />
<exclude name="carrot2-util-text/src/**" />
</fileset>
<fileset dir="${build.dir}">
<include name="**/*.java" />
</fileset>
</sourcefiles>
<!-- Unfortunately this needs to be given explicitly for doc-files to work... -->
<packageset dir="core/carrot2-util-text/src" defaultexcludes="yes">
<include name="org/**"/>
</packageset>
<!-- Oracle only allows browsers (user-agent firewall restriction), so link to the docs, but keep the package-list offline. -->
<link offline="true" href="http://download.oracle.com/javase/6/docs/api/" packagelistLoc="${basedir}/etc/javadoc/jdk6" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Core" packages="org.carrot2.core*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Demos and Examples" packages="org.carrot2.examples*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Data Sources" packages="org.carrot2.source*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Clustering Algorithms" packages="org.carrot2.clustering*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Results post-processing" packages="org.carrot2.output*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Text preprocessing utilities" packages="org.carrot2.text*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Attribute Binding" packages="org.carrot2.util.attribute*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Matrix utilities" packages="org.carrot2.matrix*" />
<group title="Carrot&lt;sup&gt;2&lt;/sup&gt; Utility classes" packages="org.carrot2.util*" />
<tag name="label" enabled="true" scope="types,fields" description="Attribute label:" />
<tag name="level" enabled="true" scope="fields" description="Attribute level:" />
<tag name="group" enabled="true" scope="fields" description="Attribute group:" />
<arg value="-quiet" />
</javadoc>
<copy todir="${javadoc.dir}">
<fileset dir="${etc.dir}/javadoc/">
<include name="*.gif" />
<include name="*.png" />
<include name="sh/*" />
</fileset>
</copy>
<jar destfile="${jar.dir}/carrot2-core-javadoc-${carrot2.version}.jar">
<fileset dir="${javadoc.dir}" />
</jar>
</target>
<target name="javadoc.overview" depends="version,carrot2.common.antlib.tasks">
<mkdir dir="${overview.dir}" />
<taskdef name="extractor" classname="com.carrotsearch.ant.snippets.SnippetExtractorTask">
<classpath>
<path location="${ant.home}/lib/ant.jar" />
<fileset dir="${etc.dir}/extractor">
<include name="**/*.jar" />
</fileset>
</classpath>
</taskdef>
<extractor outputdir="${overview.dir}/snippets">
<fileset dir="${applications.dir}/carrot2-examples/examples">
<include name="**/*.java" />
</fileset>
</extractor>
<copy file="${etc.dir}/javadoc/overview.xsl" todir="${overview.dir}" />
<echoxml file="${overview.dir}/dummy.xml">
<dummy />
</echoxml>
<xslt.xinclude style="${overview.dir}/overview.xsl"
in="${overview.dir}/dummy.xml"
out="${overview.dir}/overview.html"
force="true">
<param name="git.verhash" expression="${git.verhash}" />
</xslt.xinclude>
</target>
<target name="version" description="Prints version number.">
<exec executable="git" dir="${carrot2.master.basedir}"
outputproperty="git.verhash"
failonerror="false"
failifexecutionfails="false"
vmlauncher="false">
<arg line="log -1 --pretty=format:%H" />
</exec>
<!-- Fallback to empty? -->
<property name="git.verhash" value="" />
<print-versions prefix="carrot2" />
<echo>Git version: ${git.verhash}</echo>
</target>
<!--
Build core JAR.
-->
<target name="jar" description="Builds Carrot2 core JAR" depends="compile, resources">
<mkdir dir="${jar.dir}" />
<jar destfile="${jar.dir}/carrot2-core-${carrot2.version}.jar">
<fileset dir="${build.dir}">
<exclude name="ambient/**" />
<exclude name="odp239/**" />
<exclude name="org.carrot2.util.attribute*.xml" />
<exclude name="**/*.html" />
<exclude name="**/doc-files/**" />
<exclude name="**/*.java" />
</fileset>
</jar>
</target>
<target name="jar.src">
<copy todir="${jar.dir}/sources" overwrite="true">
<fileset dir="${core.dir}" includes="**/src/**/*.java" />
<chainedmapper>
<filtermapper><replacestring from="\" to="/"/></filtermapper>
<mapper type="regexp" from="^(.+)/src/(.+)" to="\2"/>
</chainedmapper>
</copy>
<jar destfile="${jar.dir}/carrot2-core-sources-${carrot2.version}.jar">
<fileset dir="${jar.dir}/sources" />
<fileset dir="${build.dir}">
<include name="**/*.java" />
</fileset>
</jar>
<jar destfile="${jar.dir}/carrot2-mini-sources-${carrot2.version}.jar">
<fileset dir="${jar.dir}/sources">
<selector id="mini.sources">
<and>
<filename name="**/*.java" />
<or>
<none>
<filename name="org/carrot2/source/**"/>
<filename name="com/**" />
<filename name="org/carrot2/output/**" />
</none>
<filename name="org/carrot2/source/xml/**"/>
</or>
</and>
</selector>
</fileset>
<fileset dir="${build.dir}">
<selector refid="mini.sources" />
</fileset>
</jar>
</target>
<!--
Carrot2 mini JAR, just core and algorithms. No extended support for Chinese and Arabic.
-->
<target name="jar.mini" depends="jar.mini.test" />
<target name="jar.mini.build" depends="jar">
<jar destfile="${jar.dir}/carrot2-mini-${carrot2.version}.jar">
<!-- selectors don't seem to work with zipfileset -->
<zipfileset src="${jar.dir}/carrot2-core-${carrot2.version}.jar">
<exclude name="org/carrot2/source/**" />
<exclude name="com/**" />
<exclude name="org/carrot2/output/**" />
</zipfileset>
<zipfileset src="${jar.dir}/carrot2-core-${carrot2.version}.jar">
<include name="org/carrot2/source/xml/**" />
</zipfileset>
</jar>
<delete dir="${jar.mini.dir}" />
</target>
<!-- Check if the basic clustering example runs with the mini distribution -->
<target name="jar.mini.test" depends="jar.mini.build">
<property name="jar.mini.test.classes.dir" location="${tmp.dir}/jar-mini-classes" />
<mkdir dir="${jar.mini.test.classes.dir}" />
<javac srcdir="${carrot2.master.basedir}/applications/carrot2-examples/examples"
destdir="${jar.mini.test.classes.dir}"
compiler="modern">
<include name="**/ClusteringDocumentList.java" />
<classpath>
<path location="${jar.dir}/carrot2-mini-${carrot2.version}.jar" />
<fileset dir="${carrot2.master.basedir}">
<patternset refid="lib.core.mini" />
<exclude name="**/*.LICENSE" />
<!--
We add SimpleXML only to stop compiler from complaining about missing
annotation definitions. SimpleXML is not required to run basic clustering.
-->
<include name="**/simple-xml*.jar" />
</fileset>
</classpath>
</javac>
<java classname="org.carrot2.examples.clustering.ClusteringDocumentList"
outputproperty="dev.null" failonerror="true">
<classpath>
<pathelement path="${jar.mini.test.classes.dir}" />
<pathelement location="${jar.dir}/carrot2-mini-${carrot2.version}.jar" />
<fileset dir="${carrot2.master.basedir}">
<patternset refid="lib.core.mini" />
<exclude name="**/*.LICENSE" />
</fileset>
</classpath>
</java>
<delete dir="${jar.mini.test.classes.dir}" />
</target>
<target name="clean.jar">
<delete dir="${jar.dir}" failonerror="false" />
</target>
<!--
Builds API distribution: core JAR, dependencies, example source code.
-->
<target name="core" depends="jar, jar.src, lib-no-jar.flattened" description="Builds Carrot2 Java API JAR with dependencies">
<delete dir="${api.dir}" failonerror="false" />
<mkdir dir="${api.dir}" />
<mkdir dir="${api.dir}/lib" />
<mkdir dir="${api.dir}/examples" />
<mkdir dir="${api.dir}/resources" />
<patternset id="carrot2.required">
<include name="**/commons-lang*" />
<include name="**/ehcache*" />
<include name="**/guava*" />
<include name="**/hppc*" />
<include name="**/jackson*" />
<include name="**/log4j*" />
<include name="**/lucene-analyzers*" />
<include name="**/simple-xml*" />
<include name="**/slf4j*" />
<exclude name="**/slf4j-nop*" />
<include name="**/mahout*" />
<include name="**/colt.LICENSE" />
</patternset>
<patternset id="carrot2.optional">
<include name="**/morfologik-*" />
<include name="**/commons-codec*" />
<include name="org.apache.http/http*" />
<include name="**/jcl-over-slf4j*" />
<include name="**/jdom*" />
<include name="**/lucene*" />
<exclude name="**/lucene-analyzers*" />
<include name="**/rome*" />
</patternset>
<copy todir="${api.dir}/lib/required">
<fileset dir="${lib.dir}">
<patternset refid="carrot2.required" />
</fileset>
<fileset dir="${jar.dir}">
<include name="carrot2-core-${carrot2.version}.jar" />
</fileset>
<mapper type="flatten" />
</copy>
<copy todir="${api.dir}/lib/optional">
<fileset dir="${lib.dir}">
<patternset refid="carrot2.optional" />
</fileset>
<mapper type="flatten" />
</copy>
<copy todir="${api.dir}" filtering="true" encoding="UTF-8">
<fileset dir="${carrot2.master.basedir}">
<include name="carrot2.LICENSE" />
<include name="carrot2.CONTRIBUTORS" />
</fileset>
<fileset dir="${carrot2.master.basedir}/core/carrot2-component-suites">
<include name="suites/suite-examples.xml" />
<include name="suites/source-bing*.xml" />
<include name="suites/algorithm-lingo*.xml" />
<include name="suites/algorithm-stc*.xml" />
<include name="suites/algorithm-kmeans*.xml" />
</fileset>
<fileset dir="${carrot2.master.basedir}/applications/carrot2-examples/">
<include name="pom.xml" />
</fileset>
<filterchain>
<replacestring from="@carrot2.version.maven@" to="${carrot2.version.maven}" />
</filterchain>
</copy>
<copy todir="${api.dir}/resources">
<fileset dir="${carrot2.master.basedir}/core/carrot2-util-text/src-resources" />
</copy>
<copy todir="${api.dir}/examples">
<fileset dir="${carrot2.master.basedir}/applications/carrot2-examples/examples" />
</copy>
<copy todir="${api.dir}" file="${carrot2.master.basedir}/applications/carrot2-examples/build.xml" />
<carrot2.readme readme.src="${carrot2.master.basedir}/applications/carrot2-examples/etc/readme.txt"
readme.dest="${api.dir}/readme.txt" />
</target>
<target name="carrot2.core.dist" depends="core.test, javadoc">
<zip destfile="${api.dir}/../${api.dist.base}-${carrot2.version}.zip">
<zipfileset dir="${api.dir}" prefix="${api.dist.base}-${carrot2.version}">
<exclude name="tmp/**" />
<exclude name="index/**" />
</zipfileset>
<zipfileset dir="${javadoc.dir}" prefix="${api.dist.base}-${carrot2.version}/javadoc" />
</zip>
</target>
<target name="core.test" depends="core">
<ant antfile="build.xml" dir="${api.dir}" inheritall="false" />
</target>
<!--
Distribution build.
-->
<target name="dist" depends="
clean,
version,
test,
carrot2.core.dist,
carrot2.cli.dist,
carrot2.webapp.dist,
carrot2.dcs.dist,
workbench.dist,
maven,
reports,
javadoc,
doc,
carrot2.solr.dist,
assemble.dist" description="Builds Carrot2 distribution (requires external tools)." />
<target name="assemble.dist" depends="version">
<echo>Assemble distribution.</echo>
<delete dir="${dist.dir}" failonerror="false" />
<mkdir dir="${dist.dir}/${carrot2.version}" />
<copy todir="${dist.dir}/${carrot2.version}">
<fileset dir="${tmp.dir}">
<include name="javadoc/**" />
<include name="manual/**" />
<include name="jar/*.jar" />
<include name="carrot2-cli-${carrot2.version}.zip" />
<include name="carrot2-dcs-${carrot2.version}.zip" />
<include name="carrot2-java-api-${carrot2.version}.zip" />
<include name="carrot2-manual-${carrot2.version}.zip" />
<include name="carrot2-webapp-${carrot2.version}.war" />
<include name="carrot2-workbench-*.zip" />
<include name="carrot2-solr-*.zip" />
</fileset>
</copy>
</target>
<target name="reports" depends="test, coverage, duplication, findbugs, compatibility" description="Builds all Carrot2 test and code quality reports" />
<target name="webapp" depends="carrot2.webapp.build" description="Builds Carrot2 web application" />
<target name="dcs" depends="carrot2.dcs.build" description="Builds Carrot2 Document Clustering Server" />
<target name="cli" depends="carrot2.cli.build" description="Builds Carrot2 Command Line Interface" />
<!--
Maven artefacts.
-->
<target name="maven" depends="antlib, jar, jar.src, javadoc, jar.mini, core.test, carrot2.maven.install" description="Install Maven artifacts">
<!-- Try to compile the examples using maven. -->
<exec executable="mvn" failonerror="true" vmlauncher="false" dir="${api.dir}">
<arg line="clean integration-test -Prun" />
</exec>
</target>
<!--
Deploy Maven artefacts to SonaType (requires proper sonatype server config in ~/.m2/settings.xml!).
-->
<target name="maven.deploy" depends="maven, carrot2.maven.deploy" description="Stages Maven release (SonaType)">
</target>
<!--
Deploy Maven artefacts to SonaType (requires proper sonatype server config in ~/.m2/settings.xml!).
-->
<target name="maven.snapshot" depends="maven, carrot2.maven.snapshot" description="Pushes Maven snapshot (SonaType)">
</target>
<!--
Builds the manual.
-->
<target name="doc" depends="carrot2.doc.build, carrot2.doc.dist" description="Builds Carrot2 Manual">
</target>
<!--
Flattened lib directory.
-->
<target name="lib-no-jar.flattened" depends="clean.lib">
<mkdir dir="${lib.flattened}" />
<copy todir="${lib.flattened}">
<fileset refid="lib.core.files" />
<fileset dir="${carrot2.master.basedir}">
<patternset refid="licenses.core" />
</fileset>
<mapper type="flatten"/>
</copy>
</target>
<target name="lib.flattened" depends="lib-no-jar.flattened, jar">
<copy todir="${lib.flattened}">
<fileset dir="${jar.dir}">
<include name="carrot2-core-${carrot2.version}.jar" />
</fileset>
<fileset dir="${carrot2.master.basedir}">
<include name="carrot2.LICENSE" />
</fileset>
</copy>
</target>
<target name="clean.lib">
<delete dir="${lib.flattened}" failonerror="false" />
</target>
<!--
Compile and define custom ANT tasks.
-->
<target name="antlib" depends="carrot2.common.antlib.tasks" />
<!--
Workbench compilation section.
-->
<target name="workbench.plugins.gather" depends="carrot2.common.antlib.tasks, pde.build.prepare">
<patternset id="temporary.files">
<exclude name="**/tmp/**" />
<exclude name="**/.clover/**" />
<exclude name="**/build-conf/**" />
</patternset>
<!-- Copy source plugins and features to the build folder. -->
<copy todir="${workbench.build.dir}/plugins">
<fileset dir="${carrot2.master.basedir}">
<include name="core/**" />
<include name="lib/**" />
<include name="workbench/**" />
<patternset refid="temporary.files" />
</fileset>
<regexpmapper from="[^/]+/(.*)" to="\1" handledirsep="yes" />
</copy>
<copy todir="${workbench.build.dir}/plugins" overwrite="true" filtering="true" encoding="UTF-8">
<fileset dir="${carrot2.master.basedir}">
<include name="core/**/MANIFEST.MF" />
<include name="lib/**/MANIFEST.MF" />
<include name="workbench/**/MANIFEST.MF" />
<include name="workbench/**/welcome/**/*.html" />
<patternset refid="temporary.files" />
</fileset>
<regexpmapper from="[^/]+/(.*)" to="\1" handledirsep="yes" />
<filterchain id="workbench.version.filterchain">
<replacestring from="0.0.0.QUALIFIER" to="${carrot2.version.workbench}"/>
<replacestring from="@carrot2.version@" to="${carrot2.version}" />
</filterchain>
</copy>
<!-- Prepare verbose build info. -->
<carrot2.readme readme.src="${carrot2.master.basedir}/workbench/org.carrot2.workbench.feature/readme.txt"
readme.dest="${workbench.build.dir}/static/readme.txt" />
<pathconvert property="pde.pluginPath">
<path>
<pathelement location="${workbench.build.dir}/plugins/" />
</path>
</pathconvert>
</target>
<target name="workbench" depends="workbench.rcp.defaults, workbench.plugins.gather" description="Compile Workbench (folder).">
<pde.build
build.dir="${workbench.build.dir}/build"
extra.args="
-Dproduct=/org.carrot2.workbench.feature/Workbench.product
-DjavacSource=1.6
-DjavacTarget=1.6
-Dconfigs=${rcp.os},${rcp.ws},${rcp.arch}
-DarchivesFormat=${rcp.os},${rcp.ws},${rcp.arch}-folder
-DarchivePrefix=${carrot2.workbench.base}-${carrot2.version}
-DbuildId=${carrot2.workbench.base}
-DbuildType=I
-DpluginPath='${pde.pluginPath}'
-Dcarrot2.version=${carrot2.version}
-Dcarrot2.workbench.base=${carrot2.workbench.base}
-Dworkbench.static=${workbench.build.dir}/static
-Dworkbench.build.dir=${workbench.build.dir}
" />
</target>
<target name="workbench.dist" depends="workbench.plugins.gather" description="Compile Workbench (ZIPs).">
<property name="workbench.dist.dir" location="${tmp.dir}" />
<property file="${carrot2.master.basedir}/etc/buildinfo/workbench-platforms.properties" />
<echo>${configs}</echo>
<pde.build
build.dir="${workbench.build.dir}/build"
extra.args="
-Dproduct=/org.carrot2.workbench.feature/Workbench.product
-DjavacSource=1.6
-DjavacTarget=1.6
-DarchivePrefix=${carrot2.workbench.base}-${carrot2.version}
-DbuildId=${carrot2.workbench.base}
-DbuildType=S
-Dconfigs='${configs}'
-DarchivesFormat='${archivesFormat}'
-Dtarget.platform=${target.platform}
-Declipse.home=${eclipse.home}
-DpluginPath='${pde.pluginPath}'
-Dcarrot2.version=${carrot2.version}
-Dcarrot2.workbench.base=${carrot2.workbench.base}
-Dworkbench.static=${workbench.build.dir}/static
-Dworkbench.build.dir=${workbench.build.dir}
" />
<mkdir dir="${workbench.dist.dir}" />
<copy todir="${workbench.dist.dir}" overwrite="true">
<fileset dir="${workbench.build.dir}/build">
<include name="S.*/*.zip" />
</fileset>
<chainedmapper>
<mapper type="flatten" />
<mapper type="glob" from="*.zip" to="*-${carrot2.version}.zip"/>
</chainedmapper>
</copy>
</target>
<target name="workbench.rcp.defaults">
<rcp-defaults />
</target>
<target name="workbench.test" depends="workbench.rcp.defaults, workbench.plugins.gather" description="Run Workbench tests.">
<pde.build
build.dir="${workbench.build.dir}/test"
extra.args="
-Dproduct=/org.carrot2.workbench.feature/Workbench.product
-DfeatureList=org.carrot2.workbench.core.test.feature
-DjavacSource=1.6
-DjavacTarget=1.6
-Dconfigs=${rcp.os},${rcp.ws},${rcp.arch}
-DarchivesFormat=${rcp.os},${rcp.ws},${rcp.arch}-folder
-DarchivePrefix=${carrot2.workbench.base}-${carrot2.version}
-DbuildId=${carrot2.workbench.base}
-DbuildType=T
-DpluginPath='${pde.pluginPath}'
-Dcarrot2.version=${carrot2.version}
-Dcarrot2.workbench.base=${carrot2.workbench.base}
-Dworkbench.static=${workbench.build.dir}/static
-Dworkbench.build.dir=${workbench.build.dir}
" />
<pathconvert property="test.buildfile.location">
<path>
<fileset dir="${workbench.build.dir}/test/tmp/"
includes="**/org.carrot2.workbench.core.test*/test.xml" />
</path>
</pathconvert>
<property name="workbench.test.home"
location="${workbench.build.dir}/test/tmp/${carrot2.workbench.base}-${carrot2.version}" />
<findVersion property="eclipse.test.plugin"
eclipsehome="${workbench.test.home}"
pluginid="org.eclipse.test"
pluginform="dir" />
<property name="library-file"
location="${workbench.test.home}/plugins/${eclipse.test.plugin}/library.xml" />
<!-- For some reason we must run the tests via Equinox (and sub-ANT). To investigate later. -->
<delete dir="${workbench.test.home}/junit.results" />
<java jar="${eclipse.home}/plugins/${equinox.launcher.plugin.jar}" fork="true" failonerror="true">
<arg line="-application org.eclipse.ant.core.antRunner" />
<arg line="-buildfile ${test.buildfile.location}" />
<arg line="-Declipse-home=${workbench.test.home}" />
<arg line="-Dlibrary.xml.location=${library-file}" />
<arg line="-Dos=${rcp.os} -Dws=${rcp.ws} -Darch=${rcp.arch}" />
</java>
<property name="workbench.tests.html.report.dir" location="${workbench.build.dir}/test-report" />
<mkdir dir="${workbench.tests.html.report.dir}" />
<!-- Collect the results and render the report. -->
<junitreport todir="${workbench.tests.html.report.dir}">
<fileset dir="${workbench.test.home}">
<include name="*.xml" />
</fileset>
<report format="frames"
todir="${workbench.tests.html.report.dir}" />
</junitreport>
<!--
A hacky way of finding out whether tests passed. The Eclipse runner doesn't
seem to expose this information directly.
-->
<loadfile property="workbench.test.results"
srcFile="${workbench.tests.html.report.dir}/TESTS-TestSuites.xml" />
<fail message="Tests failed, see ${workbench.tests.html.report.dir} for report.">
<condition>
<matches string="${workbench.test.results}" pattern="(failures|errors)=.[1-9][0-9]*" />
</condition>
</fail>
<fail message="Tests did not run, see ${workbench.tests.txt.report.dir} for logs.">
<condition>
<matches string="${workbench.test.results}" pattern="testsuites />" />
</condition>
</fail>
</target>
<!--
Compilation and assembly of static utility JARs (apt preprocessors).
-->
<target name="utility.jars" description="Re(create) utility JARs.">
<property name="utilities.build.dir" location="${tmp.dir}/utility.jars" />
<delete dir="${utilities.build.dir}" failonerror="false" />
<mkdir dir="${utilities.build.dir}" />
<javac destdir="${utilities.build.dir}" compiler="modern">
<src location="${carrot2.master.basedir}/core/carrot2-util-attribute/src" />
<src location="${carrot2.master.basedir}/core/carrot2-util-attribute/src-apt" />
<include name="org/carrot2/util/attribute/metadata/**" />
<include name="org/carrot2/util/attribute/Bindable.java" />
<include name="org/carrot2/util/attribute/Attribute.java" />
<include name="org/carrot2/util/attribute/AttributeLevel.java" />
<classpath id="utility.classpath">
<fileset dir="${carrot2.master.basedir}" id="utility.jars.fileset">
<include name="lib/org.apache.commons/commons-lang-*.jar" />
<include name="lib/org.apache.commons/commons-collections-*.jar" />
<include name="lib/org.apache.oro/oro-*.jar" />
<include name="lib/com.thoughtworks.qdox/*.jar" />
<include name="lib/org.apache.velocity/velocity-*.jar" />
<include name="lib/org.simpleframework.xml/*.jar" />
</fileset>
</classpath>
</javac>
<pathconvert property="utility.manifest.classpath" pathsep=" " dirsep="/">
<fileset refid="utility.jars.fileset" />
<mapper>
<chainedmapper>
<filtermapper><replacestring
from="${carrot2.master.basedir}"
to="../../.."/></filtermapper>
</chainedmapper>
</mapper>
</pathconvert>
<jar destfile="${carrot2.master.basedir}/core/carrot2-util-attribute/.apt_factory/org.carrot2.bindables.jar">
<fileset dir="${utilities.build.dir}" />
<fileset dir="${carrot2.master.basedir}/core/carrot2-util-attribute/src-apt" excludes="**/*.java" />
<service type="javax.annotation.processing.Processor" provider="org.carrot2.util.attribute.metadata.BindableProcessor" />
<manifest>
<attribute name="Class-Path" value="${utility.manifest.classpath}" />
</manifest>
</jar>
<delete dir="${utilities.build.dir}" failonerror="false" />
</target>
<!--
Source code management: license headers list and replace.
-->
<target name="license.tasks" depends="antlib">
<property name="verbose" value="false" />
<fileset dir="." id="licensed.sources">
<include name="applications/**/*.java" />
<include name="workbench/**/*.java" />
<include name="core/**/*.java" />
<include name="lib/org.carrot2.antlib/**/*.java" />
<exclude name="**/tmp/**" />
</fileset>
</target>
<target name="licenses.update" depends="license.tasks">
<loadfile encoding="UTF-8" property="carrot2.license" srcfile="etc/sources/header.txt" />
<loadfile encoding="UTF-8" property="carrot2.generated.code" srcfile="etc/sources/header-generated.txt" />
<licenseReplace encoding="UTF-8" saveExtension="">
<fileset refid="licensed.sources" />
<!-- Order matters: first come, first served. -->
<header contains="http://www.carrot2.org/carrot2.LICENSE" replacement="${carrot2.license}" />
<!-- Replace generated headers with a simple statement -->
<header contains="${carrot2.generated.code}" replacement="${carrot2.generated.code}" />
<header contains="following code was generated by JFlex" replacement="${carrot2.generated.code}" />
<header contains="Generated By:JavaCC" replacement="${carrot2.generated.code}" />
<header contains="This file was auto-generated from WSDL" replacement="${carrot2.generated.code}" />
<!-- Replace empty headers with C2 license -->
<header isempty="true" replacement="${carrot2.license}" />
</licenseReplace>
<antcall target="licenses.list" />
</target>
<target name="licenses.list" depends="license.tasks">
<licenseList header="true" footer="true" encoding="UTF-8" verbose="${verbose}">
<fileset refid="licensed.sources" />
</licenseList>
</target>
<target name="fix-line-endings">
<patternset id="fix-line-endings-text-files">
<include name="**/*.js" />
<include name="**/*.css" />
<include name="**/*.java" />
<include name="**/*.xml" />
</patternset>
<patternset id="fix-line-endings-excludes">
<exclude name="**/*.utf16.xml" />
<exclude name="**/tmp/**" />
<exclude name="**/.git/**" />
</patternset>
<patternset id="fix-line-endings-unix">
<exclude name="**/*.cmd" />
<exclude name="**/*.bat" />
<exclude name="**/csharp/**" />
</patternset>
<fixcrlf srcdir="." eol="unix" encoding="UTF-8">
<patternset refid="fix-line-endings-excludes" />
<patternset refid="fix-line-endings-text-files" />
<patternset refid="fix-line-endings-unix" />
</fixcrlf>
<fixcrlf srcdir="." eol="dos" encoding="UTF-8">
<patternset refid="fix-line-endings-excludes" />
<include name="**/*.cmd" />
<include name="**/*.bat" />
</fixcrlf>
</target>
<!--
Generate development files for Eclipse.
-->
<target name="eclipse" depends="carrot2.webapp.eclipse.setup" description="Generate Eclipse files for development." />
<!--
Pre-commit check for developers
-->
<target name="precommit" depends="clean, test, jar.mini.test" />
<!--
Pre-release source code updates.
-->
<target name="prerelease" depends="licenses.update, fix-line-endings" />
</project>