2007-04-25 12:28:56 +00:00

170 lines
6.7 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:changelog="changelog"
xmlns:doc="doc"
xmlns:util="jelly:util"
xmlns:x="jelly:xml"
xmlns:maven="jelly:maven">
<goal name="maven-changelog-plugin:register">
<j:if test="${context.getVariable('maven.mode.online') == null}">
<j:set var="maven.mode.online" value="true" />
</j:if>
<j:if test="${maven.mode.online}">
<doc:registerReport
name="Change Log"
pluginName="maven-changelog-plugin"
link="changelog-report"
description="Report on the source control changelog."/>
</j:if>
</goal>
<goal name="maven-changelog-plugin:deregister">
<doc:deregisterReport name="Change Log"/>
</goal>
<define:taglib uri="changelog">
<define:jellybean
name="changelog"
className="org.apache.maven.changelog.ChangeLog"
method="doExecute"
/>
</define:taglib>
<!-- ================================================================== -->
<!-- C H A N G E L O G R E P O R T -->
<!-- ================================================================== -->
<goal
name="maven-changelog-plugin:report"
description="Generate a changelog report">
<j:if test="${context.getVariable('maven.mode.online') == null}">
<j:set var="maven.mode.online" value="true"/>
</j:if>
<j:choose>
<j:when test="${maven.mode.online}">
<j:set var="_connection">${pom.repository.connection}</j:set>
<j:if test="${empty(_connection)}">
<j:set var="_connection">${pom.repository.developerConnection}</j:set>
</j:if>
<j:set var="_useDeveloperConnection">${maven.changelog.useDeveloperConnection}</j:set>
<j:if test="${_useDeveloperConnection}">
<j:set var="_connection">${pom.repository.developerConnection}</j:set>
</j:if>
<j:if test="${!empty(_connection)}">
<!-- Make sure the correct properties are set -->
<j:switch on="${maven.changelog.type}">
<j:case value="range">
<!-- It's okay not to have a range (to support Subversion on web-based repositories). -->
</j:case>
<j:case value="date">
<maven:paramCheck value="${maven.changelog.date}" fail="true">
The maven.changelog.date property is required when maven.changelog.type==date. The value should be the absolute date for the start of the log.
</maven:paramCheck>
<j:set var="_changelogdate" value="${maven.changelog.date}"/>
<j:if test="${_changelogdate == 'lastRelease'}">
<util:file var="changesAsFile"
name="${maven.docs.src}/changes.xml"/>
<j:choose>
<j:when test="${changesAsFile.exists()}">
<x:parse var="doc" xml="${changesAsFile}"/>
<x:set var="versionElems"
select="$doc//release[contains(@date,'-')]"/>
<j:choose>
<j:when test="${not(versionElems.isEmpty())}">
<j:set var="maven.changelog.date">${versionElems.get(0).attributeValue('date')}</j:set>
</j:when>
<j:otherwise>
<ant:fail>Release date must be of the form yyyy-mm-dd!</ant:fail>
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<ant:fail>No changes.xml found in ${maven.docs.src}!</ant:fail>
</j:otherwise>
</j:choose>
</j:if>
</j:case>
<j:case value="tag">
<maven:paramCheck value="${maven.changelog.tag}" fail="true">
The maven.changelog.tag property is required when maven.changelog.type==tag. The value should be the value of the tag for the start of the log.
</maven:paramCheck>
</j:case>
<j:default>
<ant:fail>The maven.changelog.type property has an invalid value: ${maven.changelog.type} The value should be "range", "date", or "tag".</ant:fail>
</j:default>
</j:switch>
<!-- Generate the report -->
<ant:echo>Generating the changelog report</ant:echo>
<changelog:changelog
basedir="${maven.changelog.basedir}"
developers="${pom.developers}"
factory="${maven.changelog.factory}"
output="${maven.build.dir}/changelog.xml"
outputEncoding="${maven.docs.outputencoding}"
type="${maven.changelog.type}"
range="${maven.changelog.range}"
date="${maven.changelog.date}"
tag="${maven.changelog.tag}"
quoteDate="${maven.changelog.quoteDate}"
repositoryConnection="${_connection}"
dateFormat="${maven.changelog.dateformat}"
commentFormat="${maven.changelog.commentFormat}"
/>
<doc:jsl
input="${maven.build.dir}/changelog.xml"
output="changelog-report.xml"
stylesheet="${plugin.resources}/changelog.jsl"
encoding="${maven.docs.outputencoding}"
outputMode="xml"
prettyPrint="true"
/>
</j:if>
</j:when>
<j:otherwise>
<ant:echo>The Changelog is available in the online mode only.</ant:echo>
</j:otherwise>
</j:choose>
</goal>
<goal name="changelog:create-cvspass">
<maven:paramCheck value="${password}" fail="false">
Warning: You have provided an empty password
To provide a password to set for the cvs repository,
Please run the goal again using:
maven -Dpassword=XXXXXX changelog:create-cvspass</maven:paramCheck>
<echo>Setting password for ${pom.repository.cvsRoot}</echo>
<cvspass cvsroot="${pom.repository.cvsRoot}" password="${password}"/>
</goal>
</project>