diff --git a/dashboard/plugin.jelly b/dashboard/plugin.jelly index 19f33089..ba92fbe9 100644 --- a/dashboard/plugin.jelly +++ b/dashboard/plugin.jelly @@ -83,7 +83,7 @@ - + @@ -122,32 +122,45 @@ - ${maven.dashboard.reports} + ${maven.dashboard.aggregators} + + + - + + - + value="maven.dashboard.aggregator.${aggregatorName}.goal"/> + + + + + + + + - - + + - - ${reportName} + + ${aggregatorName} - + + value="maven.dashboard.aggregator.${aggregatorName}.script"/> diff --git a/dashboard/plugin.properties b/dashboard/plugin.properties index 22ca07d6..6c43b771 100644 --- a/dashboard/plugin.properties +++ b/dashboard/plugin.properties @@ -35,17 +35,47 @@ maven.dashboard.runreactor = true # Properties for gathering dashboard data for a single project # ------------------------------------------------------------ -# Location of default dashboard adaptors -maven.dashboard.reports.dir = ${plugin.resources}/reports +# Location of default dashboard aggregators +maven.dashboard.aggregators.dir = ${plugin.resources}/reports -# List of reports to aggregate -maven.dashboard.reports = checkstyle +# Comma-separated list of aggregators to use +maven.dashboard.aggregators = cserrors,cswarnings,clovertpc,cloverloc,cloverncloc -# Properties for the default checkstyle adaptor -maven.dashboard.report.checkstyle.script = ${maven.dashboard.reports.dir}/checkstyle.jelly -maven.dashboard.report.checkstyle.artifact = ${maven.build.dir}/checkstyle-raw-report.xml -maven.dashboard.report.checkstyle.label = Checkstyle errors -maven.dashboard.report.checkstyle.goal = checkstyle +# Properties for the Checkstyle error/warning aggregator (all errors/warnings) +maven.dashboard.aggregator.csall.script = ${maven.dashboard.aggregators.dir}/csall.jelly +maven.dashboard.aggregator.csall.artifact = ${maven.build.dir}/checkstyle-raw-report.xml +maven.dashboard.aggregator.csall.label = CS err/warn +maven.dashboard.aggregator.csall.goal = checkstyle + +# Properties for the Checkstyle error aggregator (only errors) +maven.dashboard.aggregator.cserrors.script = ${maven.dashboard.aggregators.dir}/cserrors.jelly +maven.dashboard.aggregator.cserrors.artifact = ${maven.build.dir}/checkstyle-raw-report.xml +maven.dashboard.aggregator.cserrors.label = CS errors +maven.dashboard.aggregator.cserrors.goal = checkstyle + +# Properties for the Checkstyle warning aggregator (only warnings) +maven.dashboard.aggregator.cswarnings.script = ${maven.dashboard.aggregators.dir}/cswarnings.jelly +maven.dashboard.aggregator.cswarnings.artifact = ${maven.build.dir}/checkstyle-raw-report.xml +maven.dashboard.aggregator.cswarnings.label = CS warnings +maven.dashboard.aggregator.cswarnings.goal = checkstyle + +# Properties for the Clover TPC aggregator (TPC = Total Percent Coverage) +maven.dashboard.aggregator.clovertpc.script = ${maven.dashboard.aggregators.dir}/clovertpc.jelly +maven.dashboard.aggregator.clovertpc.artifact = ${maven.build.dir}/clover.xml +maven.dashboard.aggregator.clovertpc.label = Clover TPC +maven.dashboard.aggregator.clovertpc.goal = clover + +# Properties for the Clover LOC aggregator (LOC = Line Of Code) +maven.dashboard.aggregator.cloverloc.script = ${maven.dashboard.aggregators.dir}/cloverloc.jelly +maven.dashboard.aggregator.cloverloc.artifact = ${maven.build.dir}/clover.xml +maven.dashboard.aggregator.cloverloc.label = Clover LOC +maven.dashboard.aggregator.cloverloc.goal = clover + +# Properties for the Clover NCLOC aggregator (NCLOC = Non Comment Line Of Code) +maven.dashboard.aggregator.cloverncloc.script = ${maven.dashboard.aggregators.dir}/cloverncloc.jelly +maven.dashboard.aggregator.cloverncloc.artifact = ${maven.build.dir}/clover.xml +maven.dashboard.aggregator.cloverncloc.label = Clover NCLOC +maven.dashboard.aggregator.cloverncloc.goal = clover # Generated dashboard data for a single project maven.dashboard.report.single = ${maven.build.dir}/dashboard-single.xml diff --git a/dashboard/sample/project.properties b/dashboard/sample/project.properties index 78be9a9b..e3c0bce4 100644 --- a/dashboard/sample/project.properties +++ b/dashboard/sample/project.properties @@ -4,3 +4,8 @@ maven.xdoc.date=left maven.xdoc.version=${pom.currentVersion} maven.checkstyle.header.file = ${basedir}/../../LICENSE.txt + +# Required to generate XML clover report +maven.clover.report.xml = true + +maven.dashboard.aggregators = csall,cserrors,cswarnings,clovertpc,cloverloc,cloverncloc diff --git a/dashboard/sample/subproject1/.cvsignore b/dashboard/sample/subproject1/.cvsignore index 5d21c883..bca2cda9 100644 --- a/dashboard/sample/subproject1/.cvsignore +++ b/dashboard/sample/subproject1/.cvsignore @@ -1,2 +1,3 @@ target maven.log +velocity.log diff --git a/dashboard/sample/subproject1/project.xml b/dashboard/sample/subproject1/project.xml index 0e345857..68dc0a58 100644 --- a/dashboard/sample/subproject1/project.xml +++ b/dashboard/sample/subproject1/project.xml @@ -56,10 +56,17 @@ src/java + src/test + + + **/Test*.java + + maven-checkstyle-plugin + maven-clover-plugin \ No newline at end of file diff --git a/dashboard/sample/subproject1/src/java/org/apache/maven/dashboard/sample/subproject1/Sample.java b/dashboard/sample/subproject1/src/java/org/apache/maven/dashboard/sample/subproject1/Sample.java index 0ad0d853..1d70fd20 100644 --- a/dashboard/sample/subproject1/src/java/org/apache/maven/dashboard/sample/subproject1/Sample.java +++ b/dashboard/sample/subproject1/src/java/org/apache/maven/dashboard/sample/subproject1/Sample.java @@ -61,10 +61,14 @@ package org.apache.maven.dashboard.sample.subproject1; * * @author Vincent Massol * - * @version $Id: Sample.java,v 1.1 2003/11/04 21:11:31 vmassol Exp $ + * @version $Id: Sample.java,v 1.2 2003/11/05 19:26:58 vmassol Exp $ */ public class Sample { + public void unusedMethod() + { + } + public void someMethod() { new Boolean(true); diff --git a/dashboard/sample/subproject1/src/test/org/apache/maven/dashboard/sample/subproject1/TestSample.java b/dashboard/sample/subproject1/src/test/org/apache/maven/dashboard/sample/subproject1/TestSample.java new file mode 100644 index 00000000..f0fdd984 --- /dev/null +++ b/dashboard/sample/subproject1/src/test/org/apache/maven/dashboard/sample/subproject1/TestSample.java @@ -0,0 +1,75 @@ +package org.apache.maven.dashboard.sample.subproject1; + +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" and + * "Apache Maven" must not be used to endorse or promote products + * derived from this software without prior written permission. For + * written permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * "Apache Maven", nor may "Apache" appear in their name, without + * prior written permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + * ==================================================================== + */ + +import junit.framework.TestCase; + +/** + * Sample test for {@link Sample} to test the Clover aggregator. + * + * @author Vincent Massol + * + * @version $Id: TestSample.java,v 1.1 2003/11/05 19:26:58 vmassol Exp $ + */ +public class TestSample extends TestCase +{ + public void testSomeMethod() + { + Sample sample = new Sample(); + sample.someMethod(); + } +} \ No newline at end of file diff --git a/dashboard/src/main/org/apache/maven/dashboard/aggregator/clover/CloverTPC.java b/dashboard/src/main/org/apache/maven/dashboard/aggregator/clover/CloverTPC.java new file mode 100644 index 00000000..bd4fce74 --- /dev/null +++ b/dashboard/src/main/org/apache/maven/dashboard/aggregator/clover/CloverTPC.java @@ -0,0 +1,75 @@ +package org.apache.maven.dashboard.aggregator.clover; + +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" and + * "Apache Maven" must not be used to endorse or promote products + * derived from this software without prior written permission. For + * written permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * "Apache Maven", nor may "Apache" appear in their name, without + * prior written permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + * ==================================================================== + */ + +import java.text.DecimalFormat; + +/** + * @author Vincent Massol + * + * @version $Id: CloverTPC.java,v 1.1 2003/11/05 19:26:59 vmassol Exp $ + */ +public class CloverTPC +{ + public static String computeTPC(String elements, String coveredElements) + { + double e = Double.valueOf(elements).doubleValue(); + double ce = Double.valueOf(coveredElements).doubleValue(); + DecimalFormat formatter = new DecimalFormat("##%"); + return formatter.format(ce/e); + } +} \ No newline at end of file diff --git a/dashboard/src/plugin-resources/reports/cloverloc.jelly b/dashboard/src/plugin-resources/reports/cloverloc.jelly new file mode 100644 index 00000000..320a8118 --- /dev/null +++ b/dashboard/src/plugin-resources/reports/cloverloc.jelly @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dashboard/src/plugin-resources/reports/cloverncloc.jelly b/dashboard/src/plugin-resources/reports/cloverncloc.jelly new file mode 100644 index 00000000..9ee77615 --- /dev/null +++ b/dashboard/src/plugin-resources/reports/cloverncloc.jelly @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dashboard/src/plugin-resources/reports/clovertpc.jelly b/dashboard/src/plugin-resources/reports/clovertpc.jelly new file mode 100644 index 00000000..01bedcd0 --- /dev/null +++ b/dashboard/src/plugin-resources/reports/clovertpc.jelly @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dashboard/src/plugin-resources/reports/checkstyle.jelly b/dashboard/src/plugin-resources/reports/csall.jelly similarity index 51% rename from dashboard/src/plugin-resources/reports/checkstyle.jelly rename to dashboard/src/plugin-resources/reports/csall.jelly index 018fd5ef..22df3b55 100644 --- a/dashboard/src/plugin-resources/reports/checkstyle.jelly +++ b/dashboard/src/plugin-resources/reports/csall.jelly @@ -1,17 +1,22 @@ + + - - + name="${maven.dashboard.aggregator.csall.artifact}"/> - + diff --git a/dashboard/src/plugin-resources/reports/cserrors.jelly b/dashboard/src/plugin-resources/reports/cserrors.jelly new file mode 100644 index 00000000..074559a2 --- /dev/null +++ b/dashboard/src/plugin-resources/reports/cserrors.jelly @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dashboard/src/plugin-resources/reports/cswarnings.jelly b/dashboard/src/plugin-resources/reports/cswarnings.jelly new file mode 100644 index 00000000..538dc929 --- /dev/null +++ b/dashboard/src/plugin-resources/reports/cswarnings.jelly @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dashboard/src/plugin-resources/templates/dashboard.jsl b/dashboard/src/plugin-resources/templates/dashboard.jsl index 39a666ed..4a5e64ca 100644 --- a/dashboard/src/plugin-resources/templates/dashboard.jsl +++ b/dashboard/src/plugin-resources/templates/dashboard.jsl @@ -17,10 +17,10 @@ - + @@ -35,11 +35,11 @@ - + - + diff --git a/dashboard/xdocs/aggregators.xml b/dashboard/xdocs/aggregators.xml new file mode 100644 index 00000000..8cf03f9c --- /dev/null +++ b/dashboard/xdocs/aggregators.xml @@ -0,0 +1,68 @@ + + + + + Maven Dashboard aggregators + Vincent Massol + + + +
+

+ An aggregator is an extension to the dashboard that gathers + metric information that get displayed in the dashboard report. + You can provide your own custom aggregators. The dashboard plugin + comes with several default aggregators described below. +

+
Project + value="maven.dashboard.aggregator.${aggregatorName.value}.label"/>
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Aggregator nameTopicDescription
csallCheckstyle + Computes total number of Checkstyle warnings and errors. +
cserrorsCheckstyle + Computes total number of Checkstyle errors. +
cswarningsCheckstyle + Computes total number of Checkstyle warnings. +
clovertpcClover + Computes total Test Coverage Percentage (TPC) using Clover. +
cloverlocClover + Computes total Line Of Code (LOC) using Clover. +
clovernclocClover + Computes total Non-Commented Line Of Code (NCLOC) using Clover. +
+ + + diff --git a/dashboard/xdocs/index.xml b/dashboard/xdocs/index.xml index baa968cc..3ac87008 100644 --- a/dashboard/xdocs/index.xml +++ b/dashboard/xdocs/index.xml @@ -19,14 +19,17 @@

  • - Pluggable architecture. It allows to add custom probes for any + Pluggable architecture. It allows to add custom aggregators for any kind of report, be them Maven reports or anything else (like - calling an SCM system, calling JIRA, etc). A probe is actually a - Jelly script so that you have the full power of Jelly at your hand. + calling an SCM system, calling JIRA, etc). An aggregator is actually + a Jelly script so that you have the full power of Jelly at your hand.
  • - Provides a default probe for gathering the number of Checkstyle - errors in subprojects. + Provides default aggregators. +
  • +
  • + Allows tight integration in one's own custom reactor and prevents + running reports several times.
@@ -72,8 +75,8 @@ To do this, you need to add the dashboard:report-single goal to the list of goals being run by your reactor. The best option is to ensure this goal is run after the other goals generating the - report artifacts needed by the dashboard probes you're running. In - order to prevent the dashboard:report-single goal from + report artifacts needed by the dashboard aggregators you're running. + In order to prevent the dashboard:report-single goal from automatically calling the report artifact goals, you'll need to add the following property: maven.dashboard.rungoals = false.

diff --git a/dashboard/xdocs/navigation.xml b/dashboard/xdocs/navigation.xml index d7588418..5f1c2f83 100644 --- a/dashboard/xdocs/navigation.xml +++ b/dashboard/xdocs/navigation.xml @@ -10,6 +10,7 @@ + diff --git a/dashboard/xdocs/properties.xml b/dashboard/xdocs/properties.xml index c71fe2e6..2fd35e50 100644 --- a/dashboard/xdocs/properties.xml +++ b/dashboard/xdocs/properties.xml @@ -38,17 +38,17 @@ maven.dashboard.runreactor = true # Properties for gathering dashboard data for a single project # ------------------------------------------------------------ -# Location of default dashboard adaptors -maven.dashboard.reports.dir = ${plugin.resources}/reports +# Location of default dashboard aggregators +maven.dashboard.aggregators.dir = ${plugin.resources}/reports -# List of reports to aggregate -maven.dashboard.reports = checkstyle +# Comma-separated list of aggregators to use +maven.dashboard.aggregators = checkstyle -# Properties for the default checkstyle adaptor -maven.dashboard.report.checkstyle.script = ${maven.dashboard.reports.dir}/checkstyle.jelly -maven.dashboard.report.checkstyle.artifact = ${maven.build.dir}/checkstyle-raw-report.xml -maven.dashboard.report.checkstyle.label = Checkstyle errors -maven.dashboard.report.checkstyle.goal = checkstyle +# Properties for the default checkstyle aggregator +maven.dashboard.aggregator.checkstyle.script = ${maven.dashboard.aggregators.dir}/checkstyle.jelly +maven.dashboard.aggregator.checkstyle.artifact = ${maven.build.dir}/checkstyle-raw-report.xml +maven.dashboard.aggregator.checkstyle.label = Checkstyle errors +maven.dashboard.aggregator.checkstyle.goal = checkstyle # Generated dashboard data for a single project maven.dashboard.report.single = ${maven.build.dir}/dashboard-single.xml