ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@multitask.com.au
Subject RE: Objections against advanced directory scanning
Date Tue, 01 Feb 2000 20:43:27 GMT
"> It could refer to a directory or multiple directories, i.e.
> Includes="/test/*/*.java" recurse="true"
> matches to /test/a/a.java and to /test/a/b/c/d.java

The problem with this approach is, you got a package deal,
1) With recurse=true, all * match zero (one?) or more directories.
2) With recurse=false, all * match one directory.

In my opinion, using '**' gives you more expressive power, such
that you can use a combination of 1 & 2:..."

I'm not disagreeing that ** is more expressive. It is. It also does more
than just using '*'.

But, what worries me is that using ** is a new thing, and its different
from the wildcard expressions people are already used to. Just to recap,
this line of discussion started because I was responding to this:

"The '**' is needed to cater for the following situations:

1. match files in 1 directory, but not it's subdirectories. e.g.
/test/*.java which matches all .java files in the /test/ directory.
2. match files in 1 directory, and all (or a subset of) it's
subdirectories.
e.g. /test/**/*.java which matches all .java files in all directories under
/test/.
3. match directories on the leafs of the tree e.g. **/CVS/* which matches
all CVS directories and their files.

If you don't have an extra special character ('**') besides the usual '*'
and '?', it is impossible to cater for all described situations.

If you can show me how to do it without '**', please tell me. I would be
very grateful."

Existing commands such as DIR in DOS, ls in Unix use wildcards and add a
'recurse flag' (/s for dir and -R for ls). I'm not saying they are the best
way to do it, only the most familiar to users.

Lets say I want to write my buildfile so that each package is a separate
javac task in the file. Currently, I'm stuffed, it does recursion by
default. With the new includes and excludes I'd need to add something in
like ' includes="pkg1/part1/*.java" ' which is harder than ' recurse=no '.

I suppose my main point is usability and keeping complexity low, in the
end, my opinion doesn't matter that much (I'm not a committer!), and it
certainly seems like I'm in the minority here, so I'm quite willing (and
happy ) to accept '**' rather than not have it.
--
dIon Gillard, Multitask Consulting
Work:      http://www.multitask.com.au
Play:        http://www.trongus.com
I've just returned from THE Java Programming Conference,
http://www.SoftwareSummit.com - be there next year

----- Forwarded by dIon Gillard/Multitask Consulting/AU on 02/02/00 07:22
-----
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
  Submitted by      Category                      .               Public 
                                                                         
 "Kuiper,        "'ant-dev@jaka                                          
 Arnout"         rta.apache.org                                          
 <Arnout.Kuiper@       '"                                                
 nl.origin-it.co <ant-dev@jakar                                          
 m>              ta.apache.org>                                          
 on 01/02/2000                                                           
 at 20:15                                                                
                                                                         
                                                (Embedded                
                                                image moved to           
                                                file:                    
                                                pic13131.pcx)            
                                                                         


RE: Objections against advanced directory scanning


From: dion@multitask.com.au [mailto:dion@multitask.com.au]
> It could refer to a directory or multiple directories, i.e.
> Includes="/test/*/*.java" recurse="true"
> matches to /test/a/a.java and to /test/a/b/c/d.java

The problem with this approach is, you got a package deal,
1) With recurse=true, all * match zero (one?) or more directories.
2) With recurse=false, all * match one directory.

In my opinion, using '**' gives you more expressive power, such
that you can use a combination of 1 & 2:

/test/*/**/foo/**/bar/*/*.java
(Matches every .java file, with the path starting with 'test',
then 1 or more directories ('*/**'), then 'foo', then zero or
more directories ('**'), then 'bar', then 1 directory, and then
the filename).

This could be matched with recurse == true, when '*' on it's own
means zero or more directories. The expression would then be:
/test/?*/*/foo/*/bar/?*/*.java
You only move the problem. Now you have to use '?*' instead of '*',
and '*' instead of '**'. Personally, I problems with the double meaning
of a single '*'. In one situation it means zero or more characters,
in another situation it means zero or more directories. So the user
might be puzzled, due to the double meaning. '*.java', does that
match only 'xyz.java', or also 'abc/def/xyz.java'?

Furthermore, the recurse attribute should not be necessary, because
you can match anything if you recurse always.

Cheers,

  Arnout



                                                                           
                                                                           
                                                                           
              Previous Document (Embe (Embe Next Document                  
                                dded   dded                                
                                image image                                
                                moved moved                                
                                to       to                                
                                file: file:                                
                                pic11 pic06                                
                                098.p 227.p                                
                                cx)     cx)                                
                                                                           
                                                    Return to View         
                                                                           
                                                (Embedded image moved to   
                                                  file: pic20452.pcx)      
                                                                           



Mime
View raw message