Re: using foreach to loop through strings

Bob Archer <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
Your fileset it probably empty. You don't specify a basedir. Is AjaxControlToolkit literally the name of a file?

BOb


From: Beth Hechanova [mailto:[email protected]]
Sent: Tuesday, October 20, 2009 2:32 PM
To: [email protected]
Subject: [NAnt-users] using foreach to loop through strings

Hi,

I'm trying to make my build scripts a bit more maintainable.  Part of the build script's job is to tag code into svn and export code from svn.  We have a directory in svn called 'thirdParty' to hold our thirdParty libs.    The thirdParty directory holds thirdParty libs for many different applications.

In my application build script, I am currently itemizing each individual thirdParty folder in both the target that tags the source code and the target that exports the source code.  If I add a new thirdParty dependency, I have to remember to update the build script in both places.

What I'd like to do is keep a "list" of thirdParty dependencies by my application in a single place.  Then in both the tag and export targets iterate over that list and build the appropriate command from the items in that list.  I'm trying to use fileset and foreach tasks to accomplish this, but so far I haven't been able to get it to work.

My fileset looks like (this is not contained in a target):
  <fileset id="thirdPartyDirs" >
    <include name="LLBLGenPro_v2.6" asis="true" />
    <include name="AjaxControlToolkit" asis="true" />
  </fileset>

And here's a portion of my target for exporting using the foreach task:
<target name="export.source.new" description="Gets the latest files from Svn">

    <foreach item="String" property="thirdParty.name" >
      <in>
        <items refid="thirdPartyDirs" />
      </in>
      <do>
        <echo message="found ${thirdParty.name}"/>

        <exec program="svn">
          <arg value="export" />
          <arg value="--force" />
          <arg value="${export.source.root}/thirdParty/${thirdParty.name}" />
          <arg value="${buildarea.application.thirdparty}/${thirdParty.name}" />
        </exec>
      </do>
    </foreach>
...

Something is not set up quite right as the message "found ${thirdParty.name}" never gets printed.

What am I missing?  Or, if there is a easier/better way to accomplish the same thing using different tasks, please let me know.
I am using the latest nightly build: (Build 0.86.3412.0; nightly; 5/5/2009)

Thanks,
Beth

This email and any files transmitted with it are confidential & proprietary to Systems and Software Enterprises, Inc. (dba IMS). This information is intended solely for the use of the individual or entity to which it is addressed. Access or transmittal of the information contained in this e-mail, in full or in part, to any other organization or persons is not authorized.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.