maven-plugins/file-activity/src/plugin-resources/maven-file-activity-plugin.jsl
2004-04-21 00:55:44 +00:00

110 lines
4.1 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.
*
* ========================================================================
-->
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:x="jelly:xml"
xmlns="dummy" trim="false">
<!-- This needs to be instantiated here to be available in the template matches -->
<j:useBean var="mavenTool" class="org.apache.maven.util.MavenTool"/>
<jsl:template match="changelog">
<document>
<jsl:applyTemplates/>
<properties>
<title>File Activity Analysis</title>
</properties>
<body>
<section name="Activity by File">
<p>
Timeframe: ${maven.activitylog.range} days,
Total Commits:
<x:expr select="count(./changelog-entry)"/>
Total Number of Files Changed:
<x:expr select="count(./changelog-entry/file)"/>
</p>
<table>
<tr>
<th>File Name</th>
<th>Number of times changed</th>
</tr>
<j:set var="fileList" value="${mavenTool.countDescending}"/>
<j:forEach var="key" items="${fileList.keySet()}">
<j:forEach var="name" items="${fileList.get(key)}">
<tr>
<td>
<j:choose>
<j:when test="${pom.repository.url != ''}">
<j:set var="repositoryUrl" value="${pom.repository.url}"/>
<j:choose>
<j:when test="${repositoryUrl.indexOf('?')>0}">
<j:set var="repository" value="${repositoryUrl.substring(0, repositoryUrl.indexOf('?'))}"/>
<j:set var="tmpMultiRepoParam" value="${repositoryUrl.substring(repository.length())}"/>
<j:set var="oneRepoParam" value="?${tmpMultiRepoParam.substring(1)}"/>
</j:when>
<j:otherwise>
<j:set var="repository" value="${repositoryUrl}"/>
<j:set var="oneRepoParam" value=""/>
</j:otherwise>
</j:choose>
<j:choose>
<j:when test="${pom.repository.connection.startsWith('scm:perforce')}">
<j:set var="urlFile" value="${repository.trim()}${name.trim()}?ac=22"/>
</j:when>
<j:otherwise>
<j:set var="urlFile" value="${repository.trim()}${name.trim()}${oneRepoParam.trim()}"/>
</j:otherwise>
</j:choose>
<a href="${urlFile}">${name}</a>
</j:when>
<j:otherwise>
${name}
</j:otherwise>
</j:choose>
</td>
<td>${key}</td>
</tr>
</j:forEach>
</j:forEach>
</table>
</section>
</body>
</document>
</jsl:template>
<jsl:template match="file">
<j:set var="file">
<x:expr select="name"/>
</j:set>
<j:set var="dummy" value="${mavenTool.addToCount(file)}"/>
</jsl:template>
<!-- element values don't pass through as text -->
<jsl:template match="properties"/>
<jsl:template match="section"/>
<jsl:template match="date"/>
<jsl:template match="time"/>
</jsl:stylesheet>