- Added new <code>announcement:generate-all</code> to generate announcement files for all releases.

- Generates the announcement file in <code>${maven.gen.docs}/announcements</code> so that it is copied to the web site when this later is deployed.
- Default announcement file name now contains the version in its name.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol 2004-07-02 20:57:16 +00:00
parent fa628e734a
commit 962e0c4076
6 changed files with 89 additions and 24 deletions

View File

@ -26,25 +26,35 @@
xmlns:util="jelly:util"
xmlns:doc="doc"
xmlns:maven="jelly:maven"
xmlns:jsl="jelly:jsl">
xmlns:jsl="jelly:jsl"
xmlns:announcement="announcement">
<goal name="announcement" prereqs="announcement:generate"
description="Generate release announcement"/>
<goal name="announcement:generate"
description="Generate release announcement">
<goal name="announcement:init">
<echo>Generating announcement for release ${maven.announcement.version} in ${maven.announcement.file}...</echo>
<util:file var="inputFile" name="${maven.docs.src}/changes.xml"/>
<x:parse var="doc" xml="${inputFile}"/>
<maven:property var="versionVariable" name="maven.announcement.version"
defaultValue="${pom.currentVersion}"/>
<maven:property var="announcementFile" name="maven.announcement.file"
defaultValue="${maven.gen.docs}/announcements/announcement-${versionVariable}.txt"/>
<!-- Ensure the directory where the announcement will be created exists -->
<ant:dirname property="announcementDir" file="${announcementFile}"/>
<ant:mkdir dir="${announcementDir}"/>
<util:file var="inputFile" name="${maven.docs.src}/changes.xml"/>
<maven:property var="distributionUrl" name="maven.announcement.distributionUrl"
defaultValue="${maven.repo.remote}/${pom.groupId}/plugins"/>
</goal>
<goal name="announcement:check-version" prereqs="announcement:init">
<x:parse var="doc" xml="${inputFile}"/>
<jsl:stylesheet select="$doc">
<jsl:template match="document/body/release">
<x:set var="version" select="string(@version)"/>
@ -52,22 +62,61 @@
<x:set var="versionFound" select="string(@version)"/>
</j:if>
</jsl:template>
<jsl:template match="@*"/>
<jsl:template match="text()"/>
</jsl:stylesheet>
<j:if test="${versionFound == null}">
<ant:fail>The release '${maven.announcement.version}' could not be found in change log</ant:fail>
</j:if>
<j:set var="stylesheetURI"
value="file:${plugin.resources}/announcement.jsl"/>
<j:file
name="${maven.announcement.file}"
outputMode="xml"
omitXmlDeclaration="true"
prettyPrint="false">
<j:include uri="${stylesheetURI.toString()}"/>
</j:file>
</goal>
<goal name="announcement:generate" prereqs="announcement:check-version"
description="Generate release announcement">
<announcement:generate file="${announcementFile}"/>
</goal>
<goal name="announcement:generate-all" prereqs="announcement:init"
description="Generate release announcement for all releases">
<x:parse var="doc" xml="${inputFile}"/>
<jsl:stylesheet select="$doc">
<jsl:template match="document/body/release">
<x:set var="versionVariable" select="string(@version)"/>
<j:set var="announcementFile"
value="${maven.gen.docs}/announcements/announcement-${versionVariable}.txt"/>
<announcement:generate file="${announcementFile}"/>
</jsl:template>
<jsl:template match="@*"/>
<jsl:template match="text()"/>
</jsl:stylesheet>
</goal>
<!-- Define common jelly script used by different goals as a jelly tag -->
<define:taglib uri="announcement">
<define:tag name="generate">
<!-- @file: Announcement file location -->
<!-- @versionVariable: version for which to generate the announcement -->
<echo>Generating announcement for release ${versionVariable} in ${file}...</echo>
<j:set var="stylesheetURI"
value="file:${plugin.resources}/announcement.jsl"/>
<j:file
name="${file}"
outputMode="xml"
omitXmlDeclaration="true"
prettyPrint="false">
<j:include uri="${stylesheetURI.toString()}"/>
</j:file>
</define:tag>
</define:taglib>
</project>

View File

@ -23,9 +23,6 @@
# For example:
# maven.announcement.version = ${pom.currentVersion}
# Name and location of generated announcement file
maven.announcement.file=${maven.build.dir}/announcement.txt
# Distribution location. For now, this property does not exist in the
# POM (there's only a distributionSite and distributionDirectory which
# doesn't map to anything for the web). We'll need to remove this

View File

@ -29,10 +29,10 @@
xmlns:maven="jelly:maven"
xmlns="dummy" trim="true">
<!-- This stylesheet expects the versionVariable to be defined before calling it -->
<jsl:template match="document/body/release">
<x:set var="version" select="string(@version)"/>
<maven:property var="versionVariable" name="maven.announcement.version" defaultValue="${pom.currentVersion}"/>
<j:if test="${versionVariable.equals(version)}">
<j:useBean var="formatter" class="org.apache.maven.announcement.Formatter"/>

View File

@ -25,6 +25,17 @@
</properties>
<body>
<release version="1.2-SNAPSHOT" date="in CVS">
<action dev="vmassol" type="add">
Added new <code>announcement:generate-all</code> to generate
announcement files for all releases.
</action>
<action dev="vmassol" type="update">
Generates the announcement file in <code>${maven.gen.docs}/announcements</code>
so that it is copied to the web site when this later is deployed.
</action>
<action dev="vmassol" type="update">
Default announcement file name now contains the version in its name.
</action>
</release>
<release version="1.1" date="2004-05-15">
<action dev="brett" type="update">Detect whether the project is a plugin or not by the existence of plugin.jelly in the project directory, and change the wording accordingly.</action>

View File

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@ -37,7 +38,14 @@
<tr>
<td>announcement:generate</td>
<td>
Generate text release announcement.
Generate a release announcement in text format
</td>
</tr>
<tr>
<td>announcement:generate-all</td>
<td>
Generate a release announcement in text format for all releases
found in <code>changes.xml</code>
</td>
</tr>
</table>

View File

@ -45,7 +45,7 @@
The file name that the announcement is generated into.
</td>
<td>
<code>${maven.build.dir}/announcement.txt</code>
<code>${maven.gen.docs}/announcements/announcement-${versionVariable}.txt</code>
</td>
</tr>
<tr>