Well, out of that error and on to the next.  It seems that PropertyRegEx has an 
issue with the "\" as well.  I wrote a different macrodef that works without 
slashes, but not with slashes.  Anyone see a better way?

  <macrodef name="md.isInPropList" description="Find if a dir is a subdir of 
any dir in the list">
    <attribute name="var.item"/>
    <attribute name="var.itemList"/>
    <sequential>
      <!--First get rid of any values left from previous calls to this md and 
set to false-->
      <unset name="isInList"/>
      <property name="isInList" value="false"/>
      <!--For loop on each item in itemlist to see if any of them are true-->
      <for list="@{var.itemList}" param="item">
        <sequential>
          <!--Make sure regExResult isn't left over-->
          <unset name="regExResult"/>
          <!--Regex expression that will result in the value if it is in 
there-->
          <propertyregex property="regExResult"
            input="${propertyList}"
            override="true"
            regexp=".*(@{item})"
            select="\1"
            casesensitive="false"
          />
          <!--If regExResult is set to the value of the item, we have a match-->
          <if>
            <equals arg1="${regExResult}" arg2="${item}"/>
            <then>
              <unset name="isInList"/>
              <property name="isInList" value="true"/>
            </then>
          </if>
        </sequential>
      </for>
    </sequential>
  </macrodef>


Thanks,
Eric




________________________________
From: Eric Fetzer <[email protected]>
To: Ant Users List <[email protected]>
Sent: Wed, January 20, 2010 1:40:34 PM
Subject: Re: AppendToProperty MacroDef

Beautiful, thanks Scott!



On Jan 20, 2010, at 1:18 PM, "Scot P. Floess" <[email protected]> wrote:


You could use Ant Contrib's var task - probably be a little easier :)

<macrodef name="md.AppendProperty">
<attribute name="var.propertyName"/>
<attribute name="var.stringAppend"/>
<sequential>
  <var name="@{var.propertyName}" 
value="$...@{var.propertyname}}@{var.stringAppend}"/>
</sequential>
</macrodef>

On Wed, 20 Jan 2010, Eric Fetzer wrote:

Hi all.  I wrote a MacroDef to append a string to a property.  All works as 
planned until you slip a "\" in there and then it gets jacked up.  My 
javascripting has MUCH to be desired.  Any help?

  <macrodef name="md.AppendProperty">
    <attribute name="var.propertyName"/>
    <attribute name="var.stringAppend"/>
    <sequential>
      <script language="javascript"> <![CDATA[
        curVal=project.getProperty("@{var.propertyName}");
        project.setProperty("@{var.propertyName}",curVal+"@{var.stringAppend}");
        ]]>
      </script>
    </sequential>
  </macrodef>

Thanks,
Eric

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (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]



      


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


      

Reply via email to