Files
maven-plugins/cruisecontrol/plugin.jelly
T
vmassol 4abbad55ba - Compute automatically the merge directory automatically (the value of <code>maven.cruisecontrol.logs.mergedirectory</code> if not specified by the user. The computation uses the <code>maven.build.dir</code> property to guess the output directory for JUnit test results.
- Added a new <code>maven.cruisecontrol.logs.pattern</code> property to specify the report files that will be merged by CC. Defaults to <code>*.xml</code>.
- Added a new <code>cruisecontrol:install-local</code> goal to install the generated CC config to a target location on the same machine (it uses a file copy). In the future we could provide other installation mechanisms like ssh, scp, etc.
- Changed the default build status file name to be <code>status.txt</code> which is the default value expected by the CC Webapp.
- New <code>maven.cruisecontrol.work.dir</code> property that specifies what CC work directory to use for the project. Default values of <code>maven.cruisecontrol.checkout.dir</code> and <code>maven.cruisecontrol.logs.dir</code> have been modified to be relative to it.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@154334 13f79535-47bb-0310-9956-ffa450edef68
2005-02-18 18:39:57 +00:00

179 lines
7.4 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 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:util="jelly:util"
xmlns:x="jelly:xml"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns:maven="jelly:maven">
<goal name="cruisecontrol" prereqs="cruisecontrol:configure"/>
<!--==================================================================-->
<!-- Validate necessary properties for Cruise Control -->
<!--==================================================================-->
<goal name="cruisecontrol:validate" prereqs="scm:validate">
<j:set var="cruisecontrolHomeX" value="${maven.cruisecontrol.home}X"/>
<j:set var="ccHome" value="${maven.cruisecontrol.home}" />
<j:if test="${cruisecontrolHomeX == 'X'}">
<ant:fail>You must specify maven.cruisecontrol.home</ant:fail>
</j:if>
<j:set var="nagEmail" value="${pom.build.nagEmailAddress}" />
<j:if test="${empty(nagEmail)}">
<ant:fail>You must specify pom.build.nagEmailAddress</ant:fail>
</j:if>
<j:set var="defaultSuffix" value="${maven.cruisecontrol.mail.defaultsuffix}" />
<j:if test="${defaultSuffix == 'DEFAULT_SUFFIX_NOT_SET'}">
<util:tokenize var="tokens" delim="@">${pom.build.nagEmailAddress}</util:tokenize>
<j:set var="maven.cruisecontrol.mail.defaultsuffix" value="@${tokens[1]}" />
</j:if>
<!-- FIXME: Shouldn't this use the second element of pom.repository.connection -->
<maven:pluginVar var="method" plugin="maven-scm-plugin" property="maven.scm.method"/>
<j:if test="${method == 'cvs'}">
<maven:pluginVar var="root" plugin="maven-scm-plugin" property="maven.scm.cvs.root"/>
<maven:pluginVar var="module" plugin="maven-scm-plugin" property="maven.scm.cvs.module"/>
</j:if>
<j:if test="${method == 'svn'}">
<maven:pluginVar var="root" plugin="maven-scm-plugin" property="maven.scm.svn.root"/>
<maven:pluginVar var="module" plugin="maven-scm-plugin" property="maven.scm.svn.module"/>
</j:if>
<!-- Compute the merge directory automatically if not specified by the user -->
<maven:makeRelativePath var="relativeMavenBuildDir" basedir="${basedir}"
path="${maven.build.dir}" separator="/"/>
<maven:property var="maven.cruisecontrol.logs.mergedirectory"
name="maven.cruisecontrol.logs.mergedirectory"
defaultValue="${maven.cruisecontrol.checkout.dir}/${module}/${relativeMavenBuildDir}/test-reports/"/>
</goal>
<!--==================================================================-->
<!-- Update a configuration file for Cruise Control -->
<!-- Will add or update this project's section -->
<!--==================================================================-->
<goal name="cruisecontrol:configure"
description="Update a Cruise Control configuration file with this project"
prereqs="cruisecontrol:validate">
<j:choose>
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
<j:set var="mavenScript" value="${maven.cruisecontrol.mavenhome}/bin/maven.bat"/>
</j:when>
<j:otherwise>
<j:set var="mavenScript" value="${maven.cruisecontrol.mavenhome}/bin/maven"/>
</j:otherwise>
</j:choose>
<x:parse var="doc"><cruisecontrol></cruisecontrol></x:parse>
<util:available file="${maven.cruisecontrol.config}">
<util:file var="inputFile" name="${maven.cruisecontrol.config}" />
<x:parse var="doc" xml="${inputFile}" />
</util:available>
<!-- Question: Why is the tmp file required? Is it to prevent CC reloading
the config.xml during the generation? If so we need to comment this as
it's not obvious... -->
<ant:mkdir dir="${maven.cruisecontrol.build.dir}" />
<j:set
var="tempConfigFile"
value="${maven.cruisecontrol.build.dir}/config-temp.xml" />
<j:set
var="stylesheet"
value="file:${maven.cruisecontrol.template}" />
<j:file name="${tempConfigFile}" outputMode="xml" prettyPrint="yes">
<j:include uri="${stylesheet.toString()}" />
</j:file>
<ant:copy file="${tempConfigFile}" tofile="${maven.cruisecontrol.config}" />
<ant:delete file="${tempConfigFile}"/>
</goal>
<!--==================================================================-->
<!-- Run Cruise Control -->
<!--==================================================================-->
<goal name="cruisecontrol:run"
description="Run Cruise Control"
prereqs="cruisecontrol:validate">
<!-- Verify if work directory exists -->
<util:file var="workDirAsFile" name="${maven.cruisecontrol.work.dir}"/>
<j:choose>
<j:when test="${workDirAsFile.exists()}">
<ant:java jar="${maven.cruisecontrol.home}/main/dist/cruisecontrol.jar"
fork="true" dir="${maven.cruisecontrol.work.dir}">
<arg line="-projectname ${pom.artifactId}"/>
</ant:java>
</j:when>
<j:otherwise>
<ant:echo>You must have a work directory (${maven.cruisecontrol.work.dir}) set up before trying to run Cruisecontrol.</ant:echo>
</j:otherwise>
</j:choose>
</goal>
<goal name="cruisecontrol:install-local" prereqs="cruisecontrol:configure">
<!-- Only deploy if the work dir property has been set to a location
different than the default -->
<j:choose>
<j:when test="${!context.getVariable('maven.cruisecontrol.work.dir').equals(context.getVariable('maven.cruisecontrol.build.dir'))}">
<ant:mkdir dir="${maven.cruisecontrol.work.dir}"/>
<ant:copy tofile="${maven.cruisecontrol.work.dir}/config.xml"
file="${maven.cruisecontrol.config}"/>
<attainGoal name="cruisecontrol:checkout"/>
</j:when>
<j:otherwise>
<ant:echo>You need to customize maven.cruisecontrol.work.dir to the real location</ant:echo>
</j:otherwise>
</j:choose>
</goal>
<goal name="cruisecontrol:checkout">
<maven:set plugin="maven-scm-plugin" property="maven.scm.checkout.dir"
value="${maven.cruisecontrol.checkout.dir}"/>
<!-- This needs SCM 1.5 and it needs support for the URL notation with
the module specified after a colon or to find another way to
get the module
<attainGoal name="scm:checkout"/>
-->
</goal>
<goal name="maven-cruisecontrol-plugin:report">
<!-- TODO: download and transform instead of linking to it -->
</goal>
<goal name="maven-cruisecontrol-plugin:register">
<doc:registerReport
name="CC Build Results"
pluginName="maven-cruisecontrol-plugin"
externalLink="${maven.cruisecontrol.buildresults.url}"
description="See the cruise control build results page for this project." />
</goal>
<goal name="maven-cruisecontrol-plugin:deregister">
<doc:deregisterReport name="CC Build Results"/>
</goal>
</project>