----- Original Message -----
From: "Giuseppe Greco" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 02, 2004 7:49 AM
Subject: [nant-dev] Current target again...


> 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.

I don't immediately see a need for this.

> 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}.

I'm not sure we should implement this, but if we should we'd definitely
implement it as a function, not a built-in property.

I guess we could add the following functions :

target::get-target-name or target::get-current-target()

    this function returns the name of the current target
    this would throw an exception when there's no current target

target::get-description(string targetname)

    this functions returns the description of the specified target
    this would throw an exception when the targetname is null or the given
target does not exist

But I'd like to get feedback of other committers first ...

Gert



-------------------------------------------------------
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

Reply via email to