ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm CCMCheck.java
Date Sat, 01 Feb 2003 06:09:03 GMT
conor       2003/01/31 22:09:02

  Modified:    .        WHATSNEW
               docs/manual/OptionalTasks ccm.html
               src/main/org/apache/tools/ant/taskdefs/optional/ccm
                        CCMCheck.java
  Log:
  Add support for filesets to ccmcheckout
  
  PR:	14857
  Submitted By: 	Benoit Moussaud
  
  Revision  Changes    Path
  1.351     +1 -1      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.350
  retrieving revision 1.351
  diff -u -w -u -r1.350 -r1.351
  --- WHATSNEW	31 Jan 2003 12:15:18 -0000	1.350
  +++ WHATSNEW	1 Feb 2003 06:09:02 -0000	1.351
  @@ -175,7 +175,7 @@
   
   * Shipped XML parser is now Xerces 2.3.0
   
  -* <style> has a new attribute reuseloadedstylesheet to work around a
  +* <style> has a new attribute reloadstylesheet to work around a
     bug in widespread Xalan versions.
   
   * <tarfileset> has a new dirmode attribute to specify the permissions
  
  
  
  1.8       +26 -6     jakarta-ant/docs/manual/OptionalTasks/ccm.html
  
  Index: ccm.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/ccm.html,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -u -r1.7 -r1.8
  --- ccm.html	4 Sep 2002 11:05:18 -0000	1.7
  +++ ccm.html	1 Feb 2003 06:09:02 -0000	1.8
  @@ -9,17 +9,18 @@
   
   <h1>Continuus Support</h1>
   <ul>
  -  <li><a href="#cccheckin">CCMCheckin</a></li>
  -  <li><a href="#cccheckout">CCMCheckout</a></li>
  +  <li><a href="#ccmheckin">CCMCheckin</a></li>
  +  <li><a href="#ccmcheckout">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 wrappers around Continuus Source Manager. They have been tested

  -  with version 5.1 on Windows 2000, but should work on other platforms with ccm installed.</p>
  +  agains versions 5.1/6.2 on Windows 2000, but should work on other platforms with ccm
installed.</p>
  +<p>author: <a href="mailto:benoit.moussaud@criltelecom.com">Benoit Mousaud
(benoit.moussaud@criltelecom.com) </a></p>
   <hr>
  -<h2><a name="cccheckin">CCMCheckin</a></h2>
  +<h2><a name="ccmheckin">CCMCheckin</a></h2>
   <h3>Description</h3>
   Task to checkin a file
   <h3>Parameters</h3>
  @@ -60,7 +61,7 @@
     Comment attribute <i>mycomment</i> is added as a task comment. The task 
     used is the one set as the default.</p>
   <hr>
  -<h2><a name="cccheckout">CCMCheckout</a></h2>
  +<h2><a name="ccmheckout">CCMCheckout</a></h2>
   <h3>Description</h3>
   Task to perform a Checkout command to Continuus 
   <h3>Parameters</h3>
  @@ -73,7 +74,11 @@
     <tr> 
       <td>file</td>
       <td>Path to the file that the command will operate on</td>
  -    <td>Yes</td>
  +    <td rowspan=2">Yes (file|fileset)</td>
  +  </tr>
  +  <tr> 
  +    <td>fileset</td>
  +    <td>filset containing the file to be checked out</td>
     </tr>
     <tr> 
       <td>comment</td>
  @@ -101,6 +106,21 @@
   <p>Check out 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 default.</p>
  +<blockquote> 
  +  <pre>&lt;ccmcheckout  comment=&quot;mycomment&quot;&gt;
  +  &lt;fileset dir=&quot;lib&quot; &gt;
  +    &lt;include name=&quot;**/*.jar&quot; /&gt;
  +  &lt;/fileset&gt;
  +&lt;/ccmcheckout &gt;
  +  </pre> 
  +</blockquote>
  +
  +<p>Check out all the files in the <i>lib</i> directory having the <i>.jar</i>
extension.
  +  Comment attribute <i>mycomment</i> is added as a task comment
  +   The used task is the one set as the default.</p>  
  +
  +
  +
   <hr>
   <h2><a name="ccmcheckintask">CCMCheckinTask</a></h2>
   <h3>Description</h3>
  
  
  
  1.10      +61 -8     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
  
  Index: CCMCheck.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -u -r1.9 -r1.10
  --- CCMCheck.java	31 Oct 2002 15:12:52 -0000	1.9
  +++ CCMCheck.java	1 Feb 2003 06:09:02 -0000	1.10
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -54,10 +54,15 @@
   
   package org.apache.tools.ant.taskdefs.optional.ccm;
   
  +
   import java.io.File;
  +import java.util.Vector;
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.types.Commandline;
  +import org.apache.tools.ant.types.FileSet;
  +
   
   /**
    * Class common to all check commands (checkout, checkin,checkin default task);
  @@ -70,6 +75,8 @@
       private String comment = null;
       private String task = null;
   
  +    protected Vector filesets = new Vector();
  +
       public CCMCheck() {
           super();
       }
  @@ -87,6 +94,7 @@
        * @param v  Value to assign to file.
        */
       public void setFile(File v) {
  +        log("working file "+v, Project.MSG_VERBOSE);
           this.file = v;
       }
   
  @@ -126,6 +134,14 @@
   
   
       /**
  +     * Adds a set of files to copy.
  +     */
  +    public void addFileset(FileSet set) {
  +        filesets.addElement(set);
  +    }
  +
  +
  +    /**
        * Executes the task.
        * <p>
        * Builds a command line to execute ccm and then calls Exec's run method
  @@ -133,18 +149,55 @@
        * </p>
        */
       public void execute() throws BuildException {
  +
  +        if (file == null && filesets.size() == 0) {
  +            throw new BuildException(
  +                "Specify at least one source - a file or a fileset.");
  +        }
  +
  +        if (file != null && file.exists() && file.isDirectory()) {
  +            throw new BuildException("CCMCheck cannot be generated for directories");
  +        }
  +        
  +        if (file != null  && filesets.size() > 0) {
  +            throw new BuildException("Choose between file and fileset !");
  +        }
  +
  +        if ( getFile() !=null ) {
  +            doit();
  +            return ;
  +        }
  +                        
  +        int sizeofFileSet = filesets.size();
  +        for (int i = 0; i < sizeofFileSet; i++) {
  +            FileSet fs = (FileSet) filesets.elementAt(i);
  +            DirectoryScanner ds = fs.getDirectoryScanner(project);
  +            String[] srcFiles = ds.getIncludedFiles();
  +            for (int j = 0; j < srcFiles.length; j++) {
  +                File src = new File(fs.getDir(project), srcFiles[j]);
  +                setFile(src);
  +                doit();
  +            }
  +        }
  +    }
  +    
  +    /**
  +     * check the file given by getFile().
  +     */
  +    private void doit()
  +    {
           Commandline commandLine = new Commandline();
  -        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
  +        // as specified in the CCM.EXE help
  +
           commandLine.setExecutable(getCcmCommand());
           commandLine.createArgument().setValue(getCcmAction());
   
           checkOptions(commandLine);
   
  -        result = run(commandLine);
  +        int result = run(commandLine);
           if (result != 0) {
               String msg = "Failed executing: " + commandLine.toString();
               throw new BuildException(msg, getLocation());
  @@ -164,11 +217,11 @@
           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 ()
  +        } 
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: ant-dev-help@jakarta.apache.org


Mime
View raw message