From 98d793400e2ae1957a4bfe4372708f0217fcc4bd Mon Sep 17 00:00:00 2001 From: vmassol Date: Wed, 11 May 2005 16:28:26 +0000 Subject: [PATCH] - Added a quick usage guide in the documentation. - Fixed issue where clover:report was not calling clover:on leading to an error when generating the reports. - Ensure that clover:init, clover:on and clover:off can only be called once. For example calling clover:on twice in a row will execute it only once. - The clover:*-report goals do not call clover:test anymore. They only generates Clover reports. This is now aligned with the clover:report behavior. To run the full thing, execute the clover goal or add the Clover report to your project's POM. - Added a maven.clover.multiproject property that should be set to true in your master project (if you're using a multiproject setup). Setting it to true will make the clover goal and the maven-clover-plugin report in your POM execute on all subprojects (they'll call the new clover:multiproject goal). - New clover:multiproject goal to run Clover on a multiproject setup. - New clover:merge goal that creates a new Clover database by merging several other databases specified using the maven.clover.merge.databases property (which defaults to **/clover_coverage.db). git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@169652 13f79535-47bb-0310-9956-ffa450edef68 --- clover/plugin.jelly | 153 ++++++++++++++---- clover/plugin.properties | 9 ++ .../plugin-test/testMultiproject/maven.xml | 41 +++++ .../testMultiproject/project.properties | 17 ++ .../plugin-test/testMultiproject/project.xml | 28 ++++ .../testMultiproject/subproject1/project.xml | 34 ++++ .../org/apache/maven/clover/test/Simple1.java | 25 +++ .../apache/maven/clover/test/Simple1Test.java | 29 ++++ .../testMultiproject/subproject2/project.xml | 34 ++++ .../org/apache/maven/clover/test/Simple2.java | 25 +++ .../apache/maven/clover/test/Simple2Test.java | 29 ++++ clover/xdocs/changes.xml | 38 +++++ clover/xdocs/goals.xml | 18 ++- clover/xdocs/index.xml | 34 +++- clover/xdocs/properties.xml | 11 ++ 15 files changed, 492 insertions(+), 33 deletions(-) create mode 100644 clover/src/plugin-test/testMultiproject/maven.xml create mode 100644 clover/src/plugin-test/testMultiproject/project.properties create mode 100644 clover/src/plugin-test/testMultiproject/project.xml create mode 100644 clover/src/plugin-test/testMultiproject/subproject1/project.xml create mode 100644 clover/src/plugin-test/testMultiproject/subproject1/src/main/org/apache/maven/clover/test/Simple1.java create mode 100644 clover/src/plugin-test/testMultiproject/subproject1/src/test/org/apache/maven/clover/test/Simple1Test.java create mode 100644 clover/src/plugin-test/testMultiproject/subproject2/project.xml create mode 100644 clover/src/plugin-test/testMultiproject/subproject2/src/main/org/apache/maven/clover/test/Simple2.java create mode 100644 clover/src/plugin-test/testMultiproject/subproject2/src/test/org/apache/maven/clover/test/Simple2Test.java diff --git a/clover/plugin.jelly b/clover/plugin.jelly index d9d1f8ad..ecaee0c7 100644 --- a/clover/plugin.jelly +++ b/clover/plugin.jelly @@ -19,6 +19,7 @@ --> - + + + + + @@ -87,9 +97,21 @@ Generate test coverage reports with Clover. ======================================================================== --> - + + + + + + + + + + + + + + + - + + + + + + + + + + - + ${context.removeVariable('build.compiler')} @@ -203,6 +234,15 @@ + + + + + + + + + - + + + + @@ -313,17 +357,20 @@ + + + - - + + + @@ -359,29 +406,33 @@ + + - - - - + description="Generate Swing test coverage reports with Clover"> + + + + + + - + + + @@ -417,11 +468,10 @@ + + - - + + - + @@ -534,4 +587,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clover/plugin.properties b/clover/plugin.properties index 288aa329..4e90f4e7 100644 --- a/clover/plugin.properties +++ b/clover/plugin.properties @@ -57,6 +57,12 @@ maven.clover.report.pdf = false # based on an existing Clover database. maven.clover.execute.during.report = true +# Specify whether the current project is a master project in a multiproject +# setup or not. Set it to true for your master project so that adding +# the maven-clover-plugin report to your POM will call the clover:multiproject +# goal (same for the clover goal). +maven.clover.multiproject = false + # List of files to include/exclude from Cloverification maven.clover.includes = **/*.java maven.clover.excludes = @@ -65,6 +71,9 @@ maven.clover.excludes = # history point data so that they are not erased, point this directory to # a safe place that will not be deleted by a "maven clean". maven.clover.history.dir = ${maven.clover.build}/history + +# List of databases to include in the merge when using the clover:merge goal +maven.clover.merge.databases = **/clover_coverage.db # Test coverage % under which the build will fail when clover:check is called. # Set it to an empty value if you wish to only use the per-package definitions. diff --git a/clover/src/plugin-test/testMultiproject/maven.xml b/clover/src/plugin-test/testMultiproject/maven.xml new file mode 100644 index 00000000..3c60dd8d --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/maven.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/clover/src/plugin-test/testMultiproject/project.properties b/clover/src/plugin-test/testMultiproject/project.properties new file mode 100644 index 00000000..5a9ea44c --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/project.properties @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------- +# Copyright 2005 The Apache Software Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------------- + +maven.clover.multiproject = true diff --git a/clover/src/plugin-test/testMultiproject/project.xml b/clover/src/plugin-test/testMultiproject/project.xml new file mode 100644 index 00000000..765a1c81 --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/project.xml @@ -0,0 +1,28 @@ + + + + + + ${basedir}/../project.xml + testMultiproject + testMultiproject + + maven-clover-plugin + + diff --git a/clover/src/plugin-test/testMultiproject/subproject1/project.xml b/clover/src/plugin-test/testMultiproject/subproject1/project.xml new file mode 100644 index 00000000..ba720a7d --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/subproject1/project.xml @@ -0,0 +1,34 @@ + + + + + + ${basedir}/../project.xml + testMultiproject-subproject1 + testMultiproject-subproject1 + + src/main + src/test + + + **/*Test.java + + + + diff --git a/clover/src/plugin-test/testMultiproject/subproject1/src/main/org/apache/maven/clover/test/Simple1.java b/clover/src/plugin-test/testMultiproject/subproject1/src/main/org/apache/maven/clover/test/Simple1.java new file mode 100644 index 00000000..adedb26c --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/subproject1/src/main/org/apache/maven/clover/test/Simple1.java @@ -0,0 +1,25 @@ +package org.apache.maven.clover.test; + +/* ==================================================================== + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +public class Simple1 +{ + public void someMethod1() + { + } +} \ No newline at end of file diff --git a/clover/src/plugin-test/testMultiproject/subproject1/src/test/org/apache/maven/clover/test/Simple1Test.java b/clover/src/plugin-test/testMultiproject/subproject1/src/test/org/apache/maven/clover/test/Simple1Test.java new file mode 100644 index 00000000..cccf82be --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/subproject1/src/test/org/apache/maven/clover/test/Simple1Test.java @@ -0,0 +1,29 @@ +package org.apache.maven.clover.test; + +/* ==================================================================== + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +import junit.framework.TestCase; + +public class Simple1Test extends TestCase +{ + public void testSomeMethod1() + { + Simple1 simple = new Simple1(); + simple.someMethod1(); + } +} \ No newline at end of file diff --git a/clover/src/plugin-test/testMultiproject/subproject2/project.xml b/clover/src/plugin-test/testMultiproject/subproject2/project.xml new file mode 100644 index 00000000..3606c839 --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/subproject2/project.xml @@ -0,0 +1,34 @@ + + + + + + ${basedir}/../project.xml + testMultiproject-subproject2 + testMultiproject-subproject2 + + src/main + src/test + + + **/*Test.java + + + + diff --git a/clover/src/plugin-test/testMultiproject/subproject2/src/main/org/apache/maven/clover/test/Simple2.java b/clover/src/plugin-test/testMultiproject/subproject2/src/main/org/apache/maven/clover/test/Simple2.java new file mode 100644 index 00000000..b05cc90c --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/subproject2/src/main/org/apache/maven/clover/test/Simple2.java @@ -0,0 +1,25 @@ +package org.apache.maven.clover.test; + +/* ==================================================================== + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +public class Simple2 +{ + public void someMethod2() + { + } +} \ No newline at end of file diff --git a/clover/src/plugin-test/testMultiproject/subproject2/src/test/org/apache/maven/clover/test/Simple2Test.java b/clover/src/plugin-test/testMultiproject/subproject2/src/test/org/apache/maven/clover/test/Simple2Test.java new file mode 100644 index 00000000..77d48a9e --- /dev/null +++ b/clover/src/plugin-test/testMultiproject/subproject2/src/test/org/apache/maven/clover/test/Simple2Test.java @@ -0,0 +1,29 @@ +package org.apache.maven.clover.test; + +/* ==================================================================== + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +import junit.framework.TestCase; + +public class Simple2Test extends TestCase +{ + public void testSomeMethod2() + { + Simple2 simple = new Simple2(); + simple.someMethod2(); + } +} \ No newline at end of file diff --git a/clover/xdocs/changes.xml b/clover/xdocs/changes.xml index 7c5ea06d..ab4d9894 100644 --- a/clover/xdocs/changes.xml +++ b/clover/xdocs/changes.xml @@ -26,6 +26,44 @@ + + Added a quick usage guide in the documentation. + + + Fixed issue where clover:report was not calling + clover:on leading to an error when generating the + reports. + + + Ensure that clover:init, clover:on + and clover:off can only be called once. For example + calling clover:on twice in a row will execute it only + once. + + + The clover:*-report goals do not call + clover:test anymore. They only generates Clover reports. + This is now aligned with the clover:report behavior. + To run the full thing, execute the clover goal or + add the Clover report to your project's POM. + + + Added a maven.clover.multiproject property that should be + set to true in your master project (if you're using a multiproject setup). + Setting it to true will make the clover goal and the + maven-clover-plugin report in your POM execute on all + subprojects (they'll call the new clover:multiproject goal). + + + New clover:multiproject goal to run Clover on a + multiproject setup. + + + New clover:merge goal that creates a new Clover + database by merging several other databases specified using + the maven.clover.merge.databases property (which + defaults to **/clover_coverage.db). + Fixed issue with Clover task and type definitions not using an explicit classpath which apparently breaks under Maven 1.1. diff --git a/clover/xdocs/goals.xml b/clover/xdocs/goals.xml index 935ca2b0..749ab4c4 100644 --- a/clover/xdocs/goals.xml +++ b/clover/xdocs/goals.xml @@ -65,7 +65,7 @@ Generate Clover test coverage reports with Clover. There are 3 possible reports: HTML, XML or Swing. Whether a report is generated - is controller by the maven.clover.report.[report name] + is controlled by the maven.clover.report.[report name] properties. The generated reports show exactly what lines of your code were exercised by your tests. @@ -117,6 +117,22 @@ history reports when the clover:report goal is called. + + clover:merge + + Merges several Clover databases into one. This goal is meant to be + called in the top level master project (multiproject). It is called + automatically by the clover:multiproject goal. + + + + clover:multiproject + + Runs Clover on a multiproject and merge the Clover databases.This + goal does not generate a report; call clover:report for that or add + Clover as a report in your POM. + + \ No newline at end of file diff --git a/clover/xdocs/index.xml b/clover/xdocs/index.xml index 7eb90499..e3daa891 100644 --- a/clover/xdocs/index.xml +++ b/clover/xdocs/index.xml @@ -2,7 +2,7 @@