ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn Kruithof ...@kruithof.xs4all.nl>
Subject Re: ResourceCollections
Date Sat, 16 Apr 2005 09:04:26 GMT
Matt Benson wrote:

>--- Martijn Kruithof <jm@kruithof.xs4all.nl> wrote:
>[SNIP]
>  
>
>>Apart from the variands A and B further below, would
>>the following also 
>>work?
>>
>><project name="foo" default="bar">
>>
>><resourcecollection id="blah" xmlns="ant:set">
>>   <and>
>>       <files dir="foo" name="**/*.java"/>
>>       <date select="newer" date="2005/04/15"/>
>>   </and>
>></resourcecollection>
>>
>></project>
>>
>>or would this mean that the resoursecollection must
>>be part of set itself?
>>    
>>
>
>As I understand it, yes, because the xmlns was
>declared on the resourcecollection element.  I am
>having a hard time following your exact example here
>because I'm not sure how you are imagining the
>ResourceCollections to look, while I know what they
>look like.  :)
>  
>
I'll use your example below to ask what will be (im)possible

>I don't see that the ResourceCollections themselves
>need a namespace. 
>
The question is not whether the resourcecollection themselve need a 
namespace, but if it would be allowed to address elements from the same 
namespace, so that the default namespace declaration would work for the 
entire nested  set of elements, including the element itself.

> I have modified FileSet and similar
>existing types to implement ResourceCollection. 
>Really the whole problem goes back to and/or/not, etc.
> "The Princess and the Pea."  Anyway, I translate your
>example above as:
>
><project xmlns:rs="ant:resourceselectors">
>  <restrict><!-- ResourceCollection type -->
>    <!-- FileCollection aka files has no basedir -->
>    <files name="${basedir}/foo/**/*.java" />
>    <!-- haven't written this selector yet; here
>         mimicked date FileSelector -->
>    <rs:date when="after" datetime="2005/04/15"
>             pattern="yyyy/MM/dd" />
>  </restrict>
></project>
>
>  
>
Why would the date have the rs namespace and the files not, both are 
used inside the resourcecollection?

>Does that make sense?
>
>-Matt
>  
>

So now up to the alternatives using the names of above example (Same 
letter means equivalent in XML):
A1 (shameless copy from above)

<project xmlns:rs="ant:resourceselectors">
  <restrict>
    <files name="${basedir}/foo/**/*.java" />
    <rs:date when="after" datetime="2005/04/15" 
             pattern="yyyy/MM/dd" />
  </restrict>
</project>

A2:

<project>
  <restrict>
    <files name="${basedir}/foo/**/*.java" />
    <date when="after" datetime="2005/04/15"
             pattern="yyyy/MM/dd" xmlns="ant:resourceselectors"/>
  </restrict>
</project>

B1 (difference files allowed / mandated to be in rs namespace)

<project xmlns:rs="ant:resourceselectors">
  <restrict>
    <rs:files name="${basedir}/foo/**/*.java" />
    <rs:date when="after" datetime="2005/04/15" 
             pattern="yyyy/MM/dd" />
  </restrict>
</project>

B2:

<project>
  <restrict>
    <files name="${basedir}/foo/**/*.java" xmlns="ant:resourceselectors"/>
    <date when="after" datetime="2005/04/15"
             pattern="yyyy/MM/dd" xmlns="ant:resourceselectors"/>
  </restrict>
</project>

C1  (difference now allos restric allowed / mandated to be in rs 
namespace, maybe a better name would in that case be resourcecollections)

<project xmlns:rs="ant:resourceselectors">
  <rs:restrict>
    <rs:files name="${basedir}/foo/**/*.java" />
    <rs:date when="after" datetime="2005/04/15" 
             pattern="yyyy/MM/dd" />
  </rs:restrict>
</project>

C2:

<project>
  <restrict xmlns="ant:resourceselectors">
    <files name="${basedir}/foo/**/*.java" />
    <date when="after" datetime="2005/04/15" 
             pattern="yyyy/MM/dd" />
  </restrict>
</project>

D: (no namespace at all, with the danger and problems of clashes, 
extensively discuussed before.)

<project>
  <restrict>
    <files name="${basedir}/foo/**/*.java" />
    <date when="after" datetime="2005/04/15" 
             pattern="yyyy/MM/dd" />
  </restrict>
</project>

Are there any other variations possible, are variant A-D feasible, and 
what is best. (I'd currently say B or C)

Martijn

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message