maven-plugins/gump/plugin.jelly

106 lines
4.0 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:multiproject="multiproject"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:maven="jelly:maven"
xmlns:j="jelly:core"
xmlns:x="jelly:xml"
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:gump" />
<goal name="gump:gump"
description="Generate Gump descriptor from Maven descriptor"
prereqs="gump:generate-descriptor"/>
<goal name="gump:generate-descriptor"
description="Generate Gump descriptor from Maven descriptor"
prereqs="gump:init">
<j:new var="reactorProjects" className="java.util.ArrayList" />
<j:set var="dummy" value="${reactorProjects.add(pom)}" />
<j:set var="goal" value="gump:gump" />
<ant:echo>Generating ${maven.gump.descriptor}...</ant:echo>
<j:import file="${plugin.resources}/module.jelly" inherit="true" />
</goal>
<goal name="gump:init">
<j:set var="genAnt" value="${maven.gump.ant.generate}" />
<j:set var="genMaven" value="${maven.gump.maven.generate}" />
<j:if test="${!genAnt and !genMaven}">
<fail>You must specify one of maven.gump.ant and maven.gump.maven</fail>
</j:if>
<u:tokenize var="scmTokens" delim=":">${pom.repository.connection}</u:tokenize>
<j:choose>
<j:when test="${scmTokens[1] == 'cvs'}">
<j:set var="moduleName" value="${scmTokens[5]}"/>
</j:when>
<j:when test="${scmTokens[1] == 'svn'}">
<j:if test="${empty(context.getVariable('maven.gump.svn.dir'))}">
<ant:fail>You must specify maven.gump.svn.dir as the directory under the gump repository in SVN</ant:fail>
</j:if>
</j:when>
<j:otherwise>
<ant:echo>Unknown SCM type ${scmTokens[1]}: you may need to manually add the repository</ant:echo>
</j:otherwise>
</j:choose>
</goal>
<multiproject:dependency-handle />
<goal name="gump:multiproject"
description="Generate a single gump descriptor for a set of Maven projects"
prereqs="gump:init">
<maven:get plugin="maven-multiproject-plugin" property="maven.multiproject.includes" var="includes" />
<maven:get plugin="maven-multiproject-plugin" property="maven.multiproject.excludes" var="excludes" />
<maven:reactor
basedir="${basedir}"
banner="Generating gump descriptor for:"
includes="${includes}"
excludes="${excludes}"
postProcessing="true"
ignoreFailures="true"/>
<j:set var="goal" value="gump:multiproject" />
<ant:echo>Generating ${maven.gump.descriptor}...</ant:echo>
<j:import file="${plugin.resources}/module.jelly" inherit="true" />
</goal>
</project>