aheritier 241b65b1d4 PR: MPDASHBOARD-34
Submitted by: Philippe Kernevez
Reviewed by: aheritier
Cobertura aggregator don't support offline mode. The workaround for the jelly bug makes this aggregator only compatible with maven 1.1+.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@351521 13f79535-47bb-0310-9956-ffa450edef68
2005-12-01 23:33:35 +00:00

46 lines
1.8 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Copyright 2004 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.
*/
-->
<!--
========================================================================
Cobertura aggregator. Extracts Cobertura %lines.
========================================================================
-->
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:u="jelly:util">
<u:file var="artifactAsFile"
name="${maven.dashboard.aggregator.coberturalipc.artifact}"/>
<j:choose>
<j:when test="${artifactAsFile.exists()}">
<u:loadText encoding="UTF-8" file="${maven.dashboard.aggregator.coberturalipc.artifact}" var="artifactAsText" />
<u:replace new="" old="&lt;!DOCTYPE coverage SYSTEM &#0034;http://cobertura.sourceforge.net/xml/coverage-02.dtd&#0034;>"
var="fileWithoutDTD" value="${artifactAsText}"/>
<x:parse var="doc" text="${fileWithoutDTD}"/>
<x:expr select="floor(100*count($doc/coverage/packages/package/classes/class/lines/line[@hits>0]) div count($doc/coverage/packages/package/classes/class/lines/line[@number>0])+0.5)"/>
%
</j:when>
<j:otherwise>
<j:expr value="-"/>
</j:otherwise>
</j:choose>
</j:jelly>