tags:

views:

7

answers:

1

Trying to learn Phing, by converting Ant Build.xml to Phing. Can't seem to find a search function on Phing User doc....

This is what I have:

<condition property="script-suffix" value=".bat" else="">
<os family="windows" />
</condition>

<echo message="Script-suffix is ${script-suffix}" />

There are two problems that I need to fix but I don't know how:

  1. I don't know how to convert this condition into Phing acceptable. The else="" attribute is causing an error.

  2. I cannot access the script-suffix property using ${script-suffix}

I've tried ${project.script-suffix}, ${phing.script-suffix}, $, and other obvious combination. And attempted to change the condition using the <if>, <else> tag and failed spectacularly T__T.

Thank you in advance ^__^.

A: 
<condition property="script-suffix" value=".bat">
<os family="windows" />
</condition>

<if>
<equals arg1="${script-suffix}" arg2=".bat" />
<then>
<os family="windows" />
</then>
<else>
<property name="script-suffix" value="" />
</else>
</if>
<echo message="---- Build Properties ----" />
<echo message="" />

<echo message="OS is ${os.name}" />
<echo message="Basedir is ${project.basedir}" />

<echo message="Script-suffix is ${script-suffix}" />

<echo message="" />
<echo message="---- Storefront Properties ----" />

Ah I think I got it, I don't have a window machine to test the window os option though. Thank you.

mythicalprogrammer