Hmm... if all he wanted was to select build.xml where
a project.properties lives alongside, the following
seems to work for me:

  <fileset dir="${basedir}" includes="*/build.xml">
    <present targetdir="${basedir}">
      <mapper type="glob" from="*/build.xml"
to="*/project.properties" />
    </present>
  </fileset>

-Matt

--- [EMAIL PROTECTED] wrote:

> I think the easiest possibility is using a
> <scriptselector>:
> 
> <scriptselector language="javascript">
>     if (file.isDirectory()) {
>         markerName =
> project.getProperty("markerfile");
>         markerFile = new java.io.File(file,
> markerName);
>         self.setSelected( markerFile.exists() );
>     }
> </scriptselector>
> 
> I've created an AntUnit test ...
> 
> 
> Jan
> 
> 
> 
> 
> 
>
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> <project xmlns:au="antlib:org.apache.ant.antunit"
> default="suite">
>     <description>
>         Select only directories which contain a
> marker file.
>     </description>
> 
> 
>     <property name="workingdir" value="working"/>
>     <property name="markerfile" value=".marker"/>
>     
>     
>     <target name="setUp">
>         <!-- Create a small directory structure -->
>         <mkdir
> dir="${workingdir}/dir1/dir11/dir111"/>
>         <mkdir
> dir="${workingdir}/dir1/dir11/dir112"/>
>         <mkdir dir="${workingdir}/dir2/dir22"/>
>         <!-- Mark some of them -->
>         <macrodef name="mark">
>             <attribute name="dir"/>
>             <sequential>
>                 <touch
> file="${workingdir}/@{dir}/${markerfile}"/>
>             </sequential>
>         </macrodef>
>         <mark dir="dir1/dir11/dir112"/>
>         <mark dir="dir2/dir22"/>
>         <mark dir="dir2"/>
>         <!-- The dirset which contains only marked
> directories -->
>         <dirset id="dirset" dir="${workingdir}">
>             <scriptselector language="javascript">
>                 if (file.isDirectory()) {
>                     markerName =
> project.getProperty("markerfile");
>                     markerFile = new
> java.io.File(file, markerName);
>                     self.setSelected(
> markerFile.exists() );
>                 }
>             </scriptselector>
>         </dirset>
>         <!-- Ensure we have a platform independend
> output format (in contrast to ${tostring:dirset} -->
>         <pathconvert property="selected" dirsep="/"
> pathsep="${line.separator}">
>             <path><dirset refid="dirset"/></path>
>         </pathconvert>
>         <!-- Log the dirset so we can make some
> assertions -->
>         <echo>${selected}</echo>
>         <echo file="log.txt">${selected}</echo>
>     </target>
> 
>     <target name="tearDown">
>         <delete dir="${workingdir}"/>
>     </target>
>     
>     <target name="suite">
>         <au:antunit>
>             <file file="${ant.file}"/>
>             <au:plainlistener/>
>         </au:antunit>
>     </target>
>     
>     <target name="test-1-11-112-marked">
>         <au:assertLogContains
> text="dir1/dir11/dir112${line.separator}"/>
>     </target>
>     
>     <target name="test-1-11-111-notmarked">
>         <au:assertLogDoesntContain
> text="dir1/dir11/dir111${line.separator}"/>
>     </target>
>     
>     <target name="test-2-marked">
>         <au:assertLogContains
> text="dir2${line.separator}"/>
>     </target>
> 
>     <target name="test-1-notmarked">
>         <au:assertLogDoesntContain
> text="dir1${line.separator}"/>
>     </target>
> 
> </project>
>
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> 
>  
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Dominique Devienne
> [mailto:[EMAIL PROTECTED] 
> > Gesendet: Donnerstag, 29. November 2007 20:22
> > An: Ant Users List
> > Betreff: Re: AW: Alternative to subant
> > 
> > On Nov 29, 2007 12:40 PM, Francisco Tolmasky 
> > <[EMAIL PROTECTED]> wrote:
> > > Is there any way to say:
> > > "Use the build file in the directory if the
> directory 
> > contains a properties file?"
> > 
> > I would have thought it to be possible with
> selectors and a mapper,
> > but I don't see how do it in practice. I thought I
> used to do
> > something like this...
> > 
> > Note that 
> >
>
http://ant.apache.org/manual/CoreTypes/resources.html#restrict
> > could be the solution, but I'm not very familiar
> with the new Resource
> > Collection framework, as I have no practical
> experience with it.
> > 
> > I think Jan or Matt will know though ;-) --DD
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



      
____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to