You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Kuiper, Arnout" <Ar...@nl.origin-it.com> on 2000/05/05 09:58:35 UTC

Task functionality next version Ant

> My company's current project requires the class files in the 
> same path as
> the sources, so in order to do a 'clean' I needed to remove 
> the .class files
> from the source tree.  We also have generated .java files, same thing.

Now we are talking about task functionality here, how about
defining some for the next version Ant.

I think that all the basic tasks of which we have multiple versions,
should be "consolidated", such that we have 1 copy, 1 delete and 1
rename/move. This could be done as it is in most OSes.

So for copy we could have the following possible combinations:

1. <copy srcfile="file" destfile="file"/>
2. <copy srcfile="file" destdir="dir"/>
3. <copy srcdir="dir"   destdir="dir" 
         includes="includes" excludes="excludes"/>

1. Copy the file in srcfile to the file in destfile.
2. Copy the file in srcfile to the directory in destdir.
3. Copy the directories in srcdir to the directory in destdir.
   Includes and excludes are optional. When ommitted, all files
   and directories are copied.

Other attributes could be added like "forceoverwrite" which forces
the task not to check on timestamp. Also the already existing
"filtering" attribute could be added, although I'm in favor of
placing that in a separate task (Copy should do just a copy and
nothing more).

For delete we could have the following combinations:

1. <delete file="file"/>
2. <delete dir="dir" 
           includes="includes" excludes="excludes"/>

1. Delete the file in file.
2. Delete all directories and files in dir, using the optional
   includes and excludes. When ommitted, all files and directories
   in dir are deleted.

The move task (I think this is a better name than rename) could be:

1. <move srcfile="file" destfile="file"/>
2. <move srcfile="file" destdir="dir"/>
3. <move srcdir="dir"   destdir="dir" 
         includes="includes" excludes="excludes"/>

1. Move the file in srcfile to the file in destfile.
2. Move the file in srcfile to the directory in destdir.
3. Move the directories in srcdir to the directory in destdir.
   Includes and excludes are optional. When ommitted, all files
   and directories are moved.

Any comments?

  Arnout

Re: Task functionality next version Ant

Posted by External Lists <ex...@ManagedObjects.com>.
My only comment is to deprecate, not remove, the existing taskdefs like
deltree.  No one wants to redo their existing build.xml files, but would be
happy to migrate to the new tasks over time.

John

----- Original Message -----
From: Kuiper, Arnout <Ar...@nl.origin-it.com>
To: <an...@jakarta.apache.org>
Sent: Friday, May 05, 2000 3:58 AM
Subject: Task functionality next version Ant


> > My company's current project requires the class files in the
> > same path as
> > the sources, so in order to do a 'clean' I needed to remove
> > the .class files
> > from the source tree.  We also have generated .java files, same thing.
>
> Now we are talking about task functionality here, how about
> defining some for the next version Ant.
>
> I think that all the basic tasks of which we have multiple versions,
> should be "consolidated", such that we have 1 copy, 1 delete and 1
> rename/move. This could be done as it is in most OSes.
>
> So for copy we could have the following possible combinations:
>
> 1. <copy srcfile="file" destfile="file"/>
> 2. <copy srcfile="file" destdir="dir"/>
> 3. <copy srcdir="dir"   destdir="dir"
>          includes="includes" excludes="excludes"/>
>
> 1. Copy the file in srcfile to the file in destfile.
> 2. Copy the file in srcfile to the directory in destdir.
> 3. Copy the directories in srcdir to the directory in destdir.
>    Includes and excludes are optional. When ommitted, all files
>    and directories are copied.
>
> Other attributes could be added like "forceoverwrite" which forces
> the task not to check on timestamp. Also the already existing
> "filtering" attribute could be added, although I'm in favor of
> placing that in a separate task (Copy should do just a copy and
> nothing more).
>
> For delete we could have the following combinations:
>
> 1. <delete file="file"/>
> 2. <delete dir="dir"
>            includes="includes" excludes="excludes"/>
>
> 1. Delete the file in file.
> 2. Delete all directories and files in dir, using the optional
>    includes and excludes. When ommitted, all files and directories
>    in dir are deleted.
>
> The move task (I think this is a better name than rename) could be:
>
> 1. <move srcfile="file" destfile="file"/>
> 2. <move srcfile="file" destdir="dir"/>
> 3. <move srcdir="dir"   destdir="dir"
>          includes="includes" excludes="excludes"/>
>
> 1. Move the file in srcfile to the file in destfile.
> 2. Move the file in srcfile to the directory in destdir.
> 3. Move the directories in srcdir to the directory in destdir.
>    Includes and excludes are optional. When ommitted, all files
>    and directories are moved.
>
> Any comments?
>
>   Arnout
>


Re: Task functionality next version Ant

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "TH" == Thomas Haas <th...@softwired-inc.com> writes:

 >> IIRC Thomas Haas has written a task that consolidates text
 >> manipulation taks (FixCRLF, KeySubst, Replace).

 TH> I suggest to not mix filesystem manipulation and file (content)
 TH> translation.

Don't get me wrong. I was not proposing to mix them, I was searching
for other tasks that could be collapsed into one.

So of course I meant 

Delete + DelTreee -> Delete 

and 

FixCRLF + KeySubst + Replace + other manipulation ops not included in
Ant yet -> Translate (or whatever name is chosen).

Hope this is clearer now

        Stefan

Re: Task functionality next version Ant

Posted by Thomas Haas <th...@softwired-inc.com>.
----- Original Message -----
From: Stefan Bodewig <bo...@bost.de>
> >>>>> "KA" == Kuiper, Arnout <Ar...@nl.origin-it.com> writes:
>
>  KA> Now we are talking about task functionality here, how about
>  KA> defining some for the next version Ant.
>
> I agree with all of what you've written and just want to add that move
> would probably need a "forceoverwrite" attribute, too.
>
> The optional RenameExtensions tasks lokks a little bit as if it
> belonged into the move category. I'm not sure.
>
> IIRC Thomas Haas has written a task that consolidates text
> manipulation taks (FixCRLF, KeySubst, Replace).

All proposals seems are fine with. I suggest to not mix filesystem
manipulation and file (content) translation. Like the existing Copy task
should not alter the file in any way.

For file content maniplation (file translation) a special task should be
defined, as I suggested earlier. A transaltion defintion would look somehow
like the following lines:
<translate include... exclude...>
    <EndOfLine type="UNIX"/>
    <KeySubst .../>
</translation>

Cheers
- tom

PS
Still travelling downunder. Any aussie living south Brisbane on the list?




Re: Task functionality next version Ant

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "KA" == Kuiper, Arnout <Ar...@nl.origin-it.com> writes:

 KA> Now we are talking about task functionality here, how about
 KA> defining some for the next version Ant.

I agree with all of what you've written and just want to add that move
would probably need a "forceoverwrite" attribute, too.

The optional RenameExtensions tasks lokks a little bit as if it
belonged into the move category. I'm not sure.

IIRC Thomas Haas has written a task that consolidates text
manipulation taks (FixCRLF, KeySubst, Replace).

Expand and Zip could be put together into a single task.

Other task cleanups?

Stefan

RE: Task functionality next version Ant

Posted by Conor MacNeill <co...@m64.com>.
> -----Original Message-----
> From: Kuiper, Arnout [mailto:Arnout.Kuiper@nl.origin-it.com]
> Sent: Friday, 5 May 2000 17:59
> To: 'ant-dev@jakarta.apache.org'
> Subject: Task functionality next version Ant
>
> Now we are talking about task functionality here, how about
> defining some for the next version Ant.
>
[snip]
>
> Any comments?


That is all cool. I agree with changing rename to move. I was going to say
that when rename was originally proposed but, interestingly, the method in
java.io.File is renameTo so I kept quiet.

One question, will you retain deltree? If not, how do you distinguish
between deleting the contents of the directory and deleting the directory
AND its contents?

Cheers
Conor


RE: Task functionality next version Ant

Posted by Jason Sando <js...@think1up.com>.
>
> I worry about having a build script whose behavior can vary depending on
> whether it happens to find a file vs. a directory at runtime.  I
> much prefer
> being fully explicit in task definitions, and not depending on detecting
> what is there to alter behavior.  That's why Unix has an "rm"
> command AND an
> "rmdir" command, for example, so you have to be explicit on your
> intentions.
>
> John
>

Why shouldn't the same command work for both?

The "rm" command can be used to remove a directory as well as a file, but as
you point out it does require extra effort ("rm -R").  The same applies to
"cp" ("cp -R").  Worse, if you alias rm as "rm -i", you end up with a bunch
of "rm: descend into directory <dir>?" messages.  So you have to escape
"rm -R", and then you don't even get a "Are you sure?" prompt.

View the files and folders in the file system as objects, then define
<copy>, <move>, and <delete> to function on objects.  It shouldn't matter
what TYPE of object it is.  The command should work the same, like in
Windows File Explorer or Midnight Commander.

-j



Re: Task functionality next version Ant

Posted by External Lists <ex...@ManagedObjects.com>.
> How about using "src" and "dest" for all of them instead of "srcfile" v.s.
> "srcdir":
>
>   <copy src="file" dest="file" />
>   <delete src="file" />
>   <move src="file" dest="file" />
>
> and let the code detect whether "file" is a directory or a regular file
and
> act accordingly?  If "includes" and/or "excludes" are specified, then both
> "src" and "dest" must be directories.  If there are no "includes" and/or
> "exlcudes", and "src" is a directory then "dest" must be a directory.  If
> "src" is a regular file, "dest" can be either a regular file (existing or
> not) or a directory.

I worry about having a build script whose behavior can vary depending on
whether it happens to find a file vs. a directory at runtime.  I much prefer
being fully explicit in task definitions, and not depending on detecting
what is there to alter behavior.  That's why Unix has an "rm" command AND an
"rmdir" command, for example, so you have to be explicit on your intentions.

John




RE: Task functionality next version Ant

Posted by Jason Sando <js...@think1up.com>.
How about using "src" and "dest" for all of them instead of "srcfile" v.s.
"srcdir":

  <copy src="file" dest="file" />
  <delete src="file" />
  <move src="file" dest="file" />

and let the code detect whether "file" is a directory or a regular file and
act accordingly?  If "includes" and/or "excludes" are specified, then both
"src" and "dest" must be directories.  If there are no "includes" and/or
"exlcudes", and "src" is a directory then "dest" must be a directory.  If
"src" is a regular file, "dest" can be either a regular file (existing or
not) or a directory.

+1 on Copydir/Copyfile --> Copy, Deltree/Delete --> Delete, Rename --> Move

The new Delete can be backwards compatible if the "file" attribute is set.

-j

>
> > My company's current project requires the class files in the
> > same path as
> > the sources, so in order to do a 'clean' I needed to remove
> > the .class files
> > from the source tree.  We also have generated .java files, same thing.
>
> Now we are talking about task functionality here, how about
> defining some for the next version Ant.
>
> I think that all the basic tasks of which we have multiple versions,
> should be "consolidated", such that we have 1 copy, 1 delete and 1
> rename/move. This could be done as it is in most OSes.
>
> So for copy we could have the following possible combinations:
>
> 1. <copy srcfile="file" destfile="file"/>
> 2. <copy srcfile="file" destdir="dir"/>
> 3. <copy srcdir="dir"   destdir="dir"
>          includes="includes" excludes="excludes"/>
>
> 1. Copy the file in srcfile to the file in destfile.
> 2. Copy the file in srcfile to the directory in destdir.
> 3. Copy the directories in srcdir to the directory in destdir.
>    Includes and excludes are optional. When ommitted, all files
>    and directories are copied.
>
> Other attributes could be added like "forceoverwrite" which forces
> the task not to check on timestamp. Also the already existing
> "filtering" attribute could be added, although I'm in favor of
> placing that in a separate task (Copy should do just a copy and
> nothing more).
>
> For delete we could have the following combinations:
>
> 1. <delete file="file"/>
> 2. <delete dir="dir"
>            includes="includes" excludes="excludes"/>
>
> 1. Delete the file in file.
> 2. Delete all directories and files in dir, using the optional
>    includes and excludes. When ommitted, all files and directories
>    in dir are deleted.
>
> The move task (I think this is a better name than rename) could be:
>
> 1. <move srcfile="file" destfile="file"/>
> 2. <move srcfile="file" destdir="dir"/>
> 3. <move srcdir="dir"   destdir="dir"
>          includes="includes" excludes="excludes"/>
>
> 1. Move the file in srcfile to the file in destfile.
> 2. Move the file in srcfile to the directory in destdir.
> 3. Move the directories in srcdir to the directory in destdir.
>    Includes and excludes are optional. When ommitted, all files
>    and directories are moved.
>
> Any comments?
>
>   Arnout