maven-plugins/gump/plugin.jelly
2004-04-04 04:14:54 +00:00

121 lines
4.7 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:define="jelly:define"
xmlns:gump="gump"
xmlns:maven="jelly:maven"
xmlns:j="jelly:core"
xmlns:u="jelly:util">
<!-- ================================================================== -->
<!-- G U M P D E S C R I P T O R -->
<!-- ================================================================== -->
<!-- Converts a Maven descriptor to Gump format so that projects -->
<!-- using Maven can easily participate in Gump builds. This also -->
<!-- means that the Gump descriptor will be accurate because if -->
<!-- the project builds with Maven then the descriptor generated -->
<!-- for Gump will be correct. Distribution of responsibility. -->
<!-- ================================================================== -->
<goal name="gump"
description="Generate Gump descriptor from Maven descriptor"
prereqs="gump:generate-descriptor"/>
<define:taglib uri="gump">
<define:tag name="name" trim="yes">
<u:properties var="map" file="${plugin.resources}/maven2gump.properties" />
<j:set var="gumpName" value="${map.getProperty(project)}" />
<j:if test="${empty(gumpName)}">${project}</j:if>
<j:if test="${!empty(gumpName)}">${gumpName}</j:if>
</define:tag>
</define:taglib>
<goal name="gump:generate-descriptor"
description="Generate Gump descriptor from Maven descriptor">
<j:set var="gumpProject"><gump:name project="${pom.artifactId}"/></j:set>
<j:file name="${basedir}/gump.xml" prettyPrint="true" xmlns="dummy">
<module name="${gumpProject}">
<description>${pom.shortDescription}</description>
<url href="${pom.url}"/>
<u:tokenize var="scmTokens" delim=":">${pom.repository.connection}</u:tokenize>
<cvs repository="${pom.gumpRepositoryId}"
module="${scmTokens[5]}" />
<!-- This is really the cvs module. We need to change this but -->
<!-- I will leave this for now until everything works. -->
<project name="${gumpProject}">
<!-- Standard Maven target to produce Javadocs, source -->
<!-- and binary distributions. -->
<ant buildfile="build.xml" target="dist">
<property name="final.name" value="${pom.artifactId}-@@DATE@@"/>
</ant>
<package>${pom.package}</package>
<j:new var="dependentProjects" className="java.util.TreeSet" />
<!-- All Maven projects need Ant and Xerces to build. -->
<j:set var="dummy" value="${dependentProjects.add('jakarta-ant')}" />
<j:set var="dummy" value="${dependentProjects.add('xml-xerces')}"/>
<!--
Add project dependencies to the set, using project Id only
If there is a gump project mapping for the named maven
dependency, use that for the project in the depend tag
otherwise just use the project id
-->
<j:forEach var="dependency" items="${pom.dependencies}">
<j:set var="gumpDepName"><gump:name project="${dependency.groupId}" /></j:set>
<j:set var="dummy">${dependentProjects.add(gumpDepName)}</j:set>
</j:forEach>
<!-- dump out the set of dependencies -->
<j:forEach var="dependency" items="${dependentProjects}">
<depend project="${dependency}" />
</j:forEach>
<maven:makeRelativePath basedir="${basedir}" var="mavenBuildDest" separator="/" path="${maven.build.dest}" />
<work nested="${mavenBuildDest}"/>
<maven:makeRelativePath basedir="${basedir}" var="mavenBuildDir" separator="/" path="${maven.build.dir}" />
<home nested="${mavenBuildDir}"/>
<jar name="${pom.artifactId}-@@DATE@@.jar"/>
<u:tokenize var="moduleTokens" delim="/">${scmTokens[5]}</u:tokenize>
<maven:makeRelativePath basedir="${basedir}" var="mavenDocsDest" separator="/" path="${maven.docs.dest}" />
<javadoc nested="${mavenDocsDest}/apidocs" module="${moduleTokens[0]}"/>
<nag from="${pom.artifactId} development &lt;${pom.build.nagEmailAddress}&gt;"
to="${pom.build.nagEmailAddress}"/>
</project>
</module>
</j:file>
</goal>
</project>