Added new <code>issue</code> attribute to <code>&lt;action&gt;</code> elements in <code>changes.xml</code> file. Fixes MPCHANGES-1.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114337 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol committed 2003-11-15 20:13:09 +00:00
1 parent f18cbaf95e
commit c344f7dc77
5 files changed
+166 -10

No files matched your search

+9
View File
@@ -3,3 +3,12 @@
# -------------------------------------------------------------------
# changes plugin.
# -------------------------------------------------------------------
# Template that is used to discover the URL to use to display a bug report.
# There are 2 template tokens you can use:
# %URL%: this is computed by getting the <issueTrackingUrl> value from the
# POM, and removing the context path.
# %ISSUE% : this is the issue number.
# The default template below is the one for the JIRA bug tracker.
maven.changes.issue.template = %URL%/ViewIssue.jspa?key=%ISSUE%
@@ -0,0 +1,121 @@
package org.apache.maven.changes;
/* ====================================================================
* 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
* <http://www.apache.org/>.
*
* ====================================================================
*/
/**
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
* @version $Id: IssueFinder.java,v 1.1 2003/11/15 20:13:08 vmassol Exp $
*/
public class IssueFinder
{
/**
* @param trackerURL the issue tracker URL (this is supposed to be the
* value of &lt;issueTrackingUrl&gt; found in the POM.
* @param isue the issue reference
* @param template the template string. Allowed template patterns are
* <code>%URL%</code> and <code>%ISSUE%</code>. They will be
* replaced by the base tracker URL extracted from trackerURL and
* by the issue reference.
* @return
*/
public static String getIssueURL(String trackerURL, String issue,
String template)
{
// Find base URL of issue tracker
String baseURL;
int pos = trackerURL.lastIndexOf("/");
if (pos > 0) {
baseURL = trackerURL.substring(0, pos - 1);
} else {
throw new RuntimeException("Failed to extract tracker URL from ["
+ trackerURL + "]");
}
// Use template to construct issue URL
String issueURL = replace(template, "%URL%", baseURL);
issueURL = replace(issueURL, "%ISSUE%", issue);
return issueURL;
}
/**
* @param original the original template
* @param oldPattern the pattern to replace
* @param newPattern the new pattern
* @return the modified template string with patterns applied
*/
public static final String replace(String original, String oldPattern,
String newPattern)
{
int index, oldIndex;
StringBuffer buffer = new StringBuffer();
if((index = original.indexOf(oldPattern)) != -1) {
oldIndex = 0;
while((index = original.indexOf(oldPattern, oldIndex)) != -1) {
buffer.append(original.substring(oldIndex, index));
buffer.append(newPattern);
oldIndex = index + oldPattern.length();
}
buffer.append(original.substring(oldIndex));
original = buffer.toString();
}
return original;
}
}
+10 -1
View File
@@ -51,9 +51,18 @@
<jsl:template match="action">
<j:set var="type"><x:expr select="@type"/></j:set>
<j:set var="dev"><x:expr select="@dev"/></j:set>
<j:set var="issue"><x:expr select="@issue"/></j:set>
<tr>
<td><img src="images/${type}.gif" alt="${type}"/></td>
<td><jsl:applyTemplates trim="false"/></td>
<td>
<jsl:applyTemplates trim="false"/>
<j:if test="${issue != null}">
<j:useBean var="finder" class="org.apache.maven.changes.IssueFinder"/>
<j:set var="template" value="${maven.changes.issue.template}"/>
<j:set var="trackerURL" value="${pom.issueTrackingUrl}"/>
Fixes <a href="${finder.getIssueURL(trackerURL,issue,template)}">${issue}</a>
</j:if>
</td>
<td><a href="team-list.html#${dev}">${dev}</a></td>
</tr>
</jsl:template>
+6 -4
View File
@@ -8,8 +8,11 @@
<body>
<release version="1.3" date="in CVS">
<action dev="vmassol" type="fix">
<a href="http://jira.codehaus.org/secure/ViewIssue.jspa?key=MPCHANGES-3">MPCHANGES-3</a>.
<action dev="vmassol" type="fix" issue="MPCHANGES-1">
Added new <code>issue</code> attribute to <code>&lt;action&gt;</code>
elements in <code>changes.xml</code> file.
</action>
<action dev="vmassol" type="fix" issue="MPCHANGES-3">
HTML tags entered inside <code>&lt;action&gt;</code> tags now show up
in the generated report.
</action>
@@ -22,8 +25,7 @@
<action dev="dion" type="update">
Update to use maven.docs.*/maven.gen.docs
</action>
<action dev="evenisse" type="add">
<a href="http://jira.codehaus.org/ViewIssue.jspa?key=MAVEN-587">Maven-587</a>.
<action dev="evenisse" type="add" issue="MPCHANGES-4">
Add index table of release.
</action>
<action dev="evenisse" type="fix">
+20 -5
View File
@@ -2,15 +2,30 @@
<document>
<properties>
<title>Changes Properties</title>
<title>Changes plugin properties</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Changes Properties">
<p>
There are no properties for this plugin.
</p>
<section name="Changes plugin properties">
<table>
<tr><th>Property</th><th>Optional?</th><th>Description</th><th>Default</th></tr>
<tr>
<td>maven.changes.issue.template</td>
<td>Yes</td>
<td>
Template string that is used to discover the URL to use to display
a bug report. There are 2 template tokens you can use.
<code>%URL%</code>: this is computed by getting the
<code>&lt;issueTrackingUrl&gt;</code> value from the POM, and
removing the context path. <code>%ISSUE%</code> : this is the issue
number. The default template is the one for the JIRA bug tracker.
</td>
<td>
<code>%URL%/ViewIssue.jspa?key=%ISSUE%</code>
</td>
</tr>
</table>
</section>
</body>
</document>