You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/07/20 06:34:20 UTC

DO NOT REPLY [Bug 30199] New: - add failonerror option to zip|tar|jar tasks (to ignore non-existent directories)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30199>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30199

add failonerror option to zip|tar|jar tasks (to ignore non-existent directories)

           Summary: add failonerror option to zip|tar|jar tasks (to ignore
                    non-existent directories)
           Product: Ant
           Version: 1.6.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: florin@iucha.net
                CC: florin@iucha.net


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.

I have worked around the problem by wrapping each copy task in it's own target
that is guarded by a condition, but this is ugly...

The easiest fix would be if the tar task would simply ignore the 
filesets with missing directories - something like copy has with
"failonerror".

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