mirror of https://github.com/apache/lucene.git
LUCENE-4217: Add the possibility to run tests with Atlassian Clover loaded from IVY. A development License solely for Apache code was added in the tools/ folder, but is not included in releases
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1361480 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0b5eaa8b68
commit
c0d02bc3c8
|
@ -75,6 +75,10 @@ Build
|
|||
charset, default locale, or default timezone and fail build if violations
|
||||
found. This ensures, that Lucene / Solr is independent on local configuration
|
||||
options. (Uwe Schindler, Robert Muir, Dawid Weiss)
|
||||
|
||||
* LUCENE-4217: Add the possibility to run tests with Atlassian Clover
|
||||
loaded from IVY. A development License solely for Apache code was added in
|
||||
the tools/ folder, but is not included in releases. (Uwe Schindler)
|
||||
|
||||
Documentation
|
||||
|
||||
|
|
|
@ -143,13 +143,9 @@
|
|||
<!--
|
||||
Run after Junit tests.
|
||||
-->
|
||||
<target name="generate-clover-reports" depends="clover.check, clover">
|
||||
<target name="generate-clover-reports" depends="clover">
|
||||
<fail unless="run.clover">Clover not enabled!</fail>
|
||||
<mkdir dir="${clover.report.dir}"/>
|
||||
<fileset dir="." id="clover.test.src.files">
|
||||
<include name="**/src/test/**/*.java"/>
|
||||
<include name="test-framework/src/java/**/*.java"/>
|
||||
<exclude name="lucene/backwards/**"/>
|
||||
</fileset>
|
||||
<fileset dir="build" id="clover.test.result.files">
|
||||
<include name="**/test/TEST-*.xml"/>
|
||||
<!-- do not include BW tests -->
|
||||
|
@ -158,12 +154,10 @@
|
|||
<clover-report>
|
||||
<current outfile="${clover.report.dir}" title="${final.name}" numThreads="0">
|
||||
<format type="html" filter="assert"/>
|
||||
<testsources refid="clover.test.src.files"/>
|
||||
<testresults refid="clover.test.result.files"/>
|
||||
</current>
|
||||
<current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
|
||||
<format type="xml" filter="assert"/>
|
||||
<testsources refid="clover.test.src.files"/>
|
||||
<testresults refid="clover.test.result.files"/>
|
||||
</current>
|
||||
</clover-report>
|
||||
|
@ -418,6 +412,8 @@
|
|||
|
||||
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
|
||||
<delete dir="${svn.export.dir}/tools/javadoc/java6"/>
|
||||
<!-- Exclude clover license files incompatible with the ASL -->
|
||||
<delete dir="${svn.export.dir}/tools/clover"/>
|
||||
|
||||
<build-changes changes.src.dir="${svn.export.dir}/site/changes"
|
||||
changes.target.dir="${svn.export.dir}/docs/changes"/>
|
||||
|
|
|
@ -124,9 +124,6 @@
|
|||
<property name="javac.target" value="1.6"/>
|
||||
<property name="javac.source.backwards" value="1.6"/>
|
||||
<property name="javac.target.backwards" value="1.6"/>
|
||||
<!-- clover wants to run with -lib, otherwise we prefer a repeatable
|
||||
classpath -->
|
||||
<property name="javac.includeAntRuntime" value="${run.clover}"/>
|
||||
<property name="javac.args" value="-Xlint -Xlint:-deprecation -Xlint:-serial"/>
|
||||
<property name="bootclasspath" value=""/>
|
||||
<property name="javadoc.link" value="http://download.oracle.com/javase/6/docs/api/"/>
|
||||
|
@ -155,7 +152,6 @@
|
|||
|
||||
<property name="src.dir" location="src/java"/>
|
||||
<property name="tests.src.dir" location="src/test"/>
|
||||
<property name="tests-framework.src.dir" location="${common.dir}/test-framework/src/java"/>
|
||||
<property name="build.dir" location="build"/>
|
||||
<!-- Needed in case a module needs the original build, also for compile-tools to be called from a module -->
|
||||
<property name="common.build.dir" location="${common.dir}/build"/>
|
||||
|
@ -213,31 +209,20 @@
|
|||
|
||||
<property name="filtered.pom.templates.dir" location="${common.dir}/build/poms"/>
|
||||
|
||||
<property name="clover.db.dir" location="${common.dir}/build/test/clover/db"/>
|
||||
<property name="clover.report.dir" location="${common.dir}/build/test/clover/reports"/>
|
||||
<property name="clover.license.path" location="${common.dir}/tools/clover/clover.license"/>
|
||||
<property name="clover.db.dir" location="${common.dir}/build/clover/db"/>
|
||||
<property name="clover.report.dir" location="${common.dir}/build/clover/reports"/>
|
||||
|
||||
<!-- a reasonable default exclusion set, can be overridden for special cases -->
|
||||
<property name="rat.excludes" value="**/TODO,**/*.txt"/>
|
||||
|
||||
<available
|
||||
property="clover.present"
|
||||
classname="com.cenqua.clover.tasks.CloverReportTask"
|
||||
/>
|
||||
|
||||
<condition property="clover.enabled">
|
||||
<and>
|
||||
<isset property="run.clover"/>
|
||||
<isset property="clover.present"/>
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
<propertyset id="uptodate.and.compiled.properties" dynamic="true">
|
||||
<propertyref regex=".*\.uptodate$$"/>
|
||||
<propertyref regex=".*\.compiled$$"/>
|
||||
</propertyset>
|
||||
|
||||
<patternset id="lucene.local.src.package.patterns"
|
||||
excludes="**/pom.xml,**/*.iml,**/*.jar,build/**,dist/**,benchmark/work/**,benchmark/temp/**"
|
||||
excludes="**/pom.xml,**/*.iml,**/*.jar,build/**,dist/**,benchmark/work/**,benchmark/temp/**,tools/javadoc/java6/**,tools/clover/**"
|
||||
/>
|
||||
|
||||
<!-- Default exclude sources and javadoc jars from Ivy fetch to save time and bandwidth -->
|
||||
|
@ -793,6 +778,7 @@
|
|||
>
|
||||
<!-- Classpaths. -->
|
||||
<classpath refid="@{junit.classpath}"/>
|
||||
<classpath refid="clover.classpath" />
|
||||
|
||||
<!-- Assertions. -->
|
||||
<assertions>
|
||||
|
@ -1091,48 +1077,55 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
|
|||
|
||||
<!-- note: order here is important, the taskdef depends on test-framework
|
||||
jars so we just order it after compile-test to ensure that -->
|
||||
<target name="test" depends="compile-test,install-junit4-taskdef,validate" description="Runs unit tests">
|
||||
<target name="test" depends="compile-test,install-junit4-taskdef,clover,validate" description="Runs unit tests">
|
||||
<mkdir dir="${junit.output.dir}"/>
|
||||
<test-macro threadNum="${tests.jvms}" />
|
||||
</target>
|
||||
|
||||
<!--
|
||||
If you want clover test code coverage, run this before the tests. You need clover.jar and the license in your ANT classspath and you need to specify -Drun.clover=true on the command line.
|
||||
|
||||
See http://issues.apache.org/jira/browse/LUCENE-721
|
||||
-->
|
||||
<target name="clover" depends="clover.setup, clover.info" description="Instrument the Unit tests using Clover. Requires a Clover 2.x license and clover.jar in the ANT classpath. To use, specify -Drun.clover=true on the command line."/>
|
||||
<target name="clover" depends="-clover.disable,-clover.setup" description="Instrument the Unit tests using Clover. To use, specify -Drun.clover=true on the command line."/>
|
||||
|
||||
<target name="-clover.setup" if="run.clover" unless="clover.loaded">
|
||||
<available file="${clover.license.path}" property="clover.license.available" />
|
||||
<fail unless="clover.license.available"><![CDATA[.
|
||||
|
||||
<target name="clover.setup" if="clover.enabled">
|
||||
<taskdef resource="cloverlib.xml"/>
|
||||
#########################################################################
|
||||
Atlassian Clover License not found!
|
||||
|
||||
Current License path: ${clover.license.path}
|
||||
|
||||
To use Atlassian Clover with Lucene build, you need a proper license
|
||||
and let the system property 'clover.license.path' point to it.
|
||||
You can pass it to ANT with:
|
||||
|
||||
$ ant -Dclover.license.path=/path/to/clover.license -Drun.clover=true ...
|
||||
|
||||
Apache Lucene/Solr source checkouts from SVN already contain the
|
||||
file, but source distributions cannot because of legal reasons.
|
||||
#########################################################################
|
||||
|
||||
]]></fail>
|
||||
<echo>Code coverage with Atlassian Clover enabled.</echo>
|
||||
<ivy:cachepath organisation="com.cenqua.clover" module="clover" revision="2.6.3"
|
||||
inline="true" conf="master" type="jar" pathid="clover.classpath"/>
|
||||
<taskdef resource="cloverlib.xml" classpathref="clover.classpath" />
|
||||
<mkdir dir="${clover.db.dir}"/>
|
||||
<clover-setup initString="${clover.db.dir}/lucene_coverage.db" encoding="${build.encoding}">
|
||||
<fileset dir="${src.dir}">
|
||||
<clover-setup initString="${clover.db.dir}/coverage.db" encoding="${build.encoding}">
|
||||
<fileset dir="${src.dir}" erroronmissingdir="no">
|
||||
<include name="org/apache/**/*.java" />
|
||||
</fileset>
|
||||
<testsources dir="${tests-framework.src.dir}">
|
||||
<include name="org/apache/**/*.java" />
|
||||
</testsources>
|
||||
<testsources dir="${tests.src.dir}">
|
||||
<testsources dir="${tests.src.dir}" erroronmissingdir="no">
|
||||
<include name="org/apache/**/*.java" />
|
||||
</testsources>
|
||||
</clover-setup>
|
||||
<property name="clover.loaded" value="true"/>
|
||||
</target>
|
||||
|
||||
<target name="clover.info" unless="clover.present">
|
||||
<echo>
|
||||
Clover not found. Code coverage reports disabled.
|
||||
</echo>
|
||||
</target>
|
||||
|
||||
<target name="clover.check">
|
||||
<fail unless="clover.present">
|
||||
##################################################################
|
||||
Clover not found.
|
||||
Please make sure clover.jar is in ANT_HOME/lib, or made available
|
||||
to Ant using other mechanisms like -lib or CLASSPATH.
|
||||
##################################################################
|
||||
</fail>
|
||||
<target name="-clover.disable" unless="run.clover">
|
||||
<!-- define dummy clover path used by junit -->
|
||||
<path id="clover.classpath"/>
|
||||
</target>
|
||||
|
||||
<target name="generate-test-reports" description="Generates test reports">
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
################################################
|
||||
DOCUMENTATION ABOUT ATLASSIAN CLOVER LICENSE
|
||||
################################################
|
||||
|
||||
On Fri, Dec 18, 2009 at 1:33 AM, Nicholas Muldoon <nmuldoon@atlassian.com> wrote:
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Hi,
|
||||
Atlassian are excited to be presenting Apache with a site license for Clover
|
||||
2.6.
|
||||
|
||||
This Clover license can be used for any code that is under an org.apache
|
||||
package. Further, this license can be used by any developer on their machine
|
||||
in conjunction with our Eclipse or IntelliJ plugins for development on an
|
||||
org.apache project.
|
||||
|
||||
[license]
|
||||
|
||||
|
||||
On Sat, Dec 19, 2009 at 10:38 PM, Nick Pellow <npellow@atlassian.com> wrote:
|
||||
---------------------------------------------------------------------------------
|
||||
Hi Mike,
|
||||
|
||||
That would be great if you could forward this to committers@apache.org.
|
||||
The license is available to anyone working on the org.apache.* be it
|
||||
in IDEA/Eclipse/Ant/Maven locally, or on a central build server.
|
||||
|
||||
Since the license will only instrument and report coverage on
|
||||
org.apache packages, please mention that it is fine to commit this
|
||||
license to each project if it makes running builds easier. ie just
|
||||
check out the project and run with Clover, without the need for the
|
||||
extra step of locating and installing the clover license.
|
||||
|
||||
Cheers,
|
||||
Nick
|
||||
|
||||
> On 19/12/2009, at 1:11 AM, Michael McCandless wrote:
|
||||
>
|
||||
>> Woops, I meant "The only restriction is that it will only test
|
||||
>> coverage of packages under org.apache", below.
|
||||
>>
|
||||
>> Mike
|
||||
>>
|
||||
>> On Fri, Dec 18, 2009 at 9:05 AM, Michael McCandless
|
||||
>> <lucene@mikemccandless.com> wrote:
|
||||
>>>
|
||||
>>> Since this generous offer extends beyond Lucene...
|
||||
>>>
|
||||
>>> I'd like to forward this to committers@apache.org, pointing to where
|
||||
>>> the license is available
|
||||
>>>
|
||||
>>> (https://svn.apache.org/repos/private/committers/donated-licenses/cl
|
||||
>>> over/2.6.x), explaining that Lucene upgraded (providing the link to
|
||||
>>> our coverage report), etc.
|
||||
>>>
|
||||
>>> But I wanted to confirm with you all first: is this OK? This
|
||||
>>> license may be used by anyone? The only restriction is that it will
|
||||
>>> only test coverage of packages under org.apache.lucene?
|
||||
>>>
|
||||
>>> I can draft something up and run it by you all first, if this makes
|
||||
>>> sense...
|
|
@ -0,0 +1,7 @@
|
|||
AAABLQ0ODAoPeNptkF1rwjAUhu/zKwK7rjRVhwiBSdsLQVtZdVeDkaXHGkzTkA+n/36xtbiLXeQmh
|
||||
+d533NeKq/wyjeYzHCSLOfxkiQ4zfY4iQlBGVhuhHaiUzSV3QXM5xKXGhSuOm84oNQAu08z5oDek
|
||||
SheRGSO0k45xl3BWqBbcQa85ZypWoK1iPeiSeHbbzDl8WDBWBqRkcm3TEjaBqjtmTemGT/BpDMNy
|
||||
i9M+j6QHpm0MLoCJi5AnfHPLym7H6j1udEGjuIKlgbDZJAhKTgoCx8h+i5LUAhVDhRTHPKrFub23
|
||||
IgkEVmM2s0A7m8a+uXKXV58VeXhPc1RaRqmhB36rYagKi9oeBGZvs4W0yl68OuMbtbZP4M/4V5J0
|
||||
QoHNdqFW5+YhbFT/Oj0C1FClngwLgIVAJJTCumwsuBLa8eB0JcPVMcTcRiKAhUAgS9VbXCNOqGDY
|
||||
ooFNN9744FAK2s=X02f7
|
|
@ -15,7 +15,7 @@
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<project name="solr" default="usage">
|
||||
<project name="solr" default="usage" xmlns:ivy="antlib:org.apache.ivy.ant">
|
||||
<description>Solr</description>
|
||||
|
||||
<target name="usage" description="Prints out instructions">
|
||||
|
@ -258,64 +258,26 @@
|
|||
</delete>
|
||||
</target>
|
||||
|
||||
<!-- Clover targets -->
|
||||
<target name="clover" depends="clover.setup, clover.info"
|
||||
description="Instrument the Unit tests using Clover. Requires a Clover license and clover.jar in the ANT classpath. To use, specify -Drun.clover=true on the command line."/>
|
||||
|
||||
<target name="clover.setup" if="clover.enabled">
|
||||
<taskdef resource="cloverlib.xml"/>
|
||||
<mkdir dir="${clover.db.dir}"/>
|
||||
<clover-setup initString="${clover.db.dir}/lucene_coverage.db">
|
||||
<fileset dir="core/src/java"/>
|
||||
<fileset dir="solrj/src/java"/>
|
||||
<fileset dir="contrib/analysis-extras/src/java"/>
|
||||
<fileset dir="contrib/clustering/src/java"/>
|
||||
<fileset dir="contrib/dataimporthandler/src/java"/>
|
||||
<fileset dir="contrib/dataimporthandler-extras/src/java"/>
|
||||
<fileset dir="contrib/extraction/src/java"/>
|
||||
<fileset dir="contrib/uima/src/java"/>
|
||||
<testsources dir="test-framework/src/java"/>
|
||||
<testsources dir="core/src/test"/>
|
||||
<testsources dir="solrj/src/test"/>
|
||||
<testsources dir="contrib/analysis-extras/src/test" />
|
||||
<testsources dir="contrib/clustering/src/test" />
|
||||
<testsources dir="contrib/dataimporthandler/src/test" />
|
||||
<testsources dir="contrib/dataimporthandler-extras/src/test" />
|
||||
<testsources dir="contrib/extraction/src/test" />
|
||||
<testsources dir="contrib/uima/src/test" />
|
||||
</clover-setup>
|
||||
</target>
|
||||
|
||||
<target name="clover.info" unless="clover.present">
|
||||
<echo>
|
||||
Clover not found. Code coverage reports disabled.
|
||||
</echo>
|
||||
</target>
|
||||
|
||||
<target name="clover.check">
|
||||
<fail unless="clover.present">
|
||||
##################################################################
|
||||
Clover not found.
|
||||
Please make sure clover.jar is in ANT_HOME/lib, or made available
|
||||
to Ant using other mechanisms like -lib or CLASSPATH.
|
||||
##################################################################
|
||||
</fail>
|
||||
</target>
|
||||
|
||||
<!-- Run after Junit tests. -->
|
||||
<target name="generate-clover-reports" depends="clover.check, clover">
|
||||
<!--
|
||||
Run after Junit tests.
|
||||
-->
|
||||
<target name="generate-clover-reports" depends="clover">
|
||||
<fail unless="run.clover">Clover not enabled!</fail>
|
||||
<mkdir dir="${clover.report.dir}"/>
|
||||
<fileset dir="build" id="clover.test.result.files">
|
||||
<include name="**/test/TEST-*.xml"/>
|
||||
</fileset>
|
||||
<clover-report>
|
||||
<current outfile="${clover.report.dir}/clover.xml"
|
||||
title="${fullnamever}">
|
||||
<format type="xml"/>
|
||||
</current>
|
||||
<current outfile="${clover.report.dir}" title="${fullnamever}">
|
||||
<format type="html"/>
|
||||
</current>
|
||||
<current outfile="${clover.report.dir}" title="${final.name}" numThreads="0">
|
||||
<format type="html" filter="assert"/>
|
||||
<testresults refid="clover.test.result.files"/>
|
||||
</current>
|
||||
<current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
|
||||
<format type="xml" filter="assert"/>
|
||||
<testresults refid="clover.test.result.files"/>
|
||||
</current>
|
||||
</clover-report>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<!-- ===================== DISTRIBUTION-RELATED TASKS ======================== -->
|
||||
|
@ -375,6 +337,8 @@
|
|||
|
||||
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
|
||||
<delete dir="${svn.export.dir}/lucene/tools/javadoc/java6"/>
|
||||
<!-- Exclude clover license files incompatible with the ASL -->
|
||||
<delete dir="${svn.export.dir}/lucene/tools/clover"/>
|
||||
|
||||
<tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
|
||||
<tarfileset dir="${svn.export.dir}"
|
||||
|
|
|
@ -49,15 +49,7 @@
|
|||
<property name="tests.loggingfile" value="${common-solr.dir}/testlogging.properties"/>
|
||||
<property name="tests.cleanthreads.sysprop" value="perClass"/>
|
||||
|
||||
<property name="clover.db.dir" location="${dest}/test/clover/db"/>
|
||||
<property name="clover.report.dir" location="${dest}/test/clover/reports"/>
|
||||
<available property="clover.present" classname="com.cenqua.clover.tasks.CloverReportTask"/>
|
||||
<condition property="clover.enabled">
|
||||
<and>
|
||||
<isset property="run.clover"/>
|
||||
<isset property="clover.present"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="clover.report.dir" location="${dest}/clover/reports"/>
|
||||
|
||||
<import file="${common-solr.dir}/../lucene/module-build.xml"/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue