Files
maven-plugins/file-activity/src/plugin-resources/maven-file-activity-plugin.jsl
T
ltheussl 7ed68a1151 PR: MPFILEACTIVITY-3
Submitted by: Dennis Lundberg
Only show the timeframe when maven.changelog.type=range.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@408950 13f79535-47bb-0310-9956-ffa450edef68
2006-05-23 16:00:56 +00:00

134 lines
5.2 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
* ========================================================================
*
* Copyright 2004-2006 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>
<properties>
<title>File Activity Analysis</title>
</properties>
<body>
<section name="Activity by File">
<jsl:applyTemplates select="changeset" />
</section>
</body>
</document>
</jsl:template>
<jsl:template match="changeset">
<j:set var="logstart"><x:expr select="@start"/></j:set>
<j:set var="logend"><x:expr select="@end"/></j:set>
<j:choose>
<j:when test="${empty(logstart) and empty(logend)}">
<j:set var="setname">Changes from an unknown range</j:set>
</j:when>
<j:when test="${empty(logend)}">
<j:set var="setname">Changes since ${logstart}</j:set>
</j:when>
<j:otherwise>
<j:set var="setname">Changes between ${logstart} and ${logend}</j:set>
</j:otherwise>
</j:choose>
<subsection name="${setname}">
<p>
<j:set var="type" value="${maven.changelog.type}"/>
<j:if test="${type == 'range'}">
Timeframe: ${maven.changelog.range} days,
</j:if>
Total Commits:
<x:expr select="count(./changelog-entry)"/>
Total Number of Files Changed:
<x:expr select="count(./changelog-entry/file)"/>
</p>
<jsl:applyTemplates />
<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:when test="${pom.repository.connection.startsWith('scm:svn')}">
<j:set var="urlFile" value="${maven.changelog.svn.baseurl.trim()}${name.trim()}"/>
</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>
</subsection>
</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>