ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Waugh" <ptwa...@gmail.com>
Subject Re: Optional <entry/> if and only if properties file exists?
Date Thu, 13 Nov 2008 15:02:18 GMT
Interesting.  <if> works for me, but not <ac:if>

Patrick

On Thu, Nov 13, 2008 at 8:59 AM, Scot P. Floess <sfloess@nc.rr.com> wrote:
>
> ac is the namespace for Ant Contrib, if - thats the Ant Contrib task if
>
>
>
>
> On Thu, 13 Nov 2008, Patrick Waugh wrote:
>
>> What is <ac:if>  ?????
>>
>> On Thu, Nov 13, 2008 at 7:04 AM,  <Jan.Materne@rzf.fin-nrw.de> wrote:
>>>>>
>>>>> <target name="checkprops">
>>>>>  <condition property="propfileexists">
>>>>>  <available file="path/to/your/propsfile"/>
>>>>>  </condition>
>>>>>  ...
>>>>> </target>
>>>>>
>>>>>
>>>>> <target name="foobar" depends="checkprops" unless="propfileexists">
>>>>> <my.rapc/>
>>>>> <target>
>>>>>
>>>>> <target name="foobaz" depends="checkprops" if="propfileexists">
>>>>> <my.rapc>
>>>>>   <entry file="entryGUI.properties" />
>>>>> </my.rapc>
>>>>> <target>
>>>>>
>>>>>
>>>>> or check the condition with antcontrib if/else in one target
>>>>>
>>>>> <target ....
>>>>>  <if>
>>>>>  <available file="path/to/your/propsfile"/>
>>>>>  <then>
>>>>>   <my.rapc>
>>>>>    <entry file="entryGUI.properties" />
>>>>>   </my.rapc>
>>>>>  </then>
>>>>>  <else>
>>>>>   <my.rapc/>
>>>>>  </else>
>>>>>  </if>
>>>>> </target
>>>
>>> I would use the ac:if inside the makro.
>>>
>>> <macrodef name="my.rapc">
>>>   <attribute name="entryfile" default="--not-available-file--"/>
>>>   <attribute name="output" default="${cod.name}"/>
>>>   <attribute name="srcdir" default="${src.dir}"/>
>>>   <attribute name="destdir" default="${build.dir}"/>
>>>   <attribute name="jdp" default="project.properties"/>
>>>   <element name="inside-rapc" implicit="true"/>
>>>   <sequential>
>>>       <ac:if>
>>>           <available file="@{propfile}"/>
>>>           <then>
>>>               <rapc output="@{output}" srcdir="@{srcdir}"
>>> destdir="@{destdir}">
>>>                   <jdp file="@{jdp}">
>>>                       <entry file="@{entryfile}" />
>>>                   </jdp>
>>>                   <inside-rapc/>
>>>               </rapc>
>>>           </then>
>>>           <then>
>>>               <rapc output="${cod.name}" srcdir="${src.dir}"
>>> destdir="${build.dir}">
>>>                   <jdp file="project.properties"/>
>>>                   <inside-rapc/>
>>>               </rapc>
>>>           </then>
>>>       </ac:if>
>>>   </sequential>
>>> </macrodef>
>>>
>>>
>>>
>>> <my.rapc/>
>>> <my.rapc entryfile="entryGUI.properties"/>
>>> <my.rapc outdir="other-outdir"/>
>>> <my.rapc>
>>>   <snip/>
>>>   <snip/>
>>>   <snip/>
>>> </my.rapc>
>>>
>>>
>>>
>>>
>>> Jan
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>
> Architect Keros          http://sourceforge.net/projects/keros
>

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


Mime
View raw message