ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <sc...@alodar.com>
Subject Re: Critique my optional file copy target, please?
Date Tue, 05 Feb 2002 22:48:55 GMT

On Tuesday, February 5, 2002, at 09:00  AM, Scott Ellsworth wrote:

> On Tuesday, February 5, 2002, at 02:47  AM, Stefan Bodewig wrote:
>
>> On Mon, 4 Feb 2002, Scott Ellsworth <scott@alodar.com> wrote:
>>
>>> <target name="copy" depends="init" if="copy.needed">
>>>    <rmdir dir="${compile.source}"/ >
>>
>> wouldn't that delete the "new" sources that follow your new layout or 
>> is <rmdir> a shortcut for a task that knows which files to delete and 
>> which to leave alone?
>
> The copy.needed property should only be set for the old sources.

Regrettable, my original copy-setup task was written as:

<target name="copy-setup" depends="init">
   <condition property="copy.needed" >
       <equals arg1="${compile.src}" arg2="${src}" />
   </condition>
</target>

which sets the property copy.needed only if src and compile.src were the 
same.  This is exactly the case where we do NOT want such a beast set.

Thus, Stefan was right in the original letter, and this should either be 
wrapped with a not tag:

<target name="copy-setup" depends="init">
   <condition property="copy.needed" >
     <not>
       <equals arg1="${compile.src}" arg2="${src}" />
     </not>
   </condition>
</target>

and the copy target used as written, or the copy-setup target should not 
be changed, but the property should be named "copy.superfluous", and the 
copy target should be written

<target name="copy" depends="copy-setup" unless="copy.superfluous">
    <rmdir dir="${compile.source}"/ >
   <copy ... />
</target>

In other words, the assumption

> Assuming my copy-setup target properly does not set it for projects in 
> the new layout, the entire copy target will not happen for a new layout 
> project because of the if.

was exactly backwards.

Thanks for the warning - I would not have been happy hunting through my 
empty directories for my source ;-) .

Scott


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


Mime
View raw message