You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Derek Slager <de...@activate.net> on 2002/04/02 10:21:49 UTC
Re: [SUBMIT] Cat Task
On Thu, Mar 07, 2002 at 06:03:01PM +0100, Stefan Bodewig wrote:
> some comments:
>
> (1) any problems with calling the task concat instead of cat?
> Non-Unix people will probably not recognize "cat".
It's not a problem for me -- changed.
> (2) Instead of tofile, I'd prefer destfile as an attribute name.
Not a problem -- changed. I did wonder about this one when initially putting
the task together -- the task design guidelines suggested 'destdir' as a
preferred name but made no mention of 'destfile'. I ended up choosing
'tofile', to be consistent with the Copy task.
> (3) You may consider using nested FileLists instead of/in addition to
> FileSets - the order by which DirctoryScanner returns the files is not
> determined while people using cat will probably need a specific order.
Yes, good idea. I didn't know what FileLists were until you mentioned them
(the documentation is a bit buried), but it seems quite reasonable to
include support for them. I believe that it's important to keep the FileSet
option as well, so they're both in there for now.
> (4) I'm not sure, but maybe an encoding attribute is needed. We have
> gradually added encoding attributes to almost all tasks that read and
> modify files.
Yes, though it would only be used when dumping text to the console (the task
treats all file inputs as binary if the destination is a file). Of course,
we'd have to assume that all of the files being concatenated together have
the same encoding -- but I doubt that will ever become a serious issue. I've
added the support in any case.
Thank you for your comments. I apologize for the tardiness of my response --
things have been quite busy for me lately. The updated files are attached to
this message, contained within a GNU gzipped tarball.
docs/manual/optionaltasklist.html.diff
docs/manual/OptionalTasks/concat.html
src/etc/testcases/taskdefs/optional/concat.xml
src/main/org/apache/tools/ant/taskdefs/defaults.properties.diff
src/main/org/apache/tools/ant/taskdefs/optional/Concat.java
src/testcases/org/apache/tools/ant/taskdefs/optional/ConcatTest.java
Thanks again,
--
Derek Slager
Software Engineer
Activate
derek@activate.net
Re: [SUBMIT] Cat Task
Posted by Stefan Bodewig <bo...@apache.org>.
On 02 Apr 2002, Stefan Bodewig <bo...@apache.org> wrote:
> Some notes:
some more
* addText() gets called for test1 on my machine - this is why I've added
sanitizeText().
* tearDown() would only delete the first file.
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [SUBMIT] Cat Task
Posted by Stefan Bodewig <bo...@apache.org>.
Thanks Derek,
I'm going to commit the task - and make it a core task at the same
time.
Some notes:
* the task doesn't honor the user specified encoding if it is writing
to a file instead of Ant's logging system.
* shouldn't this snippet
// If using filesets, disallow inline text. This is similar to
// using GNU 'cat' with file arguments -- stdin is simply
// ignored.
if (fileSets.size() > 0) {
throw new BuildException("Cannot include inline text " +
"when using filesets.");
}
better be in execute than in addText? The way it is right now, concat
will concatenate all files and fail after that, maybe even creating
the output file.
* we'll need to revisit the cleanup code at the end of execute().
Some similar code in the zip task family is know to cause problems in
some situations.
* Many thanks for providing a testcase!!
Cheers
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>