ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Passing a file list to ANT javac task
Date Fri, 21 Mar 2003 18:05:52 GMT
You are correct about <fileset> scanning its entire dir... My question to
you in turn is why you'd like to pass in explicitly the file list to
compile? Most often, one compiles everything in the src/ or src/java/
directory, with simple include/exclude pattern. This is OK even with a large
number of files.

If the method by which is select files to compile can be adapted into a
selector, then id's be able to use a fileset.

At worst, you could create a selector that takes a list of relative path
names, creates a Map of them, a queries that Map for existence of the
relative path name fed to the selector for every file in the <fileset> dir.
I suspect this should be fast enough for you, since replaces an O(N*M*X)
processing time with a O(N*logM*Y) one (N:file count in dir; M:selected file
count; X:time it takes to match a file against a pattern; Y:time it takes
hashcode a string + linear search in linked list once bucket if found in the
Map).

Of course, this will be slower than getting at the files directly, but since
a <fileset> doesn't support that, the selector idea above should work
marvels for you.

I never fought of it before... Thanks for the idea! ;-) --DD

-----Original Message-----
From: Tim Gordon [mailto:tim.gordon@allustra.com] 
Sent: Friday, March 21, 2003 11:51 AM
To: Ant Users List
Subject: Passing a file list to ANT javac task

Hi

Is there a way to pass a list of files to ANT's 'javac' task? I'm after
something that's functionally similar to the command line "javac @filelist".

The 'includesfile' attribute of the 'javac' task is not what I'm after. I'm
intending to pass in a LOT of files, and my investigations using the
'includesfile' attribute indicates that the FileSet that's used by 'javac'
will work it's way through every file path under it's root directory and try
to match it against any of the files in the 'includesfile' attribute. If the
number of files specified in 'includesfile' is large and the number of files
under the root is large then this takes a long time.

Obviously, I'm doing something wrong. Is there a way to pass a specific set
of files the the 'javac' task without copying them all to a new interim
source root first?

Thanks

Tim Gordon

Allustra Limited
1 Royal Exchange Avenue
London
EC3V 3LT
Tel 020 7464 4190
Tel 020 7464 4194
http://www.allustra.com/

Mime
View raw message