LUCENE-8169: Migrate build to use OpenClover 4.2.1 for checking code coverage

This commit is contained in:
Uwe Schindler 2018-02-11 10:49:01 +01:00
parent 9e9ed0d7b1
commit 1922e5b956
8 changed files with 16 additions and 144 deletions

View File

@ -491,7 +491,7 @@ File | Project Structure | Platform Settings | SDKs):
<wc-checker failonmodifications="${is.jenkins.build}"/>
</target>
<target name="run-clover" description="Runs all tests to measure coverage and generates report (pass &quot;ANT_OPTS=-Xmx1536M&quot; as environment)" depends="clean">
<target name="run-clover" description="Runs all tests to measure coverage and generates report (pass &quot;ANT_OPTS=-Xmx2G&quot; as environment)" depends="clean">
<antcall inheritAll="false">
<param name="run.clover" value="true"/>
<!-- must be 1, as clover does not like parallel test runs: -->

View File

@ -189,6 +189,9 @@ Other
* LUCENE-8155: Add back support in smoke tester to run against later Java versions.
(Uwe Schindler)
* LUCENE-8169: Migrated build to use OpenClover 4.2.1 for checking code coverage.
(Uwe Schindler)
Build
* LUCENE-8168: Moved Groovy scripts in build files to separate files.

View File

@ -353,8 +353,6 @@
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
<delete dir="${src.export.dir}/tools/javadoc/java8"/>
<!-- Exclude clover license files incompatible with the ASL -->
<delete dir="${src.export.dir}/tools/clover"/>
<!-- because we only package the "lucene/" folder, we have to adjust dir to work on: -->
<property name="local.src.export.dir" location="${src.export.dir}/lucene"/>

View File

@ -139,11 +139,11 @@
<istrue value="${tests.asserts}"/>
</condition>
<condition property="tests.heapsize" value="768M" else="512M">
<condition property="tests.heapsize" value="1024M" else="512M">
<isset property="run.clover"/>
</condition>
<condition property="tests.clover.args" value="-XX:ReservedCodeCacheSize=128m -XX:MaxPermSize=192m" else="">
<condition property="tests.clover.args" value="-XX:ReservedCodeCacheSize=192m -XX:MaxPermSize=256m -Dclover.pertest.coverage=off" else="">
<isset property="run.clover"/>
</condition>
@ -234,7 +234,6 @@
<property name="filtered.pom.templates.dir" location="${common.dir}/build/poms"/>
<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"/>
@ -266,7 +265,7 @@
</propertyset>
<patternset id="lucene.local.src.package.patterns"
excludes="**/pom.xml,**/*.iml,**/*.jar,build/**,dist/**,benchmark/work/**,benchmark/temp/**,tools/javadoc/java8/**,tools/clover/**"
excludes="**/pom.xml,**/*.iml,**/*.jar,build/**,dist/**,benchmark/work/**,benchmark/temp/**,tools/javadoc/java8/**"
/>
<!-- Default exclude sources and javadoc jars from Ivy fetch to save time and bandwidth -->
@ -573,7 +572,7 @@
</target>
<target name="-mrjar-check" depends="patch-mrjar-classes">
<zipfileset id="mrjar-patched-files" prefix="META-INF/versions/9" dir="${build.dir}/classes/java9"/>
<zipfileset id="mrjar-patched-files" prefix="META-INF/versions/9" dir="${build.dir}/classes/java9" erroronmissingdir="false"/>
<condition property="has-mrjar-patched-files">
<resourcecount refid="mrjar-patched-files" when="greater" count="0" />
</condition>
@ -1612,27 +1611,8 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<target name="clover" depends="-clover.disable,-clover.load,-clover.classpath,-clover.setup"/>
<target name="-clover.load" depends="ivy-availability-check,ivy-configure" if="run.clover" unless="clover.loaded">
<available file="${clover.license.path}" property="clover.license.available" />
<fail unless="clover.license.available"><![CDATA[.
#########################################################################
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 Git 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.atlassian.clover" module="clover" revision="4.0.4"
<echo>Code coverage with OpenClover enabled.</echo>
<ivy:cachepath organisation="org.openclover" module="clover" revision="4.2.1"
inline="true" conf="master" pathid="clover.classpath"/>
<taskdef resource="cloverlib.xml" classpathref="clover.classpath" />
<mkdir dir="${clover.db.dir}"/>
@ -1654,6 +1634,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
</fileset>
<testsources dir="${tests.src.dir}" erroronmissingdir="no">
<include name="org/apache/**/*.java" />
<exclude name="**/TestOpenNLP*Factory.java"/><!-- https://jira.atlassian.com/browse/CLOV-1984 -->
</testsources>
</clover-setup>
</target>

View File

@ -1,108 +0,0 @@
################################################
DOCUMENTATION ABOUT ATLASSIAN CLOVER LICENSE
################################################
From: sales@atlassian.com [mailto:sales@atlassian.com]
Sent: Wednesday, September 25, 2013 5:09 PM
To: uschindler@apache.org
Cc: npellow@atlassian.com
Subject: RE: Fwd: New Clover License for Apache - {844535}
Hey Uwe,
Thanks for getting back.
I found the license using the key you provided - thanks for that! I've renewed the license for another year and added you as a technical contact.
Cheers,
Amber
Clover 100+ Machines: Open Source License Apache 27 Jun 2014
SEN: SEN-2304226
Technical Contact: Mike Mccandless (mikemccand@apache.org), Uwe Schindler (uschindler@apache.org)
Billing Contact: Mike Mccandless (mikemccand@apache.org)
Licensed To: Apache
History:
27 Jun 2012 Purchase of Clover 100+ Machines: Open Source License
27 Jun 2013 Maintenance Renewal
---------------------------------------------------------------------------------
From: Nicholas Muldoon <nmuldoon@atlassian.com>
To: Ted Yu <yuzhihong@gmail.com>
Cc: Enis Soztutar <enis@hortonworks.com>, Todd Lipcon <todd@cloudera.com>
Content-Type: multipart/alternative; boundary=047d7b10cff34cee0f04c376df70
X-Gm-Message-State: ALoCoQmzowRKrtL3txnON+W+U2vn7gwwWSn/U5dvchuTV0Nn3xaMoAojvbPal5TBkC6foBnuHPWU
--047d7b10cff34cee0f04c376df70
Content-Type: text/plain; charset=ISO-8859-1
Hi Ted,
Please find a renewed license below - Clover 3 compatible. Should you have
any difficulty please let me know.
[license]
Thanks Ted, have a great day, thanks for your support,
Nicholas
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...

View File

@ -1,5 +0,0 @@
nRQNWtwTDKNQARUudFdtDsicMRPIUONPsMvQXbqMkHLoFB
mi2Kv8XgEIr0AKkpEyRKsl2L2KSZDO6fk1Eio5G7RKZiUc
OoroXsoPoMPqOQrNrPRTtnNpPOMmMOnnOoTsXVsTvXXvQp
moNnmqmUUnqmptmqummmmmUUnqmptmqummmmmUU1mXZebU
Unmmmm

View File

@ -32,6 +32,11 @@ def mappings = [
'org/apache/lucene/util/FutureArrays': 'java/util/Arrays',
];
if (properties['run.clover'] != null) {
task.log("Disabled class file remapping for Java 9, because Clover code coverage is enabled.", Project.MSG_INFO);
return;
}
File inputDir = new File(properties['build.dir'], 'classes/java');
File outputDir = new File(properties['build.dir'], 'classes/java9');

View File

@ -488,8 +488,6 @@
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
<delete dir="${src.export.dir}/lucene/tools/javadoc/java8"/>
<!-- Exclude clover license files incompatible with the ASL -->
<delete dir="${src.export.dir}/lucene/tools/clover"/>
<build-changes changes.src.file="${src.export.dir}/solr/CHANGES.txt"
changes.target.dir="${src.export.dir}/solr/docs/changes"