2 Star 0 Fork 0

mirrors_arnaudsj/carrot2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
build.xml 44.59 KB
一键复制 编辑 原始数据 按行查看 历史
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171
<!--
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}"/>
<!-- 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" />
<!-- Import local properties and version -->
<property file="${carrot2.master.basedir}/local.properties" />
<property file="${carrot2.master.basedir}/etc/version/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}/lib/org.carrot2.antlib/build.xml" />
<import file="${carrot2.master.basedir}/etc/ant/common/readme.xml" />
<import file="${carrot2.master.basedir}/workbench/build-conf/build.xml" />
<!-- 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" />
<!-- 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" />
<!-- Java API distribution -->
<property name="api.dist.base" value="${carrot2.java-api.base}" />
<!-- Extra tools the build can use if available -->
<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" />
<!-- Workbench properties. Define default location and load presets. -->
<property name="workbench.properties" location="${carrot2.master.basedir}/workbench.properties" />
<property file="${workbench.properties}" />
<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" />
<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>
<!--
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="external.api.tests.disabled" />
<exclude name="**/carrot2-source-etools/**/*.java" if="external.api.tests.disabled" />
<exclude name="**/carrot2-source-google/**/*.java" if="external.api.tests.disabled" />
<exclude name="**/carrot2-source-yahoo/**/*.java" unless="yahooapi.tests.enabled" />
<exclude name="**/carrot2-source-boss/**/*.java" if="external.api.tests.disabled" />
<exclude name="**/carrot2-source-microsoft/**/*.java" if="external.api.tests.disabled" />
<exclude name="**/carrot2-source-opensearch/**/*.java" if="external.api.tests.disabled" />
<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/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/com.planetj.compression/**" />
<exclude name="lib/org.mortbay.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-core*" />
<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>
<!--
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>
<!--
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/**" />
<include name="**/suites/**" />
<exclude name="**/*.java" />
<exclude name="**/*.clover" />
<exclude name="**/carrot2-util-log4j/**" />
</fileset>
<regexpmapper from="^.*src(-resources)?(.*)$$" to="\2" />
</copy>
<copy todir="${build.dir}" includeemptydirs="false">
<fileset dir="${core.dir}/carrot2-component-suites/suites" />
</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.">
<mkdir dir="${tests.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>
<junit fork="true"
forkmode="once"
printsummary="on"
errorproperty="junit.error"
failureproperty="junit.failure">
<jvmarg value="-Djava.library.path=${nni.native.library.path}" />
<jvmarg value="-ea" />
<formatter type="xml" />
<classpath refid="test.classpath" />
<sysproperty key="external.api.tests.disabled" value="${external.api.tests.disabled}" />
<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" />
<batchtest todir="${tests.report.dir}">
<fileset dir="${build.dir.tests}">
<include name="**/*Test.class" />
<exclude name="**/OpenSearchDocumentSourceByPageIncrementTest.class"
unless="icerocket.tests.enabled" />
<exclude name="org/carrot2/source/yahoo/*Test.class"
unless="yahooapi.tests.enabled" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${tests.report.dir}">
<fileset dir="${tests.report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${tests.report.dir}" />
</junitreport>
<condition property="tests.failed" value="true">
<or>
<isset property="junit.error" />
<isset property="junit.failure" />
</or>
</condition>
<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 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 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.home">
<taskdef resource="cloverlib.xml" classpath="${clover.jar}" />
</target>
<target name="coverage.clean" depends="clover.tasks" if="clover.home">
<clover-clean />
</target>
<target name="coverage" if="clover.home" 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.home">
<clover-setup enabled="true">
<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="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/src">
<include name="**/*.java" />
</fileset>
</extractor>
<setProperty sysproperty="org.apache.xerces.xni.parser.XMLParserConfiguration" value="org.apache.xerces.parsers.XIncludeParserConfiguration" />
<copy file="${etc.dir}/javadoc/overview.xsl" todir="${overview.dir}" />
<echoxml file="${overview.dir}/dummy.xml">
<dummy />
</echoxml>
<xslt style="${overview.dir}/overview.xsl"
in="${overview.dir}/dummy.xml"
out="${overview.dir}/overview.html"
force="true" />
</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/src"
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" />
<copy todir="${api.dir}/lib">
<fileset dir="${lib.flattened}" />
<fileset dir="${carrot2.master.basedir}">
<include name="lib/org.apache.xml/*.jar" />
<include name="lib/org.apache.xml/*.LICENSE" />
</fileset>
<mapper type="flatten" />
</copy>
<copy todir="${api.dir}">
<fileset dir="${jar.dir}">
<include name="carrot2-core-${carrot2.version}.jar" />
</fileset>
<fileset dir="${carrot2.master.basedir}">
<include name="carrot2.LICENSE" />
<include name="carrot2.CONTRIBUTORS" />
</fileset>
</copy>
<copy todir="${api.dir}/examples">
<fileset dir="${carrot2.master.basedir}/applications/carrot2-examples/src" />
<fileset dir="${carrot2.master.basedir}/core/carrot2-component-suites/suites">
<include name="suites/suite-examples.xml" />
<include name="suites/source-microsoft-live*.xml" />
<include name="suites/algorithm-lingo*.xml" />
<include name="suites/algorithm-stc*.xml" />
</fileset>
</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>
<delete dir="${api.dir}" failonerror="false" />
</target>
<target name="core.test" depends="core">
<ant antfile="build.xml" dir="${api.dir}" inheritall="false" />
</target>
<!--
Build all apps.
-->
<target name="all" depends="clean, webapp, dcs, javadoc, doc" description="Builds all Carrot2 applications and documentation" />
<target name="dist" depends="carrot2.core.dist, carrot2.cli.dist, carrot2.webapp.dist, carrot2.dcs.dist, javadoc, maven, doc" description="Builds Carrot2 distribution files" />
<target name="reports" depends="test, coverage, duplication, findbugs" 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, carrot2.maven.install" description="Install Maven artifacts">
</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="Deploy Maven artifacts to 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="**/.svn/**" />
<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}"/>
<!-- Should we keep all these token values in one place somewhere? -->
<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.plugins.gather" description="Compile Workbench (folder).">
<pde.build
build.dir="${workbench.build.dir}/build"
props.file="${workbench.properties}"
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=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).">
<fail unless="dist.dir">Define: dist.dir property.</fail>
<pde.build
build.dir="${workbench.build.dir}/build"
props.file="${carrot2.master.basedir}/etc/buildinfo/workbench-platforms.properties"
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
-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="${dist.dir}" />
<copy todir="${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.test" depends="workbench.plugins.gather" description="Run Workbench tests.">
<fail unless="test.os" />
<fail unless="test.ws" />
<fail unless="test.arch" />
<pde.build
build.dir="${workbench.build.dir}/test"
props.file="${workbench.properties}"
extra.args="
-Dproduct=/org.carrot2.workbench.feature/Workbench.product
-DfeatureList=org.carrot2.workbench.core.test.feature
-DjavacSource=1.6
-DjavacTarget=1.6
-Dconfigs=${test.os},${test.ws},${test.arch}
-DarchivesFormat=${test.os},${test.ws},${test.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=${test.os} -Dws=${test.ws} -Darch=${test.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/**" />
<exclude name="**/.svn/**" />
</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>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_arnaudsj/carrot2.git
git@gitee.com:mirrors_arnaudsj/carrot2.git
mirrors_arnaudsj
carrot2
carrot2
master

搜索帮助