Hi,

-----Original Message-----
From: warhero [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 18, 2007 2:53 AM
To: user@ant.apache.org
Subject: ANT / AntXtras quick question.


/*
I'm having trouble trying to figure out how to make sure a property is
not
empty.

So I have a properties file like so
myprop=something.

And if the myprop is not empty (myprop=) then execute something. Does
that
make sense? here's some kind of pseudocode.

<if myprop != ''>
  <exec whatever>
</if>

Just some pseudo code, but get's the point across..
*/

If you're running the AntXtras task suite you can go with assert, i.e.

<project name="bla" default="main" basedir=".">
  <!-- // Taskdefs -->
  <!-- Import AntXtras -->
  <taskdef resource="com/idaremedia/antx/install/antlib.xml"/>
  <!-- Taskdefs // -->

  <!-- // Properties -->
  <property name="testproperty" value="foobar"/>
  <!-- Properties // -->

    <target name="depends">

<!-- make sure property is set, but will also return true if property
        is set to "" -->
 <assert isset="testproperty"/>
 <!-- make sure the property is a string of chars, will return
    false if it's set to 12345 or also if property is an empty string ""
-->
<assert matches="\w+" property="testproperty"/>
      
   <echo>
     Yup, $${testproperty} set to ${line.separator} => ${testproperty}
    </echo>
        
    </target>

    <target name="main" depends="depends"/>
</project>


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

Reply via email to