>
> ----- Original Message -----
> From: "Giuseppe Greco" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 02, 2004 7:49 AM
> Subject: [nant-dev] Current target again...
>
>
>> ...
>>
>> 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.
Let me show you a more detailed example. Here is a
fragment of the caller build file (the one in the
project's top directory):
...
<target
name="test"
depends="init"
description="Tests the current configuration">
<property
name="target"
value="test"/>
<nant buildfile="src/default.build"/>
</target>
...
In this example, the "target" property is set to "test",
and then the <nant> task calls the gateway build file
described in my previous email. If NAnt would support
generic targets, we could reduce the target above like
this:
...
<target
name="test"
depends="init"
description="Tests the current configuration">
<nant
buildfile="src/default.build"
target="${target::get-current-target()}"/>
</target>
...
and then let gateway build files forward targets
automatically:
<?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} ${target::get-current-target()}"/>
</do>
</foreach>
</target>
</project>
I think this would be a nice feature... but, of course,
that's just my opinion.
j3d.
>
>> 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
>
----------------------------------------
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