vmassol 962e0c4076 - 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
2004-07-02 20:57:16 +00:00

123 lines
3.9 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<project
xmlns:j="jelly:core"
xmlns:x="jelly:xml"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:util="jelly:util"
xmlns:doc="doc"
xmlns:maven="jelly:maven"
xmlns:jsl="jelly:jsl"
xmlns:announcement="announcement">
<goal name="announcement" prereqs="announcement:generate"
description="Generate release announcement"/>
<goal name="announcement:init">
<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)"/>
<j:if test="${versionVariable.equals(version)}">
<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>
</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>