ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Clegg" <andrew.cl...@gmail.com>
Subject Re: Issues with delete -- manual and FAQ incorrect (?)
Date Tue, 24 Jun 2008 09:44:42 GMT
I have just had a couple of thoughts which I'll post here for the
benefit of others who might be in a similar situation.

I think my original problem is because each of the subdirectories in
the autosrc tree contains an ignored .svn directory, meaning that none
of them are ever completely empty, so they don't get removed.

Perhaps this also explains why

               <delete verbose="true" includeemptydirs="true">
                       <fileset dir="autosrc"/>
               </delete>

leaves the autosrc directory, when the manual suggests it should
remove it. There's still a .svn file in there which protects it from
deletion.

I can't explain why the above target removed *everything* in that
autosrc tree when I tried it earlier this morning though -- perhaps I
had changed something else without realising it -- because running it
again now seems to have had the same effect as running it with the
include filter yesterday (i.e. leaving the directory tree intact).

So I don't think this is a bug after all. Indeed from my point of view
it's probably better not to delete the empty autosrc tree, and
recreate it when I re-run my code generation task, as this disconnects
the tree from subversion in an irritating way. However there is
perhaps a small inconsistency in the fact that Ant ignores .svn
directories (and various others) when deciding what to delete, but
doesn't ignore them when deciding if a directory is empty. I think
this was the root of my confusion, maybe it should be highlighted in
the manual?

Cheers,

Andrew.

2008/6/24 Andrew Clegg <andrew.clegg@gmail.com>:
> 2008/6/24 Stefan Bodewig <bodewig@apache.org>:
>
>> I don't think your directories info and src match the includes pattern
>> **/* which means "at least one directory level deeper than base".
>> What happens if you remove the includes attribute completely?
>
> That works! Thanks. But this means the manual is definitely wrong.
>
> From http://ant.apache.org/manual/CoreTasks/delete.html ...
>
>
>  <delete includeEmptyDirs="true">
>    <fileset dir="build"/>
>  </delete>
>
> deletes all files and subdirectories of build, including build itself.
>
>  <delete includeemptydirs="true">
>    <fileset dir="build" includes="**/*"/>
>  </delete>
>
> deletes all files and subdirectories of build, without build itself.
>
>
> However my target looks like this:
>
>
>        <target name="codegen.clean">
>                <delete verbose="true" includeemptydirs="true">
>                        <fileset dir="autosrc"/>
>                </delete>
>        </target>
>
>
> and it has just deleted everything inside my autosrc directory
> (except, correctly, .svn which is in the default excludes) but left
> autosrc itself intact.
>
>
> 09:24:00 0 jobs clegg@bsmlx47 ~/data/GanymedeWorkspace/cathws
> (436) bash $ ls -la autosrc/
> total 12
> drwxr-xr-x 3 clegg users 4096 Jun 24 09:23 .
> drwxr-xr-x 9 clegg users 4096 Jun 23 15:55 ..
> drwxr-xr-x 6 clegg users 4096 Jun 23 15:55 .svn
>
>
> Should I submit this as a bug report somewhere? I'm running Ant 1.6.5
> in Sun Java 1.6.0_06-b02 on Centos 5 (i.e. basically RedHat
> Enterprise).
>
> Thanks,
>
> Andrew.
>

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


Mime
View raw message