Stefan Bodewig wrote:
> On Mon, 16 Jul 2001, Kurt Huwig <[EMAIL PROTECTED]> wrote:
[...]
> > What ant lacks compared to make is the dependency based on files,
> > but later more on this.
>
> Please take a look at the <apply> task.
I did, but the <apply> currently only executes other programs. I would like
to have something like execute this Java-class; this would reduce the need
to write your own tasks a bit. Also, you cannot <apply> another task, right?
> > 1. filesets
> > ------------
> > Ant deals with file conversion.
>
> Not really - <sql>, <junit>, <mail> do not really work on files at
> all. If you leave out the <batchtest> element of JUnit there are no
> files involved at all (as far as Ant is concerned) for example.
I merely did mean that the fileset stuff can be moved up into the
Task-class. If a task doesn't need it, it should be no problem.
> > if you have (version 2)
> >
> > <mytask>
> > <fileset>
> > <include name="b"/>
> > </fileset>
> > <fileset>
> > <include name="a"/>
> > </fileset>
> > </mytask>
> >
> > then 'a' and 'b' are not sorted and given to the task in two
> > separate calls as two separate filesets. This is the same as
> > (version 3)
> >
> > <mytask>
> > <fileset>
> > <include name="b"/>
> > </fileset>
> > </mytask>
> > <mytask>
> > <fileset>
> > <include name="a"/>
> > </fileset>
> > </mytask>
>
> No, these are different. <chmod> in current CVS will create a single
> call to the chmod utility in the first case (your version 2) - it is
> up to the task to decide what it wants to do with several filesets.
Mmh, I just tried ant-1.3. If it is better now, that's fine and exactly what
I need.
> > 2. mappers
> > -----------
> > Mappers allow ant to do 'shortcuts' by not applying tasks if the
> > outfiles are newer then the infiles.
>
> This is not their primary purpose - they are used to define the target
> files with respect to the source files in the first place.
I just noticed that they also serve as file-dependecy. If the mapped files
are newer, the task is never called and therefore cannot decide.
[...]
> > together with the strange behaviour of version 2, you cannot use it
> > to 'cat' (UNIX cat) several files together if you need a certain
> > order.
>
> Two things here:
>
> (1) you can use it with Unix cat using <execon> and the parallel
> attribute - it will be one call per fileset in Ant 1.3 but really just
> one call in the current CVS version.
>
> (2) Ant doesn't guarantee any order - even within a single fileset.
This should be made clear. Otherwise it is impossible do with ant what this
code does in make:
cat ear/ejb/META-INF/jaws.xml.1 > ear/ejb/META-INF/jaws.xml
cat `find application/ejb -mindepth 2 -name "*-jaws.xml"` \
>> ear/ejb/META-INF/jaws.xml
for i in Account Acting Voucher; do \
cat framework/ejb/$$i-jaws.xml; \
done >> ear/ejb/META-INF/jaws.xml
cat ear/ejb/META-INF/jaws.xml.2 >> ear/ejb/META-INF/jaws.xml
The sequence of the files is very important for this task.
[...]
> Again, it is up to the task to decide what it wants to do with
> filesets or mappers. Which built-in task should support mappers in
> what way in your opinion?
I thought the mappers map input files to output files. And as it looks to
me, the task doesn't get called when the output files are newer than the
corresponding input files.
> > 3. fileset-code for tasks
> > --------------------------
[...]
> > Also, the files should be accessible as an 'Iterator' over
> > 'File'.
>
> This has been suggested before - there are times where you want to
> operate on a set at once and times where you want to iterate through
> the set. I guess we'll end up with an Iterator approach as
> alternative to methods returning the whole set at once.
>
> I'm not sure about the File though, we have filesets that work on
> remote directories (see <ftp>) or ZipEntries (see <zipfileset> in
> <zip> and friends). We'll probably end up using a different
> abstraction than File.
You are right. Maybe 'URL' is better, although there are some problems with
it, as the Java API checks if the URL exists. There is better code in the
upcoming 1.4 release where the URL is not accessed.
> > The mapper will create the corresponding filesets and will be used
> > to check if the task needs to be run or is up to date.
>
> I'd prefer to keep this responsibility (does the task need to run)
> inside the task itself, as only the task can now the logic it has to
> follow. See the various overwrite or force attributes in some tasks
> for example.
OK, I will have a look at it before I talk more nonsense ;-)
> > 4. shortcuts for targets
> > -------------------------
> > Sometimes it is quite hard to convince Ant that a target does not
> > need to be rebuilt. What about a mapper for the target itself, just
> > state what files this target needs and what file(s) it creates.
>
> <target>s don't have input or output files for me. A <target> groups
> tasks and these tasks are supposed to be smart enough to know whether
> they should run.
I just thought of complicated file generation, like EAR files. But that was
just an idea.
So, I can get the current version out of CVS, implement a Task-Superclass
that supports Collections, port some tasks to it and see if it works. But
this makes no sense if noone agrees on moving the fileset logic up.
Kurt
--
-------------------------------------------------------------------------
Microsoft wants customized versions of Windows NT for "embedded" systems
such as health and communications equipment.
This gives the Blue Screen of Death a whole new meaning...