ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From flo...@iucha.net (Florin Iucha)
Subject question about filesets and conditions
Date Mon, 19 Jul 2004 19:34:42 GMT
Hello,

I have a question: why can conditions be attached to "include/exclude" 
but not to (zip|tar)filesets?

I am creating a build_common imported from a lot of components whose
sources are stored in individual directories. Each component can have 
one of more of A, B, and C types of sources, stored in src/A, src/B
and src/C in a component directory.

When I try to package the sources using tar, I am trying a recipe like
this:
   <target name="package.component">
      <tar destfile="${package.base}/${package.name}" compression="gzip">
         <tarfileset dir="${src.dir}/A" prefix="P1">
            <include name="**/*" if="component.has.A" />
         </tarfileset>
         <tarfileset dir="${src.dir}/B" prefix="P2">
            <include name="**/*" if="component.has.B" />
         </tarfileset>
         <tarfileset dir="${src.dir}/C" prefix="P3">
            <include name="**/*" if="component.has.C" />
         </tarfileset>
      </tar>
   </target>

Now, this works for components that have src/A, src/B and src/C, but fails
for component that miss any of them, because the tarfileset refers to a
missing directory.

I could change it to 
         <tarfileset dir="${src.dir}" prefix="P2">
            <include name="B/**/*" if="component.has.B" />
         </tarfileset>
but then there is no way to get rid of B since the tarfileset does not
accept a mapper.

Is that by design that filesets do not accept conditions, or should I 
just file an enhancement request?

Thank you,
florin

-- 

Don't question authority: they don't know either!

Mime
View raw message