Maven 1.x Clover Plugin

Add PDF report support

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7
  • Fix Version/s: 1.9
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Activity

Hide
Olivier Jacob added a comment -

Here is a proposition for this feature :

<goal name="clover:report" prereqs="clover:init" description="Generates the Clover reports">
<!-- Skip reports if no coverage database has been created. -->
<u:file var="cloverDatabaseAsFile" name="${maven.clover.database}"/>
<j:choose>
<j:when test="${cloverDatabaseAsFile.exists()}">
[...]
<j:if test="${context.getVariable('maven.clover.report.pdf') == 'true'}">
<attainGoal name="clover:pdf-report-internal"/>
</j:if>
</j:when>
[...]
</j:choose>
</goal>

<!--
========================================================================
Generate PDF test coverage
========================================================================
-->
<goal name="clover:pdf-report-internal">
<j:set var="cloverReportDirectory" value="${maven.docs.dest}/clover"/>
<j:set var="cloverPDFReportFile" value="${cloverReportDirectory}/clover-report.pdf"/>
<ant:mkdir dir="${cloverReportDirectory}"/>
<ant:clover-report>
<ant:current outfile="${cloverPDFReportFile}" title="${pom.name} - ${pom.currentVersion}" summary="true">
<ant:format type="pdf" orderBy="${maven.clover.orderBy}">
<!-- Add context filtering -->
<j:set var="contextFilters" value="${maven.clover.context.method.names} ${maven.clover.context.statement.names} ${maven.clover.context.block.names}"/>
<j:if test="${!empty(contextFilters.trim())}">
<ant:setProperty name="filter" value="${contextFilters}"/>
</j:if>
</ant:format>
</ant:current>
<!-- Only generate history report if there is at least one history point -->
<j:if test="${historyDirAsFile.exists() and !empty(historyDirAsFile.listFiles())}">
<j:set var="cloverHistoryReportDirectory" value="${maven.docs.dest}/clover/history"/>
<j:set var="cloverPDFHistoricalReportFile" value="${cloverReportDirectory}/clover-history-report.pdf"/>
<ant:mkdir dir="${cloverHistoryReportDirectory}"/>
<ant:historical outfile="${cloverPDFHistoryReportFile}" historyDir="${maven.clover.history.dir}" title="${pom.name} - ${pom.currentVersion} - History">
<ant:format type="pdf"/>
</ant:historical>
</j:if>
</ant:clover-report>
</goal>
<goal name="clover:pdf-report" description="Generate PDF test coverage reports with Clover" prereqs="clover:test,clover:pdf-report-internal"/>

New property : maven.clover.report.pdf (true|false)

Does it fit the need ?


Olivier

Show
Olivier Jacob added a comment - Here is a proposition for this feature : <goal name="clover:report" prereqs="clover:init" description="Generates the Clover reports"> <!-- Skip reports if no coverage database has been created. --> <u:file var="cloverDatabaseAsFile" name="${maven.clover.database}"/> <j:choose> <j:when test="${cloverDatabaseAsFile.exists()}"> [...] <j:if test="${context.getVariable('maven.clover.report.pdf') == 'true'}"> <attainGoal name="clover:pdf-report-internal"/> </j:if> </j:when> [...] </j:choose> </goal> <!-- ======================================================================== Generate PDF test coverage ======================================================================== --> <goal name="clover:pdf-report-internal"> <j:set var="cloverReportDirectory" value="${maven.docs.dest}/clover"/> <j:set var="cloverPDFReportFile" value="${cloverReportDirectory}/clover-report.pdf"/> <ant:mkdir dir="${cloverReportDirectory}"/> <ant:clover-report> <ant:current outfile="${cloverPDFReportFile}" title="${pom.name} - ${pom.currentVersion}" summary="true"> <ant:format type="pdf" orderBy="${maven.clover.orderBy}"> <!-- Add context filtering --> <j:set var="contextFilters" value="${maven.clover.context.method.names} ${maven.clover.context.statement.names} ${maven.clover.context.block.names}"/> <j:if test="${!empty(contextFilters.trim())}"> <ant:setProperty name="filter" value="${contextFilters}"/> </j:if> </ant:format> </ant:current> <!-- Only generate history report if there is at least one history point --> <j:if test="${historyDirAsFile.exists() and !empty(historyDirAsFile.listFiles())}"> <j:set var="cloverHistoryReportDirectory" value="${maven.docs.dest}/clover/history"/> <j:set var="cloverPDFHistoricalReportFile" value="${cloverReportDirectory}/clover-history-report.pdf"/> <ant:mkdir dir="${cloverHistoryReportDirectory}"/> <ant:historical outfile="${cloverPDFHistoryReportFile}" historyDir="${maven.clover.history.dir}" title="${pom.name} - ${pom.currentVersion} - History"> <ant:format type="pdf"/> </ant:historical> </j:if> </ant:clover-report> </goal> <goal name="clover:pdf-report" description="Generate PDF test coverage reports with Clover" prereqs="clover:test,clover:pdf-report-internal"/> New property : maven.clover.report.pdf (true|false) Does it fit the need ? – Olivier
Hide
Vincent Massol added a comment -

Thanks Olivier! I've added the missing tests and fixed a few things (Good that I tested it as there were some errors in the historical PDF report ). I've also updated the properties.xml and changes.xml files.

Show
Vincent Massol added a comment - Thanks Olivier! I've added the missing tests and fixed a few things (Good that I tested it as there were some errors in the historical PDF report ). I've also updated the properties.xml and changes.xml files.
Hide
Olivier Jacob added a comment -

Yes I ran into a problem too, but could not find a fix immediatly :\

Show
Olivier Jacob added a comment - Yes I ran into a problem too, but could not find a fix immediatly :\

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: