I discovered what the problem was: If I referenced the NAnt schema in my
master build file, but not in the include build file, the targets would not
execute.  For example:

Master build file:

<project name="test"
xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd";
default="build">
   
    <include buildfile="sample.build" />

    <target name="build">
        <call target="hello" />
    </target>
</project>

Include file:

<project name="test"
xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd"; >
    <target name="hello">
        <echo message="hello world" />
    </target>
</project>

In this situation master.build would call the "hello" target successfully:
----------------------------------------
Target(s) specified: build

build:


hello:

     [echo] hello world

BUILD SUCCEEDED

Total time: 0.1 seconds.
----------------------------------------

However, if the project in Include file was defined like this:

<project name="test" >
    <target name="hello">
        <echo message="hello world" />
    </target>
</project>

I would get output like this:
----------------------------------------
Target(s) specified: build

build:


hello:


BUILD SUCCEEDED

Total time: 0 seconds.
----------------------------------------

// Neil

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Neil
Cowburn
Sent: 22 November 2004 10:08
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Re: [nant-dev] Separating targets into individual files

I don't know what I was doing wrong, but I've now got the behavior I was
seeking. Very weird.

// Neil

----- Original Message -----
From: Ian MacLean
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Mon, 22 Nov 2004 12:06:18 +0900
Subject: Re: [nant-dev] Separating targets into individual files

Neil Cowburn wrote:

>Heh. My mistake. It *seemed* to the executing the targets... Until I 
>released that the targets were empty :)
>
>The include task is working as documented, but what I'd like to see is 
>something analogous to include files in ASP where targets can be 
>separated out into an external build file. This build file is the 
>referenced in a master build file where the targets in the external 
>build file may or may not be called from the master file. Using the 
><nant> task just doesn't cut it as you can't specific a target to execute.
>
>  
>
Maybe I'm not understanding your question - but you can call specific
targets in an included build file from a master file. And as Troy pointed
out you can call individual targets using the nant task as well.  

Ian


>--Neil
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Ian 
>MacLean
>Sent: 18 November 2004 04:40
>To: [EMAIL PROTECTED]
>Cc: 'NAnt Developers'
>Subject: Re: [nant-dev] Separating targets into individual files
>
>Neil Cowburn wrote:
>
>  
>
>>I have a number of targets of various type (code compilers, file 
>>system management, custom scripts) and I'd like to separate them out 
>>into individual files and reference them from a master build file. I 
>>thought the <include> task would meet my requirements, but since it 
>>executes the targets in the included build file whenever the <include> 
>>task is touched, it does not.
>>
>>What I would like to be able to do is something like this:
>>
>><project name="...">
>>
>>      <!-- Global Properties -->
>>      <include buildfile="globals.build" />
>>
>>      <!-- Scripted target collection -->
>>      <include buildfile="scripts.build" />
>>
>>      <target name="build">
>>              <!-- 'myFunkyLittleScriptTarget' is 
>>                      defined in scripts.build -->
>>              <call target="myFunkyLittleScriptTarget" /> 
>>      </target>
>>
>></project>
>>
>>In the current model, all the targets in scrips.build would get called 
>>and the <call> task would try to invoke a target that is not defined.
>>Has anyone any thoughts on how I can achieve my goal?
>>
>> 
>>
>>    
>>
>thats certainly not the expected behaviour. The include task should 
>only execute top level ( project level ) tasks and not execute any targets.
>Can you post a small repro demonstrating the "all  targets getting
executed"
>behaviour.
>
>Ian
>
>  
>
>>--Neil
>>
>>
>>
>>
>>-------------------------------------------------------
>>This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS 
>>DOWNLOAD - A multidimensional database that combines robust object and 
>>relational technologies, making it a perfect match for Java, C++,COM, 
>>XML, ODBC and JDBC. www.intersystems.com/match8 
>>_______________________________________________
>>nant-developers mailing list
>>[EMAIL PROTECTED]
>>https://lists.sourceforge.net/lists/listinfo/nant-developers
>> 
>>
>>    
>>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS 
>DOWNLOAD - A multidimensional database that combines robust object and 
>relational technologies, making it a perfect match for Java, C++,COM, 
>XML, ODBC and JDBC. www.intersystems.com/match8 
>_______________________________________________
>nant-developers mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/nant-developers
>
>
>
>  
>






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to