You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Puzzle <pu...@puzzlepalace.com> on 2000/11/09 19:56:54 UTC

Extended Copy Command

Hello,

Anyone know the best way to do this ?

What I want is to be able to have a task (like <copy> ) but that will, when
finished, hand a list of files copied to another task <java> maybe for
further processing. It could do this either as one large list at the end or
on a file by file basis as each is copied.

The reason is that I am using the log4j logging package in my project and
would like to be able to have ant control passing each file that is going to
be compiled (and hence copied to the build dir first - at least in my build
files) to an external process (java / perl maybe) to scan the file and
remove all log4j calls first (for a production run)

This way we do not have to ship the log4j.jar with the product (it's applet
based and the extra 40-50K for log4j we don't want the clients to have to
download)

Now I could use the Filter option to set a boolean and test if we want to
log or not but this does not work as the recommended way of using log4j is
to have a private static Category cat = Category.getInstance("category
name") line at the top of each class being logged.

Any ideas welcomed

Oh yes, log4j is at www.log4j.org

Huw


RE: Extended Copy Command

Posted by Puzzle <pu...@puzzlepalace.com>.
The transform task sounds like it might well fit the bill so I'll wait and
see when you have it finished

Thanks

Huw

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: 10 November 2000 08:35
> To: ant-user@jakarta.apache.org
> Subject: Re: Extended Copy Command
>
>
> <pu...@puzzlepalace.com> wrote:
>
> > What I want is to be able to have a task (like <copy> ) but that
> > will, when finished, hand a list of files copied to another task
> > <java> maybe for further processing. It could do this either as one
> > large list at the end or on a file by file basis as each is copied.
>
> Not without writing a task of your own, when we are talking at this
> general level of things. What would probably be the easiest thing to
> do, is having a task that makes a PatternSet object from the files in
> question (just add an include pattern for each file) and generate a
> reference to that in the project.
>
> Later use <patternset refid="assigned.id" /> in javac.
>
> > The reason is that I am using the log4j logging package in my
> > project and would like to be able to have ant control passing each
> > file that is going to be compiled (and hence copied to the build dir
> > first - at least in my build files) to an external process (java /
> > perl maybe) to scan the file and remove all log4j calls first (for a
> > production run)
>
> Wait for me to get my act for the transform task together. transform
> will be something like uptodate+execon. Like execon it will invoke a
> command for each file of a fileset, but it will know which files will
> be produced by this and therefore skip all input files that are older
> than their target files.
>
> I hope I'll have something in the next two weeks (it should be ready
> for Ant 1.3 in any case).
>
> Stefan


Re: Extended Copy Command

Posted by Stefan Bodewig <bo...@bost.de>.
<pu...@puzzlepalace.com> wrote:

> What I want is to be able to have a task (like <copy> ) but that
> will, when finished, hand a list of files copied to another task
> <java> maybe for further processing. It could do this either as one
> large list at the end or on a file by file basis as each is copied.

Not without writing a task of your own, when we are talking at this
general level of things. What would probably be the easiest thing to
do, is having a task that makes a PatternSet object from the files in
question (just add an include pattern for each file) and generate a
reference to that in the project.

Later use <patternset refid="assigned.id" /> in javac.

> The reason is that I am using the log4j logging package in my
> project and would like to be able to have ant control passing each
> file that is going to be compiled (and hence copied to the build dir
> first - at least in my build files) to an external process (java /
> perl maybe) to scan the file and remove all log4j calls first (for a
> production run)

Wait for me to get my act for the transform task together. transform
will be something like uptodate+execon. Like execon it will invoke a
command for each file of a fileset, but it will know which files will
be produced by this and therefore skip all input files that are older
than their target files.

I hope I'll have something in the next two weeks (it should be ready
for Ant 1.3 in any case).

Stefan