Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 76498 invoked from network); 21 Jan 2000 17:15:13 -0000 Received: from status.ftech.net (HELO relay4.ftech.net) (195.200.0.89) by 63.211.145.10 with SMTP; 21 Jan 2000 17:15:13 -0000 Received: from ibm9.ftech.net ([212.32.16.79] helo=websitewatchers.com) by relay4.ftech.net with esmtp (Exim 3.12.ftech-p6 #1) id 12Bhe3-00059b-00 for ant-dev@jakarta.apache.org; Fri, 21 Jan 2000 17:14:47 +0000 Message-ID: <38889490.F52A83BA@websitewatchers.com> Date: Fri, 21 Jan 2000 17:17:04 +0000 From: Ludovic Claude Organization: Ringsys/Websitewatchers X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: ant-dev@jakarta.apache.org Subject: Re: [PROPOSAL] Directory scanning into a helper class (reuse + improvement) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit That would be helpful indeed, for example to select only the set of 'support files' that you really need when you execute javac. Is this helper class available in cvs? Cheers, Ludovic Claude "Kuiper, Arnout" wrote: > *This message was transferred with a trial version of CommuniGate(tm) Pro* > Hi, > > After updating the manual last night (and a number of questions > regarding Ant in my mailbox), I came to the conclusion that the > inclusion/exclusion of sets of files, is done separately by a bunch of > tasks, and could be improved a lot. > > A lot of tasks have a base-directory, and a set of items that should > be included. Sometimes there is also an ignore attribute, to ignore > files/directories that have a certain name. Couldn't this be > standardized, made more flexible, etc... > > I developed a helper class that given a basedir, a set of include > patterns and a set of exclude patterns, scans the given basedir, for > files that match one of the include patterns, and don't match any of > the exclude patterns. As a result the set of valid files is returned. > > It could be used easily in the following tasks: > -copydir (inclusion/exclusion of files to copy) > -jar (inclusion/exclusion of files to jar) > -javac (inclusion/exclusion of files to compile) > -zip (inclusion/exclusion of files to zip) > > Also the creation of new tasks, that are based on a directory > structure, is much simpler. > > Advantages: > -Tasks behave the same for the user. > -Easier to document in the manual. > -Better pattern matching. > -Less duplicated code. > > Pattern matching is based on UNIX pattern matching. Matching is done > per directory name (name between two separators). In the pattern for > such a name, the following special characters can be used: > * matches zero or more characters > ? matches one character > When the pattern for a directory name is '**', it matches zero or more > directories. > So "**/?d*.java" matches "xdyz.java", "test/ad.java", > "d1/d2/pdxxx.java", but not "x.java" (no 'd') and "test/xd.bat" > (no '.java'). > > What do you think of this? > > Arnout Kuiper -- ___________________________________ Web Site Watchers Ltd 212 Piccadilly, London W1V 9LD United-Kingdom Telephone: +44 (0)171 917 6255 Fax: +44 (0)171 439 0262 http://www.websitewatchers.co.uk lc@websitewatchers.com