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,  <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to