代码拉取完成,页面将自动刷新
<!--
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<sup>2</sup> v${carrot2.version} API Documentation"
header="<div class='logo'>Carrot<sup>2</sup> v${carrot2.version} <br>API Documentation</div>"
footer="<div class='logo'>Please refer to project documentation at <br><a target='_top' href=http://project.carrot2.org>http://project.carrot2.org</a></div>"
bottom="<center>Copyright (c) Dawid Weiss, Stanislaw Osinski </center><script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-317750-1"); pageTracker._trackPageview(); </script>"
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<sup>2</sup> Core" packages="org.carrot2.core*" />
<group title="Carrot<sup>2</sup> Demos and Examples" packages="org.carrot2.examples*" />
<group title="Carrot<sup>2</sup> Data Sources" packages="org.carrot2.source*" />
<group title="Carrot<sup>2</sup> Clustering Algorithms" packages="org.carrot2.clustering*" />
<group title="Carrot<sup>2</sup> Results post-processing" packages="org.carrot2.output*" />
<group title="Carrot<sup>2</sup> Text preprocessing utilities" packages="org.carrot2.text*" />
<group title="Carrot<sup>2</sup> Attribute Binding" packages="org.carrot2.util.attribute*" />
<group title="Carrot<sup>2</sup> Matrix utilities" packages="org.carrot2.matrix*" />
<group title="Carrot<sup>2</sup> 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>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。