Submitted by: Beno�t Moussaud <benoit.moussaud@criltelecom.com>
Note that I don't use Continuus, so this patch has not been tested for
functionality (it compiles and looks OK, that's all I can check).
Note 2: I'm not sure whether my assumption
<cccheckin>=CCMCheckin
<ccmcheckintask>=ccm.CCMCheckinDefault
is correct.
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269399 13f79535-47bb-0310-9956-ffa450edef68
master
| @@ -39,7 +39,7 @@ Other changes: | |||||
| -------------- | -------------- | ||||
| * New tasks: ear, p4counter, record, cvspass, vsscheckin, vsscheckout, | * New tasks: ear, p4counter, record, cvspass, vsscheckin, vsscheckout, | ||||
| typedef, sleep, mimemail | |||||
| typedef, sleep, mimemail, set of tasks for Continuus/Synergy | |||||
| * Ant now uses JAXP 1.1 | * Ant now uses JAXP 1.1 | ||||
| @@ -0,0 +1,235 @@ | |||||
| <html> | |||||
| <head> | |||||
| <meta http-equiv="Content-Language" content="en-us"> | |||||
| <title>Ant</title> | |||||
| </head> | |||||
| <body> | |||||
| <h1>Continuus Support</h1> | |||||
| <ul> | |||||
| <li><a href="#cccheckin">CCMCheckin</a></li> | |||||
| <li><a href="#cccheckout">CCMCheckout</a></li> | |||||
| <li><a href="#ccmcheckintask">CCMCheckinTask</a></li> | |||||
| <li><a href="#ccmreconfigure">CCMReconfigure</a></li> | |||||
| <li><a href="#ccmcreatetask">CCMCreateTask</a></li> | |||||
| </ul> | |||||
| <p>These ant tasks are wrapper around Continnus Source Manager. It have been tested | |||||
| under version 5.1 on Windows 2000.</p> | |||||
| <hr> | |||||
| <h2><a name="cccheckin">CCMCheckin</a></h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform a Checkin command to Continnus | |||||
| <h3>Parameters</h3> | |||||
| <table border="1" cellpadding="2" cellspacing="0" width="598"> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>file</td> | |||||
| <td>Path to the file that the command will operate on</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>comment</td> | |||||
| <td>Specify a comment.</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>task</td> | |||||
| <td>Specify the task number used to checkin the file (may use 'default')</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>ccmcommand</td> | |||||
| <td>path to the ccm excutable file. default serach into the PATH</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </table> | |||||
| <h3>Examples</h3> | |||||
| <blockquote> | |||||
| <pre><ccmcheckin file="c:/wa/com/foo/MyFile.java" | |||||
| comment="mycomment" /> | |||||
| </pre> | |||||
| </blockquote> | |||||
| <p>Does a Continnuus <i>checkin</i> on the file <i>c:/wa/com/foo/MyFile.java</i>. | |||||
| Comment attribute <i>mycomment</i> is added as a task comment. The task | |||||
| used is the one set as the fault.</p> | |||||
| <hr> | |||||
| <h2><a name="cccheckout">CCMCheckout</a></h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform a Checkout command to Continuus | |||||
| <h3>Parameters</h3> | |||||
| <table border="1" cellpadding="2" cellspacing="0" width="614"> | |||||
| <tr> | |||||
| <th width="84">Attribute</th> | |||||
| <th width="396">Values</th> | |||||
| <th width="24">Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td width="84">file</td> | |||||
| <td width="396">Path to the file that the command will operate on</td> | |||||
| <td width="24">Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td width="84">comment</td> | |||||
| <td width="396">Specify a comment.</td> | |||||
| <td width="24">No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td width="84">task</td> | |||||
| <td width="396">Specify the task number used to checkin the file (may use | |||||
| 'default')</td> | |||||
| <td width="24">No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td width="84">ccmcommand</td> | |||||
| <td width="396">path to the ccm excutable file. default serach into the PATH</td> | |||||
| <td width="24">No</td> | |||||
| </tr> | |||||
| </table> | |||||
| <h3>Examples</h3> | |||||
| <blockquote> | |||||
| <pre><ccmcheckin file="c:/wa/com/foo/MyFile.java" | |||||
| comment="mycomment"/> | |||||
| </pre> | |||||
| </blockquote> | |||||
| <p>Does a Continnuus <i>checkout</i> on the file <i>c:/wa/com/foo/MyFile.java</i>. | |||||
| Comment attribute <i>mycomment</i> is added as a task comment | |||||
| The used task is the one set as the fault.</p> | |||||
| <hr> | |||||
| <h2><a name="ccmcheckintask">CCMCheckinTask</a></h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform a check in default task command to Continnuus | |||||
| <h3>Parameters</h3> | |||||
| <table border="1" cellpadding="2" cellspacing="0"> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>comment</td> | |||||
| <td>Specify a comment.</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>task</td> | |||||
| <td>Specify the task number used to checkin the file (may use 'default')</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>ccmcommand</td> | |||||
| <td>path to the ccm excutable file. default serach into the PATH</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </table> | |||||
| <h3>Examples </h3> | |||||
| <blockquote> | |||||
| <pre><ccmcheckintask comment="blahblah/> | |||||
| </pre> | |||||
| </blockquote> | |||||
| <p>Does a Checkin default task on all the checkou-ed filed in the current task.</p> | |||||
| <hr> | |||||
| <h2><a name="ccmreconfigure">CCMReconfigure</a></h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform an reconfigure command to Continuus. | |||||
| <h3>Parameters</h3> | |||||
| <table border="1" cellpadding="2" cellspacing="0"> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>recurse</td> | |||||
| <td>recurse on subproject (default false)</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>verbose</td> | |||||
| <td>do a verbose reconfigure operation (default false)</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>ccmproject</td> | |||||
| <td>Specifies the ccm project on which the operation is applied.</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>ccmcommand</td> | |||||
| <td>path to the ccm excutable file. default serach into the PATH</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </table> | |||||
| <h3>Examples</h3> | |||||
| <blockquote> | |||||
| <pre><ccmreconfigure ccmproject="ANTCCM_TEST#BMO_1" verbose="true" /> | |||||
| </pre> | |||||
| </blockquote> | |||||
| <p>Does a Continuus <i>reconfiguree</i> on the project <i>ANTCCM_TEST#BMO_1</i>. | |||||
| </p> | |||||
| <hr> | |||||
| <h2><a name="ccmcreatetask">CCMCreateTask</a></h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform an create task command to Continuus. | |||||
| <h3>Parameters</h3> | |||||
| <table border="1" cellpadding="2" cellspacing="0"> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>comment</td> | |||||
| <td>Specify a comment.</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>platform</td> | |||||
| <td>Specify the target platform</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>ccmcommand</td> | |||||
| <td>path to the ccm excutable file. default serach into the PATH</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>resolver</td> | |||||
| <td>Specify the resolver</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>release</td> | |||||
| <td>Specify the CCM release</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>subsystem</td> | |||||
| <td>Specify the subsystem</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>task</td> | |||||
| <td>Specify the task number used to checkin the file (may use 'default')</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </table> | |||||
| <h3>Examples</h3> | |||||
| <blockquote> | |||||
| <pre><ccmcreatetask resolver="{user.name}" release="ANTCCM_TEST" comment="blahblah" /> | |||||
| </pre> | |||||
| </blockquote> | |||||
| <p>Does a Continuus <i>create task</i> for the release <i>ANTCCM_TEST</i> to the | |||||
| current logged person as the resolver for this task.</p> | |||||
| <p> </p> | |||||
| </body> | |||||
| </html> | |||||
| @@ -15,6 +15,7 @@ | |||||
| <a href="OptionalTasks/antlr.html">ANTLR</a><br> | <a href="OptionalTasks/antlr.html">ANTLR</a><br> | ||||
| <a href="OptionalTasks/cab.html">Cab</a><br> | <a href="OptionalTasks/cab.html">Cab</a><br> | ||||
| <a href="OptionalTasks/clearcase.html">Clearcase Tasks</a><br> | <a href="OptionalTasks/clearcase.html">Clearcase Tasks</a><br> | ||||
| <a href="OptionalTasks/ccm.html">Continuus/Synergy Tasks</a><br> | |||||
| <a href="OptionalTasks/depend.html">Depend</a><br> | <a href="OptionalTasks/depend.html">Depend</a><br> | ||||
| <a href="OptionalTasks/ejb.html">EJB Tasks</a><br> | <a href="OptionalTasks/ejb.html">EJB Tasks</a><br> | ||||
| <a href="OptionalTasks/ftp.html">FTP</a><br> | <a href="OptionalTasks/ftp.html">FTP</a><br> | ||||
| @@ -109,6 +109,11 @@ vsscheckout=org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKOUT | |||||
| iplanet-ejbc=org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbcTask | iplanet-ejbc=org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbcTask | ||||
| jdepend=org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask | jdepend=org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask | ||||
| mimemail=org.apache.tools.ant.taskdefs.optional.net.MimeMail | mimemail=org.apache.tools.ant.taskdefs.optional.net.MimeMail | ||||
| cccheckin=org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckin | |||||
| cccheckout=org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckout | |||||
| ccmcheckintask=org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckinDefault | |||||
| ccmreconfigure=org.apache.tools.ant.taskdefs.optional.ccm.CCMReconfigure | |||||
| ccmcreatetask=org.apache.tools.ant.taskdefs.optional.ccm.CCMCreateTask | |||||
| # deprecated ant tasks (kept for back compatibility) | # deprecated ant tasks (kept for back compatibility) | ||||
| javadoc2=org.apache.tools.ant.taskdefs.Javadoc | javadoc2=org.apache.tools.ant.taskdefs.Javadoc | ||||
| @@ -0,0 +1,184 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| import java.io.File; | |||||
| /** | |||||
| * Class common to all check commands (checkout, checkin,checkin default task); | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | |||||
| */ | |||||
| public class CCMCheck extends Continuus { | |||||
| private File _file = null; | |||||
| private String _comment = null; | |||||
| private String _task = null; | |||||
| public CCMCheck() { | |||||
| super(); | |||||
| } | |||||
| /** | |||||
| * Get the value of file. | |||||
| * @return value of file. | |||||
| */ | |||||
| public File getFile() { | |||||
| return _file; | |||||
| } | |||||
| /** | |||||
| * Set the value of file. | |||||
| * @param v Value to assign to file. | |||||
| */ | |||||
| public void setFile(File v) { | |||||
| this._file = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of comment. | |||||
| * @return value of comment. | |||||
| */ | |||||
| public String getComment() { | |||||
| return _comment; | |||||
| } | |||||
| /** | |||||
| * Set the value of comment. | |||||
| * @param v Value to assign to comment. | |||||
| */ | |||||
| public void setComment(String v) { | |||||
| this._comment = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of task. | |||||
| * @return value of task. | |||||
| */ | |||||
| public String getTask() { | |||||
| return _task; | |||||
| } | |||||
| /** | |||||
| * Set the value of task. | |||||
| * @param v Value to assign to task. | |||||
| */ | |||||
| public void setTask(String v) { | |||||
| this._task = v; | |||||
| } | |||||
| /** | |||||
| * Executes the task. | |||||
| * <p> | |||||
| * Builds a command line to execute ccm and then calls Exec's run method | |||||
| * to execute the command line. | |||||
| * </p> | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| Commandline commandLine = new Commandline(); | |||||
| Project aProj = getProject(); | |||||
| int result = 0; | |||||
| // build the command line from what we got the format is | |||||
| // ccm co /t .. files | |||||
| // as specified in the CLEARTOOL.EXE help | |||||
| commandLine.setExecutable(getCcmCommand()); | |||||
| commandLine.createArgument().setValue(getCcmAction()); | |||||
| checkOptions(commandLine); | |||||
| result = run(commandLine); | |||||
| if ( result != 0 ) { | |||||
| String msg = "Failed executing: " + commandLine.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Check the command line options. | |||||
| */ | |||||
| private void checkOptions(Commandline cmd) { | |||||
| if (getComment() != null) { | |||||
| cmd.createArgument().setValue(FLAG_COMMENT); | |||||
| cmd.createArgument().setValue(getComment()); | |||||
| } | |||||
| if ( getTask() != null) { | |||||
| cmd.createArgument().setValue(FLAG_TASK); | |||||
| cmd.createArgument().setValue(getTask()); | |||||
| } // end of if () | |||||
| if ( getFile() != null ) { | |||||
| cmd.createArgument().setValue(_file.getAbsolutePath()); | |||||
| } // end of if () | |||||
| } | |||||
| /** | |||||
| * -comment flag -- comment to attach to the file | |||||
| */ | |||||
| public static final String FLAG_COMMENT = "/comment"; | |||||
| /** | |||||
| * -task flag -- associate checckout task with task | |||||
| */ | |||||
| public static final String FLAG_TASK = "/task"; | |||||
| } | |||||
| @@ -0,0 +1,72 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * Task to perform Checkin command to Continuus | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | |||||
| */ | |||||
| public class CCMCheckin extends CCMCheck { | |||||
| public CCMCheckin() { | |||||
| super(); | |||||
| setCcmAction(COMMAND_CHECKIN); | |||||
| setComment("Checkin "+ new Date()); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,71 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| /** | |||||
| * Task to perform Checkin Default task command to Continuus | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | |||||
| */ | |||||
| public class CCMCheckinDefault extends CCMCheck { | |||||
| public CCMCheckinDefault(){ | |||||
| super(); | |||||
| setCcmAction(COMMAND_CHECKIN); | |||||
| setTask(DEFAULT_TASK); | |||||
| } | |||||
| public static final String DEFAULT_TASK = "default"; | |||||
| } | |||||
| @@ -0,0 +1,68 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| /** | |||||
| * Task to perform Checkout command to Continuus | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | |||||
| */ | |||||
| public class CCMCheckout extends CCMCheck { | |||||
| public CCMCheckout(){ | |||||
| super(); | |||||
| setCcmAction(COMMAND_CHECKOUT); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,366 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| import java.io.BufferedReader; | |||||
| import java.io.File; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStream; | |||||
| import java.io.InputStreamReader; | |||||
| import java.io.OutputStream; | |||||
| import java.lang.NullPointerException; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| /** | |||||
| * Task allows to create new ccm task and set it as the default | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | |||||
| */ | |||||
| public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| private String comment = null; | |||||
| private String platform = null; | |||||
| private String resolver = null; | |||||
| private String release = null; | |||||
| private String subSystem = null; | |||||
| private String task = null; | |||||
| public CCMCreateTask() { | |||||
| super(); | |||||
| setCcmAction(COMMAND_CREATE_TASK); | |||||
| } | |||||
| /** | |||||
| * Executes the task. | |||||
| * <p> | |||||
| * Builds a command line to execute ccm and then calls Exec's run method | |||||
| * to execute the command line. | |||||
| * </p> | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| Commandline commandLine = new Commandline(); | |||||
| Project aProj = getProject(); | |||||
| int result = 0; | |||||
| // build the command line from what we got the format | |||||
| // as specified in the CCM.EXE help | |||||
| commandLine.setExecutable(getCcmCommand()); | |||||
| commandLine.createArgument().setValue(getCcmAction()); | |||||
| checkOptions(commandLine); | |||||
| result = run(commandLine,this); | |||||
| if ( result != 0 ) { | |||||
| String msg = "Failed executing: " + commandLine.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| //create task ok, set this task as the default one | |||||
| Commandline commandLine2 = new Commandline(); | |||||
| commandLine2.setExecutable(getCcmCommand()); | |||||
| commandLine2.createArgument().setValue(COMMAND_DEFAULT_TASK); | |||||
| commandLine2.createArgument().setValue(getTask()); | |||||
| log(commandLine.toString(),Project.MSG_DEBUG); | |||||
| result = run(commandLine2); | |||||
| if ( result != 0 ) { | |||||
| String msg = "Failed executing: " + commandLine2.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Check the command line options. | |||||
| */ | |||||
| private void checkOptions(Commandline cmd) { | |||||
| if (getComment() != null) { | |||||
| cmd.createArgument().setValue(FLAG_COMMENT); | |||||
| cmd.createArgument().setValue("\""+getComment()+"\""); | |||||
| } | |||||
| if ( getPlatform() != null) { | |||||
| cmd.createArgument().setValue(FLAG_PLATFORM); | |||||
| cmd.createArgument().setValue(getPlatform()); | |||||
| } // end of if () | |||||
| if ( getResolver() != null) { | |||||
| cmd.createArgument().setValue(FLAG_RESOLVER); | |||||
| cmd.createArgument().setValue(getResolver()); | |||||
| } // end of if () | |||||
| if ( getSubSystem() != null) { | |||||
| cmd.createArgument().setValue(FLAG_SUBSYSTEM); | |||||
| cmd.createArgument().setValue("\""+getSubSystem()+"\""); | |||||
| } // end of if () | |||||
| if ( getRelease() != null ) { | |||||
| cmd.createArgument().setValue(FLAG_RELEASE); | |||||
| cmd.createArgument().setValue(getRelease()); | |||||
| } // end of if () | |||||
| } | |||||
| /** | |||||
| * Get the value of comment. | |||||
| * @return value of comment. | |||||
| */ | |||||
| public String getComment() { | |||||
| return comment; | |||||
| } | |||||
| /** | |||||
| * Set the value of comment. | |||||
| * @param v Value to assign to comment. | |||||
| */ | |||||
| public void setComment(String v) { | |||||
| this.comment = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of platform. | |||||
| * @return value of platform. | |||||
| */ | |||||
| public String getPlatform() { | |||||
| return platform; | |||||
| } | |||||
| /** | |||||
| * Set the value of platform. | |||||
| * @param v Value to assign to platform. | |||||
| */ | |||||
| public void setPlatform(String v) { | |||||
| this.platform = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of resolver. | |||||
| * @return value of resolver. | |||||
| */ | |||||
| public String getResolver() { | |||||
| return resolver; | |||||
| } | |||||
| /** | |||||
| * Set the value of resolver. | |||||
| * @param v Value to assign to resolver. | |||||
| */ | |||||
| public void setResolver(String v) { | |||||
| this.resolver = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of release. | |||||
| * @return value of release. | |||||
| */ | |||||
| public String getRelease() { | |||||
| return release; | |||||
| } | |||||
| /** | |||||
| * Set the value of release. | |||||
| * @param v Value to assign to release. | |||||
| */ | |||||
| public void setRelease(String v) { | |||||
| this.release = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of subSystem. | |||||
| * @return value of subSystem. | |||||
| */ | |||||
| public String getSubSystem() { | |||||
| return subSystem; | |||||
| } | |||||
| /** | |||||
| * Set the value of subSystem. | |||||
| * @param v Value to assign to subSystem. | |||||
| */ | |||||
| public void setSubSystem(String v) { | |||||
| this.subSystem = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of task. | |||||
| * @return value of task. | |||||
| */ | |||||
| public String getTask() { | |||||
| return task; | |||||
| } | |||||
| /** | |||||
| * Set the value of task. | |||||
| * @param v Value to assign to task. | |||||
| */ | |||||
| public void setTask(String v) { | |||||
| this.task = v; | |||||
| } | |||||
| /** | |||||
| * /comment -- comments associated to the task | |||||
| */ | |||||
| public static final String FLAG_COMMENT = "/synopsis"; | |||||
| /** | |||||
| * /platform flag -- target platform | |||||
| */ | |||||
| public static final String FLAG_PLATFORM = "/plat"; | |||||
| /** | |||||
| * /resolver flag | |||||
| */ | |||||
| public static final String FLAG_RESOLVER = "/resolver"; | |||||
| /** | |||||
| * /release flag | |||||
| */ | |||||
| public static final String FLAG_RELEASE = "/release"; | |||||
| /** | |||||
| * /release flag | |||||
| */ | |||||
| public static final String FLAG_SUBSYSTEM = "/subsystem"; | |||||
| /** | |||||
| * -task flag -- associate checckout task with task | |||||
| */ | |||||
| public static final String FLAG_TASK = "/task"; | |||||
| // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface | |||||
| /** | |||||
| * | |||||
| * @exception java.io.IOException <description> | |||||
| */ | |||||
| public void start() throws IOException { | |||||
| } | |||||
| /** | |||||
| * | |||||
| */ | |||||
| public void stop(){ | |||||
| } | |||||
| /** | |||||
| * | |||||
| * @param param1 <description> | |||||
| * @exception java.io.IOException <description> | |||||
| */ | |||||
| public void setProcessInputStream(OutputStream param1) throws IOException { | |||||
| } | |||||
| /** | |||||
| * | |||||
| * @param param1 <description> | |||||
| * @exception java.io.IOException <description> | |||||
| */ | |||||
| public void setProcessErrorStream(InputStream is) throws IOException { | |||||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | |||||
| String s = reader.readLine(); | |||||
| if ( s != null) | |||||
| { | |||||
| log("err "+s,Project.MSG_DEBUG); | |||||
| } // end of if () | |||||
| } | |||||
| /** | |||||
| * read the output stream to retrieve the new task number. | |||||
| * @param is InputStream | |||||
| * @exception java.io.IOException | |||||
| */ | |||||
| public void setProcessOutputStream(InputStream is) throws IOException { | |||||
| String buffer = ""; | |||||
| try | |||||
| { | |||||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | |||||
| buffer = reader.readLine(); | |||||
| if ( buffer != null) | |||||
| { | |||||
| log("buffer:" +buffer,Project.MSG_DEBUG); | |||||
| String taskstring = buffer.substring(buffer.indexOf(' ')).trim(); | |||||
| taskstring = taskstring.substring(0,taskstring.lastIndexOf(' ')).trim(); | |||||
| setTask(taskstring); | |||||
| log("task is "+getTask(),Project.MSG_DEBUG); | |||||
| } // end of if () | |||||
| } | |||||
| catch ( NullPointerException npe) | |||||
| { | |||||
| log("error procession stream , null pointer exception",Project.MSG_ERR); | |||||
| npe.printStackTrace(); | |||||
| throw new BuildException(npe.getClass().getName()); | |||||
| } // end of catch | |||||
| catch (Exception e) | |||||
| { | |||||
| log("error procession stream "+e.getMessage(),Project.MSG_ERR); | |||||
| throw new BuildException(e.getMessage()); | |||||
| } // end of try-catch | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,202 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| import java.io.BufferedReader; | |||||
| import java.io.File; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStream; | |||||
| import java.io.InputStreamReader; | |||||
| import java.io.OutputStream; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| /** | |||||
| * Task allows to reconfigure a project, recurcively or not | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | |||||
| */ | |||||
| public class CCMReconfigure extends Continuus { | |||||
| private String project = null; | |||||
| private boolean recurse = false; | |||||
| private boolean verbose = false; | |||||
| public CCMReconfigure() { | |||||
| super(); | |||||
| setCcmAction(COMMAND_RECONFIGURE); | |||||
| } | |||||
| /** | |||||
| * Executes the task. | |||||
| * <p> | |||||
| * Builds a command line to execute ccm and then calls Exec's run method | |||||
| * to execute the command line. | |||||
| * </p> | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| Commandline commandLine = new Commandline(); | |||||
| Project aProj = getProject(); | |||||
| int result = 0; | |||||
| // build the command line from what we got the format | |||||
| // as specified in the CCM.EXE help | |||||
| commandLine.setExecutable(getCcmCommand()); | |||||
| commandLine.createArgument().setValue(getCcmAction()); | |||||
| checkOptions(commandLine); | |||||
| result = run(commandLine); | |||||
| if ( result != 0 ) { | |||||
| String msg = "Failed executing: " + commandLine.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Check the command line options. | |||||
| */ | |||||
| private void checkOptions(Commandline cmd) { | |||||
| if ( isRecurse() == true) { | |||||
| cmd.createArgument().setValue(FLAG_RECURSE); | |||||
| } // end of if () | |||||
| if ( isVerbose() == true) { | |||||
| cmd.createArgument().setValue(FLAG_VERBOSE); | |||||
| } // end of if () | |||||
| if (getCcmProject() != null) { | |||||
| cmd.createArgument().setValue(FLAG_PROJECT); | |||||
| cmd.createArgument().setValue(getCcmProject()); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Get the value of project. | |||||
| * @return value of project. | |||||
| */ | |||||
| public String getCcmProject() { | |||||
| return project; | |||||
| } | |||||
| /** | |||||
| * Set the value of project. | |||||
| * @param v Value to assign to project. | |||||
| */ | |||||
| public void setCcmProject(String v) { | |||||
| this.project = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of recurse. | |||||
| * @return value of recurse. | |||||
| */ | |||||
| public boolean isRecurse() { | |||||
| return recurse; | |||||
| } | |||||
| /** | |||||
| * Set the value of recurse. | |||||
| * @param v Value to assign to recurse. | |||||
| */ | |||||
| public void setRecurse(boolean v) { | |||||
| this.recurse = v; | |||||
| } | |||||
| /** | |||||
| * Get the value of verbose. | |||||
| * @return value of verbose. | |||||
| */ | |||||
| public boolean isVerbose() | |||||
| { | |||||
| return verbose; | |||||
| } | |||||
| /** | |||||
| * Set the value of verbose. | |||||
| * @param v Value to assign to verbose. | |||||
| */ | |||||
| public void setVerbose(boolean v) | |||||
| { | |||||
| this.verbose = v; | |||||
| } | |||||
| /** | |||||
| * /recurse -- | |||||
| */ | |||||
| public static final String FLAG_RECURSE = "/recurse"; | |||||
| /** | |||||
| * /recurse -- | |||||
| */ | |||||
| public static final String FLAG_VERBOSE = "/verbose"; | |||||
| /** | |||||
| * /project flag -- target project | |||||
| */ | |||||
| public static final String FLAG_PROJECT = "/project"; | |||||
| } | |||||
| @@ -0,0 +1,167 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.taskdefs.Execute; | |||||
| import org.apache.tools.ant.taskdefs.LogStreamHandler; | |||||
| import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import java.io.File; | |||||
| /** | |||||
| * A base class for creating tasks for executing commands on Continuus 5.1 | |||||
| * <p> | |||||
| * The class extends the task as it operates by executing the ccm.exe program | |||||
| * supplied with Continuus/Synergy. By default the task expects the ccm executable to be | |||||
| * in the path, | |||||
| * you can override this be specifying the ccmdir attribute. | |||||
| * </p> | |||||
| * | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | |||||
| */ | |||||
| public abstract class Continuus extends Task { | |||||
| private String _ccmDir = ""; | |||||
| private String _ccmAction = ""; | |||||
| /** | |||||
| * Get the value of ccmAction. | |||||
| * @return value of ccmAction. | |||||
| */ | |||||
| public String getCcmAction() { | |||||
| return _ccmAction; | |||||
| } | |||||
| /** | |||||
| * Set the value of ccmAction. | |||||
| * @param v Value to assign to ccmAction. | |||||
| */ | |||||
| public void setCcmAction(String v) { | |||||
| this._ccmAction = v; | |||||
| } | |||||
| /** | |||||
| * Set the directory where the ccm executable is located | |||||
| * @param dir the directory containing the ccm executable | |||||
| */ | |||||
| public final void setCcmDir(String dir) { | |||||
| _ccmDir = project.translatePath(dir); | |||||
| } | |||||
| /** | |||||
| * Builds and returns the command string to execute ccm | |||||
| * @return String containing path to the executable | |||||
| */ | |||||
| protected final String getCcmCommand() { | |||||
| String toReturn = _ccmDir; | |||||
| if ( !toReturn.equals("") && !toReturn.endsWith("/") ) { | |||||
| toReturn += "/"; | |||||
| } | |||||
| toReturn += CCM_EXE; | |||||
| return toReturn; | |||||
| } | |||||
| protected int run(Commandline cmd, ExecuteStreamHandler handler) { | |||||
| try { | |||||
| Execute exe = new Execute(handler); | |||||
| exe.setAntRun(getProject()); | |||||
| exe.setWorkingDirectory(getProject().getBaseDir()); | |||||
| exe.setCommandline(cmd.getCommandline()); | |||||
| return exe.execute(); | |||||
| } | |||||
| catch (java.io.IOException e) { | |||||
| throw new BuildException(e, location); | |||||
| } | |||||
| } | |||||
| protected int run(Commandline cmd) { | |||||
| return run(cmd,new LogStreamHandler(this, Project.MSG_VERBOSE, Project.MSG_WARN)); | |||||
| } | |||||
| /** | |||||
| * Constant for the thing to execute | |||||
| */ | |||||
| private static final String CCM_EXE = "ccm"; | |||||
| /** | |||||
| * The 'CreateTask' command | |||||
| */ | |||||
| public static final String COMMAND_CREATE_TASK = "create_task"; | |||||
| /** | |||||
| * The 'Checkout' command | |||||
| */ | |||||
| public static final String COMMAND_CHECKOUT = "co"; | |||||
| /** | |||||
| * The 'Checkin' command | |||||
| */ | |||||
| public static final String COMMAND_CHECKIN = "ci"; | |||||
| /** | |||||
| * The 'Reconfigure' command | |||||
| */ | |||||
| public static final String COMMAND_RECONFIGURE = "reconfigure"; | |||||
| /** | |||||
| * The 'Reconfigure' command | |||||
| */ | |||||
| public static final String COMMAND_DEFAULT_TASK = "default_task"; | |||||
| } | |||||