ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re[2]: reverse glob mapper pattern?
Date Mon, 23 Sep 2002 19:43:22 GMT
Hello Diane,

I've got things working with one more issue to solve.  Stefan Bodewig pointed out that if
I set the
properties that have my directory locations using the "location"
attribute rather than "value", Ant will turn it into a nice absolute
path just like the fileset produces.  Now the <map> works for me.  So,
I currently have this:

        <fileset dir="${src.dir}" id="src.sample.fs">
            <present targetdir="${src.dir}">
                <mapper type="glob" from="sample.*" to="*" />
        <fileset dir="${build.dir}" id="build.sample.fs">
            <present targetdir="${build.dir}">
                <mapper type="glob" from="sample.*" to="*" />

        <pathconvert pathsep="," property="src.sample.fs.copies" refid="src.sample.fs">
            <map from="${src.dir}${file.separator}sample." to=""/>
        <pathconvert pathsep="," property="build.sample.fs.copies" refid="build.sample.fs">
            <map from="${build.dir}${file.separator}sample." to=""/>

        <echo message="${src.sample.fs.copies}"/>
        <echo message="${build.sample.fs.copies}"/>
            <fileset dir="${src.dir}" includes="${src.sample.fs.copies}"/>
            <fileset dir="${build.dir}" includes="${build.sample.fs.copies}"/>

Now this works *if* there are * files that have an equivalent sample.*
also existing.  However, now I have a problem that if this is run and
no * files exist, the "includes" attribute on the filesets inside
<delete> ends up being empty like includes="".  When that happens, the
fileset selects *all* files as part of the fileset so the entire
project is deleted except for the default excludes.  That is extremely
bad!  I tried fixing it by providing a "encludes" attribute like
excludes="**/**".  However, now that overrides the "includes"
attribute and won't delete anything even if the "includes" attribute
actually list files to include.

Is there a way to say exclude everything except for a non-empty
"includes" attribute?

Monday, September 23, 2002, 1:33:09 PM, you wrote:

DH> --- Dominique Devienne <> wrote:
>> You'll also see that the <present> selector selects the wrong files,

DH> No, it selects it says it does -- namely, it selects only those files that
DH> have an equivalent, as specified. It doesn't say it'll return *both* the
DH> files that have an equivalent *and* the equivalent file(s) as well.

DH> You could, theoretically, do it with two <fileset>'s (one to do an
DH> equivalent for sample.* -> *, and one to do it the other way around) --
DH> only when you're doing delete's, by the time you get to evaluating the
DH> second <fileset>, the equivalents have already been deleted, so the second
DH> <fileset> comes up empty, which is why you need to evaluate them
DH> beforehand, and get the files they return into a property, then pass the
DH> value of that property to <delete>. And of course, since <delete> won't
DH> take more than one file in the 'file' attribute, you need to pass the list
DH> to 'includes' instead, which is why you need to lop off the leading path
DH> up to the directory specified in 'dir', which is why you need to go
DH> through <pathconvert>.

DH> Diane

DH> =====
DH> (

DH> __________________________________________________
DH> Do you Yahoo!?
DH> New DSL Internet Access from SBC & Yahoo!

DH> --
DH> To unsubscribe, e-mail:   <>
DH> For additional commands, e-mail: <>

Best regards,

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message