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 14:50:53 GMT
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


Mime
View raw message