Hi all,
In my previous email there was a copy-and-paste
problem, and my explanation was incomplete!
I'll try again...
I use to structure projects like this:
/myProject
+ default.build
+ /src
+ default.build
+ /subproject1
| + default.build
| + mySource.cs
+ /subproject2
+ default.build
+ mySource.cs
This structure let me build subprojects from any
level. The build file located in the /src directory
is just a gateway build file, and looks like this:
<?xml version="1.0"?>
<project
name="myProject"
default="recurse">
<target
name="recurse"
description="Builds recursively all subprojects">
<foreach
item="Folder"
property="foldername">
<in>
<items>
<includes name="*"/>
<excludes name="CVS"/>
</items>
</in>
<do>
<nant
buildfile="${foldername}/default.build"
target="${project.config} ${target}"/>
</do>
</foreach>
</target>
</project>
The 'target' property of the <nant> task specifies
two targets: ${project.config} and ${target}. Both
are inherited from the calling build file (the one
located in the project's root directory).
${project.config} contains 'release' or 'debug', while
${target} contains the target that should be executed
in each subproject.
My proposal is to introduce the concept of "generic target".
Let's go back to our gateway build file described above,
and rewrite the <recurse> target as a generic target:
<?xml version="1.0"?>
<project
name="myProject"
default="*">
<target
name="*"
description="Builds recursively all subprojects">
<foreach
item="Folder"
property="foldername">
<in>
<items>
<includes name="*"/>
<excludes name="CVS"/>
</items>
</in>
<do>
<nant
buildfile="${foldername}/default.build"
target="${project.config} ${nant.current.target}"/>
</do>
</foreach>
</target>
</project>
Generic targets would specify "*" as their name, and NAnt
would always execute them. At that point we also need a way
to get the target name specified by the calling build file,
and the answer is a built-in property named ${nant.current.target}.
What's your opinion?
j3d.
----------------------------------------
Giuseppe Greco
::agamura::
phone: +41 (0)91 604 67 65
mobile: +41 (0)76 390 60 32
email: [EMAIL PROTECTED]
web: www.agamura.com
----------------------------------------
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers