I have blogged on this subject:
http://blogs.ittoolbox.com/visualbasic/dotnet/archives/002467.asp
I'll summarize for the lists benefit:
I created a CSV file to hold a list of projects to build. I use a three-layer build system.
1) default.build - Bootstrapper. Reads the CSV file and loops through it using <foreach> and performs a <nant name="projecttemplate.build"> on each project for each target.
2) projecttemplate.build - Project builder. Uses an <include file="Filesets.xml" /> to drive the behavior of the targets in projecttemplate.build.
3) filesets.xml - Configuration file that contains a <project> that has properties, named filesets and named namespaceimports sets containing all of the data necessary to control projecttemplate.build's behavior.
Payton Byrd
Trane eBusiness
QED Team
Phone: 931-905-5386
Fax: 931-648-5901
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Noel Llopis
Sent: Sunday, February 06, 2005 9:21 PM
To: nant-users@lists.sourceforge.net
Subject: [Nant-users] How can I list items once and use them in multiple targets?
I'm currently using Nant with some exec tasks to compile some Visual C++
projects directly (through devenv). Because of how things are, I want to
compile the projects, not the solution.
I could set up something along these lines (I know this is not correct
syntax, but it should help explain the point):
<?xml version="1.0"?>
<project name="Hello World" default="build" basedir=".">
<target name="debug">
<exec program="devenv" commandline="project1.vcproj /b debug"/>
<exec program="devenv" commandline="project2.vcproj /b debug"/>
<exec program="devenv" commandline="project3.vcproj /b debug"/>
<exec program="devenv" commandline="project4.vcproj /b debug"/>
</target>
</project>
</xml>
Of course, I also want to compile the projects in release mode (and in
several other configurations). What's the best way to do that without
having to duplicate all the project names again?
Ideally, I would like something like with make files:
<?xml version="1.0"?>
<project name="Hello World" default="build" basedir=".">
<list name="projects">
<item>project1</item>
<item>project2</item>
<item>project3</item>
<item>project4</item>
</list>
<target name="debug" foreach="projects">
<exec program="devenv" commandline="$1.vcproj /b debug"/>
</target>
<target name="release" foreach="projects">
<exec program="devenv" commandline="$1.vcproj /b release"/>
</target>
</project>
</xml>
Is something like that possible? I know about the trick of putting debug
into a variable and having the "build" target use it, but that means that
Nant won't build both debug and release without deleting the object files
first.
I'm sure it has to be something simple, but I haven't been able to find
anything like that in the documentation. Thanks.
--Noel
Games from Within
http://www.gamesfromwithin.com
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users