You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/05/19 14:18:10 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Chmod.java ExecuteOn.java

bodewig     2003/05/19 05:18:10

  Modified:    .        WHATSNEW build.xml
               docs/manual/CoreTasks apply.html chmod.html
               src/main/org/apache/tools/ant/taskdefs Chmod.java
                        ExecuteOn.java
  Log:
  You can now limit the parallelism of <apply> and <chmod> by using the
  new maxparallel attribute.
  Submitted by:	Frank A. Hunleth <fhunleth at cs dot wustl dot edu>
  used in build.xml to fix PR: 17640
  
  With the new addsourcefile attribute, you can make <apply> ommit the
  source file names from the command line.
  PR: 13654
  
  <apply> and <chmod> now support nested <filelist>s as well.
  PR: 15929
  
  <apply> and <chmod> will display a summary if you set the new verbose
  attribute to true.
  PR: 19883
  
  Revision  Changes    Path
  1.421     +12 -0     ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.420
  retrieving revision 1.421
  diff -u -r1.420 -r1.421
  --- WHATSNEW	16 May 2003 09:22:28 -0000	1.420
  +++ WHATSNEW	19 May 2003 12:18:07 -0000	1.421
  @@ -346,6 +346,18 @@
     that can be used to turn of Microsoft extensions while using the jvc
     compiler.  Bugzilla Report 19826.
   
  +* You can now limit the parallelism of <apply> and <chmod> by using the new
  +  maxparallel attribute.
  +
  +* With the new addsourcefile attribute, you can make <apply> ommit the
  +  source file names from the command line.  Bugzilla Report 13654.
  +
  +* <apply> and <chmod> now support nested <filelist>s as well.
  +  Bugzilla Report 15929.
  +
  +* <apply> and <chmod> will display a summary if you set the new
  +  verbose attribute to true.  Bugzilla Report 19883.
  +
   Changes from Ant 1.5.2 to Ant 1.5.3
   ===================================
   
  
  
  
  1.377     +3 -2      ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ant/build.xml,v
  retrieving revision 1.376
  retrieving revision 1.377
  diff -u -r1.376 -r1.377
  --- build.xml	13 May 2003 14:36:59 -0000	1.376
  +++ build.xml	19 May 2003 12:18:07 -0000	1.377
  @@ -26,6 +26,7 @@
   
     <property name="debug" value="true"/>
     <property name="chmod.fail" value="true"/>
  +  <property name="chmod.maxparallel" value="250"/>
     <property name="deprecation" value="false"/>
     <property name="optimize" value="true"/>
     <property name="javac.target" value="1.1"/>
  @@ -963,7 +964,7 @@
       <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**"
              failonerror="${chmod.fail}"/>
       <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**"
  -           failonerror="${chmod.fail}"/>
  +           failonerror="${chmod.fail}" maxparallel="${chmod.maxparallel}"/>
       <chmod perm="ugo+x" type="file" failonerror="${chmod.fail}">
          <fileset dir="${dist.bin}">
            <include name="**/ant"/>
  @@ -1037,7 +1038,7 @@
       <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**"
              failonerror="${chmod.fail}"/>
       <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**"
  -           failonerror="${chmod.fail}"/>
  +           failonerror="${chmod.fail}" maxparallel="${chmod.maxparallel}"/>
       <chmod perm="ugo+x" type="file" failonerror="${chmod.fail}">
          <fileset dir="${dist.bin}">
            <include name="**/ant"/>
  
  
  
  1.21      +33 -5     ant/docs/manual/CoreTasks/apply.html
  
  Index: apply.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/apply.html,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- apply.html	27 Mar 2003 13:22:33 -0000	1.20
  +++ apply.html	19 May 2003 12:18:08 -0000	1.21
  @@ -15,14 +15,15 @@
   the command is only executed when Ant is run on one of the specified operating
   systems.</p>
   <p>The files and/or directories of a number of <a
  -href="../CoreTypes/fileset.html">FileSet</a>s are passed as arguments
  +href="../CoreTypes/fileset.html">FileSet</a>s or <a
  +href="../CoreTypes/filelist.html">FileList</a>s are passed as arguments
   to the system command.</p>
   <p>If you specify a nested <a
   href="../CoreTypes/mapper.html">mapper</a> and the <i>dest</i> attribute,
   the timestamp of each source file is compared to the timestamp of a
   target file which is defined by the nested mapper element and searched
   for in the given dest.</p>
  -<p>At least one fileset is required, and you must not specify more than
  +<p>At least one fileset or filelist is required, and you must not specify more than
   one mapper.</p>
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  @@ -53,7 +54,7 @@
       <td valign="top">relative</td>
       <td valign="top">whether the filenames should be passed on the
         command line as absolute or relative pathnames (relative to the
  -      base directory of the corresponding fileset for source files or
  +      base directory of the corresponding fileset/list for source files or
         the <i>dest</i> attribute for target files).</td>
       <td align="center" valign="top">No, default is <i>false</i></td>
     </tr>
  @@ -120,7 +121,8 @@
       <td valign="top">skipemptyfilesets</td>
       <td valign="top">Don't run the command, if no source files have
         been found or are newer than their corresponding target
  -      files.</td>
  +      files.  Despite its name, this attribute applies to filelists as
  +      well.</td>
       <td align="center" valign="top">No, default is <i>false</i></td>
     </tr>
     <tr>
  @@ -158,19 +160,45 @@
           false as well.</td>
       <td align="center" valign="top">No, default is <i>true</i></td>
     </tr>
  +  <tr>
  +    <td valign="top">maxparallel</td>
  +    <td valign="top">Limit the amount of parallelism by passing at
  +      most this many sourcefiles at once.  Set it to &lt;= 0 for
  +      unlimited.  Defaults to unlimited.  <em>Since Ant 1.6.</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">addsourcefile</td>
  +    <td valign="top">Whether source file names should be added to the
  +      command automatically.  Defaults to <code>true</code>.  
  +      <em>Since Ant 1.6.</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">verbose</td>
  +    <td valign="top">Whether to print a summary after execution or not.
  +      Defaults to <code>false</code>.  <em>Since Ant 1.6.</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   </table>
   <h3>Parameters specified as nested elements</h3>
   <h4>fileset</h4>
   <p>You can use any number of nested <code>&lt;fileset&gt;</code>
   elements to define the files for this task and refer to
   <code>&lt;fileset&gt;</code>s defined elsewhere.</p>
  +<h4>filelist</h4>
  +<p><em>Since Ant 1.6</em></p>
  +<p>You can use any number of nested <code>&lt;filelist&gt;</code>
  +elements to define the files for this task and refer to
  +<code>&lt;filelist&gt;</code>s defined elsewhere.</p>
   <h4>arg</h4>
   <p>Command line arguments should be specified as nested
   <code>&lt;arg&gt;</code> elements. See <a
   href="../using.html#arg">Command line arguments</a>.</p>
   <h4>srcfile</h4>
   <p>By default the file names of the source files will be added to the
  -end of the command line. If you need to place it somewhere different,
  +end of the command line (unless you set addsourcefile to
  +<code>false</code>). If you need to place it somewhere different,
   use a nested <code>&lt;srcfile&gt;</code> element between your
   <code>&lt;arg&gt;</code> elements to mark the insertion point.</p>
   <h4>targetfile</h4>
  
  
  
  1.11      +17 -0     ant/docs/manual/CoreTasks/chmod.html
  
  Index: chmod.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/chmod.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- chmod.html	14 Mar 2003 16:01:03 -0000	1.10
  +++ chmod.html	19 May 2003 12:18:08 -0000	1.11
  @@ -19,6 +19,10 @@
   supports all of FileSet's attributes and nested elements
   directly. More FileSets can be specified using nested
   <code>&lt;fileset&gt;</code> elements.</p>
  +
  +<p>Starting with Ant 1.6, this task also supports nested <a
  +href="../CoreTypes/filelist.html">filelist</a>s.</p>
  +
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
     <tr>
  @@ -73,6 +77,19 @@
         plain files are going to be changed. If set to <i>dir</i>, only
         the directories are considered.</td>
       <td align="center" valign="top">No, default is <i>file</i></td>
  +  </tr>
  +  <tr>
  +    <td valign="top">maxparallel</td>
  +    <td valign="top">Limit the amount of parallelism by passing at
  +      most this many sourcefiles at once.  Set it to &lt;= 0 for
  +      unlimited.  Defaults to unlimited.  <em>Since Ant 1.6.</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">verbose</td>
  +    <td valign="top">Whether to print a summary after execution or not.
  +      Defaults to <code>false</code>.  <em>Since Ant 1.6.</em></td>
  +    <td align="center" valign="top">No</td>
     </tr>
   </table>
   <h3>Examples</h3>
  
  
  
  1.37      +8 -0      ant/src/main/org/apache/tools/ant/taskdefs/Chmod.java
  
  Index: Chmod.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Chmod.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- Chmod.java	14 Mar 2003 16:01:03 -0000	1.36
  +++ Chmod.java	19 May 2003 12:18:08 -0000	1.37
  @@ -254,6 +254,14 @@
               + " doesn\'t support the skipemptyfileset attribute", getLocation());
       }
   
  +    /**
  +     * @ant.attribute ignore="true"
  +     */
  +    public void setAddsourcefile(boolean b) {
  +        throw new BuildException(getTaskType()
  +            + " doesn\'t support the addsourcefile attribute", getLocation());
  +    }
  +
       protected boolean isValidOs() {
           return (Os.isFamily("unix") || Os.isFamily("tandem")) 
               && super.isValidOs();
  
  
  
  1.39      +151 -10   ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  
  Index: ExecuteOn.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- ExecuteOn.java	27 Mar 2003 13:14:31 -0000	1.38
  +++ ExecuteOn.java	19 May 2003 12:18:08 -0000	1.39
  @@ -63,6 +63,7 @@
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.EnumeratedAttribute;
  +import org.apache.tools.ant.types.FileList;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.Mapper;
   import org.apache.tools.ant.util.FileNameMapper;
  @@ -81,6 +82,7 @@
   public class ExecuteOn extends ExecTask {
   
       protected Vector filesets = new Vector();
  +    private Vector filelists = new Vector();
       private boolean relative = false;
       private boolean parallel = false;
       private boolean forwardSlash = false;
  @@ -91,6 +93,9 @@
       protected Mapper mapperElement = null;
       protected FileNameMapper mapper = null;
       protected File destDir = null;
  +    private int maxParallel = -1;
  +    private boolean addSourceFile = true;
  +    private boolean verbose = false;
   
       /**
        * Has &lt;srcfile&gt; been specified before &lt;targetfile&gt;
  @@ -105,6 +110,13 @@
       }
   
       /**
  +     * Source files to operate upon.
  +     */
  +    public void addFilelist(FileList list) {
  +        filelists.addElement(list);
  +    }
  +
  +    /**
        * Whether the filenames should be passed on the command line as
        * absolute or relative pathnames. Paths are relative to the base
        * directory of the corresponding fileset for source files or the
  @@ -154,6 +166,38 @@
       }
   
       /**
  +     * Limit the command line length by passing at maximum this many
  +     * sourcefiles at once to the command.
  +     *
  +     * <p>Set to &lt;= 0 for unlimited - this is the default.</p>
  +     *
  +     * @since Ant 1.6
  +     */
  +    public void setMaxParallel(int max) {
  +        maxParallel = max;
  +    }
  +
  +    /**
  +     * Whether to send the source file name on the command line.
  +     *
  +     * <p>Defaults to <code>true</code>.
  +     *
  +     * @since Ant 1.6
  +     */
  +    public void setAddsourcefile(boolean b) {
  +        addSourceFile = b;
  +    }
  +
  +    /**
  +     * Whether to print a verbose summary after execution.
  +     *
  +     * @since Ant 1.6
  +     */
  +    public void setVerbose(boolean b) {
  +        verbose = b;
  +    }
  +
  +    /**
        * Marker that indicates where the name of the source file should
        * be put on the command line.
        */
  @@ -202,8 +246,9 @@
           }
           
           super.checkConfiguration();
  -        if (filesets.size() == 0) {
  -            throw new BuildException("no filesets specified", getLocation());
  +        if (filesets.size() == 0 && filelists.size() == 0) {
  +            throw new BuildException("no filesets and no filelists specified",
  +                                     getLocation());
           }
   
           if (targetFilePos != null || mapperElement != null 
  @@ -221,6 +266,9 @@
       }
   
       protected void runExec(Execute exe) throws BuildException {
  +        int totalFiles = 0;
  +        int totalDirs = 0;
  +        boolean haveExecuted = false;
           try {
   
               Vector fileNames = new Vector();
  @@ -233,6 +281,7 @@
                   if (!"dir".equals(type)) {
                       String[] s = getFiles(base, ds);
                       for (int j = 0; j < s.length; j++) {
  +                        totalFiles++;
                           fileNames.addElement(s[j]);
                           baseDirs.addElement(base);
                       }
  @@ -241,6 +290,7 @@
                   if (!"file".equals(type)) {
                       String[] s = getDirs(base, ds);;
                       for (int j = 0; j < s.length; j++) {
  +                        totalDirs++;
                           fileNames.addElement(s[j]);
                           baseDirs.addElement(base);
                       }
  @@ -261,6 +311,50 @@
                               Project.MSG_VERBOSE);
                           exe.setCommandline(command);
                           runExecute(exe);
  +                        haveExecuted = true;
  +                    }
  +                    fileNames.removeAllElements();
  +                    baseDirs.removeAllElements();
  +                }
  +            }
  +
  +            for (int i = 0; i < filelists.size(); i++) {
  +                FileList list = (FileList) filelists.elementAt(i);
  +                File base = list.getDir(getProject());
  +                String[] names = list.getFiles(getProject());
  +
  +                for (int j = 0; j < names.length; j++) {
  +                    File f = new File(base, names[j]);
  +                    if ((f.isFile() && !"dir".equals(type))
  +                        || (f.isDirectory() && !"file".equals(type))) {
  +
  +                        if (f.isFile()) {
  +                            totalFiles++;
  +                        } else {
  +                            totalDirs++;
  +                        }
  +
  +                        fileNames.addElement(names[j]);
  +                        baseDirs.addElement(base);
  +                    }
  +                }
  +
  +                if (fileNames.size() == 0 && skipEmpty) {
  +                    log("Skipping filelist for directory "
  +                        + base + ". It is empty.", Project.MSG_INFO);
  +                    continue;
  +                }
  +
  +                if (!parallel) {
  +                    String[] s = new String[fileNames.size()];
  +                    fileNames.copyInto(s);
  +                    for (int j = 0; j < s.length; j++) {
  +                        String[] command = getCommandline(s[j], base);
  +                        log(Commandline.describeCommand(command), 
  +                            Project.MSG_VERBOSE);
  +                        exe.setCommandline(command);
  +                        runExecute(exe);
  +                        haveExecuted = true;
                       }
                       fileNames.removeAllElements();
                       baseDirs.removeAllElements();
  @@ -268,14 +362,17 @@
               }
   
               if (parallel && (fileNames.size() > 0 || !skipEmpty)) {
  -                String[] s = new String[fileNames.size()];
  -                fileNames.copyInto(s);
  -                File[] b = new File[baseDirs.size()];
  -                baseDirs.copyInto(b);
  -                String[] command = getCommandline(s, b);
  -                log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
  -                exe.setCommandline(command);
  -                runExecute(exe);
  +                runParallel(exe, fileNames, baseDirs);
  +                haveExecuted = true;
  +            }
  +
  +            if (haveExecuted) {
  +                log("Applied " + cmdl.getExecutable() + " to "
  +                    + totalFiles + " file"
  +                    + (totalFiles != 1 ? "s" : "") + " and "
  +                    + totalDirs + " director"
  +                    + (totalDirs != 1 ? "ies" : "y") + ".",
  +                    verbose ? Project.MSG_INFO : Project.MSG_VERBOSE);
               }
   
           } catch (IOException e) {
  @@ -321,6 +418,10 @@
           String[] targetFiles = new String[targets.size()];
           targets.copyInto(targetFiles);
           
  +        if (!addSourceFile) {
  +            srcFiles = new String[0];
  +        }
  +
           String[] orig = cmdl.getCommandline();
           String[] result 
               = new String[orig.length + srcFiles.length + targetFiles.length];
  @@ -436,6 +537,46 @@
                                   mapper);
           } else {
               return ds.getIncludedDirectories();
  +        }
  +    }
  +
  +    /**
  +     * Runs the command in "parallel" mode, making sure that at most
  +     * maxParallel sourcefiles get passed on the command line.
  +     *
  +     * @since Ant 1.6
  +     */
  +    protected void runParallel(Execute exe, Vector fileNames, 
  +                               Vector baseDirs)
  +        throws IOException, BuildException {
  +        String[] s = new String[fileNames.size()];
  +        fileNames.copyInto(s);
  +        File[] b = new File[baseDirs.size()];
  +        baseDirs.copyInto(b);
  +
  +        if (maxParallel <= 0 
  +            || s.length == 0 /* this is skipEmpty == false */) {
  +            String[] command = getCommandline(s, b);
  +            log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
  +            exe.setCommandline(command);
  +            runExecute(exe);
  +        } else {
  +            int stillToDo = fileNames.size();
  +            int currentOffset = 0;
  +            while (stillToDo > 0) {
  +                int currentAmount = Math.min(stillToDo, maxParallel);
  +                String[] cs = new String[currentAmount];
  +                System.arraycopy(s, currentOffset, cs, 0, currentAmount);
  +                File[] cb = new File[currentAmount];
  +                System.arraycopy(b, currentOffset, cb, 0, currentAmount);
  +                String[] command = getCommandline(cs, cb);
  +                log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
  +                exe.setCommandline(command);
  +                runExecute(exe);
  +
  +                stillToDo -= currentAmount;
  +                currentOffset += currentAmount;
  +            }
           }
       }
   
  
  
  

Re: Enhance chgrp/chown?

Posted by Stefan Bodewig <bo...@apache.org>.
On 23 May 2003, Stefan Bodewig <bo...@apache.org> wrote:

> On Thu, 22 May 2003, Gus Heck <gu...@cognition.olin.edu> wrote:
>
>> Have you found out anything about tandem/nonstop and chgrp chown
>> yet?
> 
> No, sorry.  I'll keep you posted.

OK, Tandem supports chown and chgrp, but at the same time,
Os.isFamily("unix") will be true for it so the special case isn't
needed (and not needed in Chown either where it is going to be removed
in a few minutes).

Stefan

Re: Enhance chgrp/chown?

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 22 May 2003, Gus Heck <gu...@cognition.olin.edu> wrote:
> Stefan Bodewig wrote:
>> On Wed, 21 May 2003, Gus Heck <gu...@cognition.olin.edu>
>> wrote:

>>>Another logicical addition to all 3 of them might be allowing
>>>dirsets.
>> I think the type="dir" attribute covers this, doesn't it?
> 
> I guess multiple ways of doing things just isn't popular with anyone
> around here.

Uhm, Perl used to be my favorite scripting language for quite some
time.  But probably not because of TIMTOWTDI 8-)

If there is an existing way to do a thing I have no problem with
adding another way if it improves consistency accross tasks.  But
there are not that many tasks supporting <dirset> (yet?).

> Makes me wonder why we have dirsets at all if we can't use them
> here, and only in a narrow way for subant...

The main reason for <dirset> has been as a nested element in <path>.

> I suppose type="dir" is a pre-dirset feature on chmod,

Yes.

> These tasks are not yet released, so maybe they should take DirSets
> instead?

They inherit it from ExecuteOn, so they cannot un-use the attribute
(well, they could override the setter and throw an exception).

> Maybe fileset should have had a type="dir|file|both" instead of
> having Dirsets.

<fileset> always does the implict type="both" - it is the task that
decides whether it invokes getIncludedFiles or
getIncludedDirectories.  Take a look at the code of FileSet and
DirSet, they are identical.

We considered making dirsets and filesets interchangeable by having
dirset return the included directories in getIncludedFiles but decided
against it - not just because it was hackish but also because tasks
might rely on the fact that getIncludedFiles returns files and not
directories.

> What direction should I be taking with chgrp/chown here?

Thinking about it a second time - add <dirset> support to ExecuteOn.

> Given the constraints of back compatability, it seems that the only
> way to make life easy for the user is keep adding the new ways of
> referencing things (ie dirsets) to the old tasks in which they make
> sense.

True.

> ok I understand. Have you found out anything about tandem/nonstop
> and chgrp chown yet?

No, sorry.  I'll keep you posted.

Stefan

Re: Enhance chgrp/chown?

Posted by Gus Heck <gu...@cognition.olin.edu>.
Stefan Bodewig wrote:
> On Wed, 21 May 2003, Gus Heck <gu...@cognition.olin.edu> wrote:
> 
>>Stefan Bodewig wrote:
>>
>>>>currently chmod has a fair number of additional features.
>>>
>>>Which are?
>>>
>>
>>dir, includes, excludes, defaultexcludes...
> 
> 
> Please don't!  These attributes come from the pre-fileset time and are
> only kept for backwards compatibility.  Please look at the special
> case in Chmod's execute that is needed to keep the old behavior of the
> dir attribute.
> 
> 

Ah glad I asked.

>>Another logicical addition to all 3 of them might be allowing
>>dirsets.
> 
> 
> I think the type="dir" attribute covers this, doesn't it?
> 

I guess multiple ways of doing things just isn't popular with anyone 
around here. Makes me wonder why we have dirsets at all if we can't use 
them here, and only in a narrow way for subant...

I suppose type="dir" is a pre-dirset feature on chmod, which I may have 
inadvertently propogated to my tasks because dirset was very new at the 
time I wrote them. (which was 4-5 months before they were commited due 
to the 1.5 release feature freezes).  These tasks are not yet released, 
so maybe they should take DirSets instead?

Granted that one would then need to supply a dirset and a fileset to get 
the "both" effect, but it would seem more consistant with the 
documentation of fileset which entirely fails to mention that 
directories are matched too. (unless you count the fact that /CVS is one 
of the default excludes).

So what is the purpose of DirSet? Maybe fileset should have had a 
type="dir|file|both" instead of having Dirsets. (of course with dirset 
released, it cant' be undone)

What direction should I be taking with chgrp/chown here?

Thinking out loud... It looks like we are not winding up with one way of 
doing things, but several ways that cannot be mixed between tasks. This 
will force the user to remember which flavor of file or directory 
specification a particular task finds tasty.

To put it another way, I think we want to make using ant as simple as 
possible. To me life is simplest when any logical answer will do, and 
failing that, simple if there is one answer that always works. The worst 
case is a hashtable of case specific answers. The hashtable is what we 
are in danger of here.

Given the constraints of back compatability, it seems that the only way 
to make life easy for the user is keep adding the new ways of 
referencing things (ie dirsets) to the old tasks in which they make 
sense. (much like has been done to chmod with filesets). This way at 
least, A dirset would always work and older ways you might or might not.

If my logic is correct, and the goal is to minimize the number of ways 
to acomplish the same thing, we should not release chgrp and chown with 
the old method (type=) but rather convert them to a DirSet accepting 
version. (and add dirsets to chmod). This change would break builds 
(like mine particularly), but hey it is an alpha version... such is life.

The pruning of things like chmod's dir atribute can be part of ant 2.0 
where back compatability is not one of our promises... Of course if 
dirset is prunable, then I have it all backwards :).

> 
>>>It has been a "core task" of Ant virtually since Ant exists, so
>>>there is no way to move it from "core" to "optional" unless we
>>>restructure the set of built-in tasks completely IMHO.
> 
> 
> To clarify.  I don't think we should move any core task to optional at
> all - until we restructure our task system completely, which I'd
> expect to go along with antlibs, yes.  There are more tasks than just
> chmod that are in core but don't really fit there (cvs for example).
> 

ok I understand. Have you found out anything about tandem/nonstop and 
chgrp chown yet?

-Gus


Re: Enhance chgrp/chown? (was: Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Chmod.java ExecuteOn.java)

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 21 May 2003, Gus Heck <gu...@cognition.olin.edu> wrote:
> Stefan Bodewig wrote:
>>
>>>currently chmod has a fair number of additional features.
>> Which are?
>>
> 
> dir, includes, excludes, defaultexcludes...

Please don't!  These attributes come from the pre-fileset time and are
only kept for backwards compatibility.  Please look at the special
case in Chmod's execute that is needed to keep the old behavior of the
dir attribute.

> Another logicical addition to all 3 of them might be allowing
> dirsets.

I think the type="dir" attribute covers this, doesn't it?

>> It has been a "core task" of Ant virtually since Ant exists, so
>> there is no way to move it from "core" to "optional" unless we
>> restructure the set of built-in tasks completely IMHO.

To clarify.  I don't think we should move any core task to optional at
all - until we restructure our task system completely, which I'd
expect to go along with antlibs, yes.  There are more tasks than just
chmod that are in core but don't really fit there (cvs for example).

Stefan

Enhance chgrp/chown? (was: Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Chmod.java ExecuteOn.java)

Posted by Gus Heck <gu...@cognition.olin.edu>.
Stefan Bodewig wrote:
> 
>>currently chmod has a fair number of additional features.
> 
> 
> Which are?
> 

dir, includes, excludes, defaultexcludes...

chmod supports these with it's own internal fileset. I could duplicate 
it into my AbstractAccessTask (I think) to produce a similar effect in 
my tasks, but I hate duplicating code like that... it violates that 
whole DRY thing :).

Another logicical addition to all 3 of them might be allowing dirsets.

>>Finally, it seems a bit incongruous that chmod is not in
>>optional/unix/ (now that that package exists),
> 
> 
> It has been a "core task" of Ant virtually since Ant exists, so there
> is no way to move it from "core" to "optional" unless we restructure
> the set of built-in tasks completely IMHO.
> 

Do you mean that if we move one thing there will be demand to move lots 
of others, or do you mean that there is a fundamental code level 
blockage to this that I have yet to perceive? Or is it a facet of the 
upcomming antlib thing?

> 
>>Of course moving a task to another package, brings up back
>>compatability questions at the api level
> 
> 
> They can be solved by making the old class an (more or less) empty
> subclass of the new task.  See Transform.java or SendEmail.java.
> 

Ok, and if I do this, is there still a difficulty in moving the meat of 
the chmod class to where it can extend the same base as the others?

> 
>>It doesn't seem like the sort of class that is likely to be extended
>>or used in other code,
> 
> 
> I disagree with "used".  I could easily imagine using Chmod for a
> permission aware untar or unzip task for example.
> 

Mmm yes I suppose that people might have done things like that with it.

So is worth my time to add the above mentioned features? (by that mean, 
would a reasonable implementation be likley to get committed?)

-Gus


Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Chmod.java ExecuteOn.java

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 20 May 2003, Gus Heck <gu...@cognition.olin.edu> wrote:

> I plan to patch the docs to reflect this and the fact that they seem
> to accept the verbose atribute as well.

Thanks, I forgot they extended ExecuteOn.  I'll take care of <attrib>
myself.  Think that's all.

> Other things I have noticed is that a little while back chmod added
> support for Os.isFamily("tandem"). Should this go into chmod/chgrp
> too?

I have no idea.  The patch I received predates those two tasks, I'll
ping the original author.

> currently chmod has a fair number of additional features.

Which are?

> Finally, it seems a bit incongruous that chmod is not in
> optional/unix/ (now that that package exists),

It has been a "core task" of Ant virtually since Ant exists, so there
is no way to move it from "core" to "optional" unless we restructure
the set of built-in tasks completely IMHO.

> Of course moving a task to another package, brings up back
> compatability questions at the api level

They can be solved by making the old class an (more or less) empty
subclass of the new task.  See Transform.java or SendEmail.java.

> It doesn't seem like the sort of class that is likely to be extended
> or used in other code,

I disagree with "used".  I could easily imagine using Chmod for a
permission aware untar or unzip task for example.

> Oh and do we have any idea when the target date for the first 1.6
> beta release is...

I don't.

> if this is to be done, I am sure we want the maximum ammount of user
> testing and feedback on it.

As always.  But then it is a known fact that we don't get any feedback
on betas anyway (well, almost).

I've been watching Ant's freshmeat stats during the last releases
closely.  We get about six times more record and URL hits for final
releases than for betas.  Download stats at Apache are a bit difficult
as we don't monitor our mirrors.

Stefan

Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Chmod.java ExecuteOn.java

Posted by Gus Heck <gu...@cognition.olin.edu>.
I noticed that this effects the chgrp and chown tasks... which also 
Extend ExcecuteOn and therefore now have the maxparallel atribute as 
well. I plan to patch the docs to reflect this and the fact that they 
seem to accept the verbose atribute as well.

Other things I have noticed is that a little while back chmod added 
support for Os.isFamily("tandem"). Should this go into chmod/chgrp too? 
If someone verifies that non-stop supports chgrp and chown in the 
standard unixy way I'll be glad to patch it as well.

Furthermore, it seems that chgrp and chown really ought to support 
esentially the same feature set as chmod, but currently chmod has a fair 
number of additional features. I might flesh out chmod and chgrp, but 
since that takes more than a few minutes work, I would like to know if 
this is desired.

Finally, it seems a bit incongruous that chmod is not in optional/unix/ 
(now that that package exists), and the situation seems ripe for a bit 
of refactoring, such that AbstractAccessTask.java holds most of the 
support for these three tasks and each task holds the specific 
differences. Of course moving a task to another package, brings up back 
compatability questions at the api level so I am hoping for a discussion 
of the severity of problems likely from moving chmod. It doesn't seem 
like the sort of class that is likely to be extended or used in other 
code, but that might just be my lack of imagination (or need for another 
coffee).

Oh and do we have any idea when the target date for the first 1.6 beta 
release is... if this is to be done, I am sure we want the maximum 
ammount of user testing and feedback on it.

-Gus

bodewig@apache.org wrote:
> bodewig     2003/05/19 05:18:10
> 
>   Modified:    .        WHATSNEW build.xml
>                docs/manual/CoreTasks apply.html chmod.html
>                src/main/org/apache/tools/ant/taskdefs Chmod.java
>                         ExecuteOn.java
>   Log:
>   You can now limit the parallelism of <apply> and <chmod> by using the
>   new maxparallel attribute.
>   Submitted by:	Frank A. Hunleth <fhunleth at cs dot wustl dot edu>
>   used in build.xml to fix PR: 17640
>   
>   With the new addsourcefile attribute, you can make <apply> ommit the
>   source file names from the command line.
>   PR: 13654
>   
>   <apply> and <chmod> now support nested <filelist>s as well.
>   PR: 15929
>   
>   <apply> and <chmod> will display a summary if you set the new verbose
>   attribute to true.
>   PR: 19883
>   
>   Revision  Changes    Path
>   1.421     +12 -0     ant/WHATSNEW
>   
>   Index: WHATSNEW
>   ===================================================================
>   RCS file: /home/cvs/ant/WHATSNEW,v
>   retrieving revision 1.420
>   retrieving revision 1.421
>   diff -u -r1.420 -r1.421
>   --- WHATSNEW	16 May 2003 09:22:28 -0000	1.420
>   +++ WHATSNEW	19 May 2003 12:18:07 -0000	1.421
>   @@ -346,6 +346,18 @@
>      that can be used to turn of Microsoft extensions while using the jvc
>      compiler.  Bugzilla Report 19826.
>    
>   +* You can now limit the parallelism of <apply> and <chmod> by using the new
>   +  maxparallel attribute.
>   +
>   +* With the new addsourcefile attribute, you can make <apply> ommit the
>   +  source file names from the command line.  Bugzilla Report 13654.
>   +
>   +* <apply> and <chmod> now support nested <filelist>s as well.
>   +  Bugzilla Report 15929.
>   +
>   +* <apply> and <chmod> will display a summary if you set the new
>   +  verbose attribute to true.  Bugzilla Report 19883.
>   +
>    Changes from Ant 1.5.2 to Ant 1.5.3
>    ===================================
>    
>   
>   
>   
>   1.377     +3 -2      ant/build.xml
>   
>   Index: build.xml
>   ===================================================================
>   RCS file: /home/cvs/ant/build.xml,v