You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David <ac...@yahoo.es> on 2006/10/16 18:30:17 UTC

How to preserve a property assigned via antcall on main build process?

Dear members,
   
  I am figthing for avoiding to use <if> from ant contrib lib, but I guess for solving this problem there is no other solution.
   
  I have the following targets:
   
  <target name="target" depends="target-pre"
   unless ="target.skip">
  ...
  </target>
   
  Note: From working properly this target I need to compute the property target.var.value (and this property could be assigned previoulsy if some target needed such property before)
   
  Now 
   
  <target name="target-pre" unless ="target.var.value">
    <antcall target="compute-target1.var1"/>
    <property name="target.var1.value" value="the value is: ${target.var}"/>
  </target>
   
  This is the best solution, but the problem comes from the fact that the property computed on target compute-target1.var (property target.var) is not assigned after antcall invokation, so it doesn't work.
   
  but If I use instead of antcall, just dependences I get the value of target.var properly
   
  <target name="target-pre" unless ="target.var"
   depends="compute-target.var">
    <property name="target.var.value" value="the value is: ${target.var}"/>
  </target>
   
  what I don't like about this solution is that the dependences targets are ALWAYS execute even if the property target.var was defined or not. This is a simple case, but on my case the computation of target.var is a complex task, so I have to run it always.
   
  Using ant contrib it is inmidiatly using <if> task, but I don't want to add more library dependence to my project.
   
  Do you have any idea about how to solve this problem?
   
  Thanks,
   
  David

 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.

Re: How to preserve a property assigned via antcall on main build process?

Posted by "Scot P. Floess" <fl...@mindspring.com>.
I completely agree.  I too fought the urge to use ant contrib for the 
same reasons (I was bent on stock ant).  But, if you use ant like you 
might use a shell script, ant contrib makes perfect sense.  Its a 
"small" dependency andmake your build.xml much cleaner and easier to 
understand.

Vishal Vishnoi wrote:
> I used to be in the same boat sometime back, where I thought using 
> ant-contrib is building too many external dependency.
>
> Over time I've realized that Ant-contrib is very stable and 
> complements Ant very well. If you need to use 'if', then use 'if'. 
> Don't fight it, otherwise you will end up with horrible hard to 
> understand code.
>
> --Vishal
>
> David wrote:
>
>> Dear members,
>>    I am figthing for avoiding to use <if> from ant contrib lib, but I 
>> guess for solving this problem there is no other solution.
>>    I have the following targets:
>>    <target name="target" depends="target-pre"
>>   unless ="target.skip">
>>  ...
>>  </target>
>>    Note: From working properly this target I need to compute the 
>> property target.var.value (and this property could be assigned 
>> previoulsy if some target needed such property before)
>>    Now    <target name="target-pre" unless ="target.var.value">
>>    <antcall target="compute-target1.var1"/>
>>    <property name="target.var1.value" value="the value is: 
>> ${target.var}"/>
>>  </target>
>>    This is the best solution, but the problem comes from the fact 
>> that the property computed on target compute-target1.var (property 
>> target.var) is not assigned after antcall invokation, so it doesn't 
>> work.
>>    but If I use instead of antcall, just dependences I get the value 
>> of target.var properly
>>    <target name="target-pre" unless ="target.var"
>>   depends="compute-target.var">
>>    <property name="target.var.value" value="the value is: 
>> ${target.var}"/>
>>  </target>
>>    what I don't like about this solution is that the dependences 
>> targets are ALWAYS execute even if the property target.var was 
>> defined or not. This is a simple case, but on my case the computation 
>> of target.var is a complex task, so I have to run it always.
>>    Using ant contrib it is inmidiatly using <if> task, but I don't 
>> want to add more library dependence to my project.
>>    Do you have any idea about how to solve this problem?
>>    Thanks,
>>    David
>>
>>        
>> ---------------------------------
>> Do you Yahoo!?
>> Get on board. You're invited to try the new Yahoo! Mail.
>>  
>>
>
>
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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


Re: How to preserve a property assigned via antcall on main build process?

Posted by Vishal Vishnoi <vv...@bea.com>.
I used to be in the same boat sometime back, where I thought using 
ant-contrib is building too many external dependency.

Over time I've realized that Ant-contrib is very stable and complements 
Ant very well. If you need to use 'if', then use 'if'. Don't fight it, 
otherwise you will end up with horrible hard to understand code.

--Vishal

David wrote:

>Dear members,
>   
>  I am figthing for avoiding to use <if> from ant contrib lib, but I guess for solving this problem there is no other solution.
>   
>  I have the following targets:
>   
>  <target name="target" depends="target-pre"
>   unless ="target.skip">
>  ...
>  </target>
>   
>  Note: From working properly this target I need to compute the property target.var.value (and this property could be assigned previoulsy if some target needed such property before)
>   
>  Now 
>   
>  <target name="target-pre" unless ="target.var.value">
>    <antcall target="compute-target1.var1"/>
>    <property name="target.var1.value" value="the value is: ${target.var}"/>
>  </target>
>   
>  This is the best solution, but the problem comes from the fact that the property computed on target compute-target1.var (property target.var) is not assigned after antcall invokation, so it doesn't work.
>   
>  but If I use instead of antcall, just dependences I get the value of target.var properly
>   
>  <target name="target-pre" unless ="target.var"
>   depends="compute-target.var">
>    <property name="target.var.value" value="the value is: ${target.var}"/>
>  </target>
>   
>  what I don't like about this solution is that the dependences targets are ALWAYS execute even if the property target.var was defined or not. This is a simple case, but on my case the computation of target.var is a complex task, so I have to run it always.
>   
>  Using ant contrib it is inmidiatly using <if> task, but I don't want to add more library dependence to my project.
>   
>  Do you have any idea about how to solve this problem?
>   
>  Thanks,
>   
>  David
>
> 		
>---------------------------------
>Do you Yahoo!?
> Get on board. You're invited to try the new Yahoo! Mail.
>  
>


_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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


Re: How to preserve a property assigned via antcall on main build process?

Posted by Dominique Devienne <dd...@gmail.com>.
>  Do you have any idea about how to solve this problem?

1) Simply add the unless ="target.var" directly to compute-target.var,
if the latter doesn't have any dependencies (or copy the content of
compute-target.var to target.pre).

2) Convert compute-target.var to a macro, which share the Project (and
thus properties) with the calling target.

3) Use Ant-Contrib's <if>.

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


Re: How to preserve a property assigned via antcall on main build process?

Posted by Dominique Devienne <dd...@gmail.com>.
On 10/16/06, David <ac...@yahoo.es> wrote:
> Dear members,
>
>  I am figthing for avoiding to use <if> from ant contrib lib, but I guess for solving this problem there is no other solution.
>
>  I have the following targets:
>
>  <target name="target" depends="target-pre"
>   unless ="target.skip">
>  ...
>  </target>
>
>  Note: From working properly this target I need to compute the property target.var.value (and this property could be assigned previoulsy if some target needed such property before)
>
>  Now
>
>  <target name="target-pre" unless ="target.var.value">
>    <antcall target="compute-target1.var1"/>
>    <property name="target.var1.value" value="the value is: ${target.var}"/>
>  </target>
>
>  This is the best solution, but the problem comes from the fact that the property computed on target compute-target1.var (property target.var) is not assigned after antcall invokation, so it doesn't work.
>
>  but If I use instead of antcall, just dependences I get the value of target.var properly
>
>  <target name="target-pre" unless ="target.var"
>   depends="compute-target.var">
>    <property name="target.var.value" value="the value is: ${target.var}"/>
>  </target>
>
>  what I don't like about this solution is that the dependences targets are ALWAYS execute even if the property target.var was defined or not. This is a simple case, but on my case the computation of target.var is a complex task, so I have to run it always.
>
>  Using ant contrib it is inmidiatly using <if> task, but I don't want to add more library dependence to my project.
>
>  Do you have any idea about how to solve this problem?
>
>  Thanks,
>
>  David
>
>
> ---------------------------------
> Do you Yahoo!?
>  Get on board. You're invited to try the new Yahoo! Mail.
>

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