Skip to content

Apache Lucene open-source search software

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

Uwe Schindler1922e5b956fa
diff --git a/build.xml b/build.xml
index b5d3015944d..00360527f26 100755
--- a/build.xml
+++ b/build.xml
@@ -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: -->
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 4552a113e71..2ae89e56499 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -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.
diff --git a/lucene/build.xml b/lucene/build.xml
index f2ce68dae2c..0061d29cb81 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -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"/>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 539d206a1ad..43a6aa1e6f5 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -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>
diff --git a/lucene/tools/clover/README.txt b/lucene/tools/clover/README.txt
deleted file mode 100644
index 62f1de9cd1e..00000000000
--- a/lucene/tools/clover/README.txt
+++ /dev/null
@@ -1,108 +0,0 @@
-################################################
- DOCUMENTATION ABOUT ATLASSIAN CLOVER LICENSE
-################################################
-
-Sent: Wednesday, September 25, 2013 5:09 PM
-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 ([email protected]), Uwe Schindler ([email protected])
-Billing Contact: Mike Mccandless ([email protected])
-Licensed To: Apache
-
-History:
-27 Jun 2012 Purchase of Clover 100+ Machines: Open Source License
-27 Jun 2013 Maintenance Renewal
-
----------------------------------------------------------------------------------
-
-From: Nicholas Muldoon <[email protected]>
-To: Ted Yu <[email protected]>
-Cc: Enis Soztutar <[email protected]>, Todd Lipcon <[email protected]>
-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 <[email protected]> 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 <[email protected]> wrote:
----------------------------------------------------------------------------------
-Hi Mike,
-
-That would be great if you could forward this to [email protected].
-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
->> <[email protected]> wrote:
->>>
->>> Since this generous offer extends beyond Lucene...
->>>
->>> I'd like to forward this to [email protected], 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...
diff --git a/lucene/tools/clover/clover.license b/lucene/tools/clover/clover.license
deleted file mode 100644
index 1a46f878ac9..00000000000
--- a/lucene/tools/clover/clover.license
+++ /dev/null
@@ -1,5 +0,0 @@
-nRQNWtwTDKNQARUudFdtDsicMRPIUONPsMvQXbqMkHLoFB
-mi2Kv8XgEIr0AKkpEyRKsl2L2KSZDO6fk1Eio5G7RKZiUc
-OoroXsoPoMPqOQrNrPRTtnNpPOMmMOnnOoTsXVsTvXXvQp
-moNnmqmUUnqmptmqummmmmUUnqmptmqummmmmUU1mXZebU
-Unmmmm
diff --git a/lucene/tools/src/groovy/patch-mrjar-classes.groovy b/lucene/tools/src/groovy/patch-mrjar-classes.groovy
index 07f285c6ff7..1ba6a983691 100644
--- a/lucene/tools/src/groovy/patch-mrjar-classes.groovy
+++ b/lucene/tools/src/groovy/patch-mrjar-classes.groovy
@@ -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');
diff --git a/solr/build.xml b/solr/build.xml
index 9b0bdabd416..400c71180d5 100644
--- a/solr/build.xml
+++ b/solr/build.xml
@@ -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"