-----Original Message-----
From: Owen Rogers [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 14, 2005 8:25 PM
To: Arnette, Bill
Cc: nant-users@lists.sourceforge.net
Subject: Re: [Nant-users] Build target from command line without
dependencies

On 14/09/05, Arnette, Bill <[EMAIL PROTECTED]> wrote:
> When writing a build file that does everything from checking out the
> source to creating the installation package, it would be nice if you
> could run a target from the command line without running the
> dependencies.  Is this possible now?  

my preferred model is to have empty targets that manage a chain of
dependent tasks; all other tasks have no explicit dependencies.  this
gives me the greatest flexibility to inovke any task that i want and
establishes clear points for running my build from end to end.  it
also give great flexibility to recombine tasks however i want.

eg.
<target name="all" depends="clean,compile,test,deploy" />  <!-- note:
target is empty -->

<target name="compile">  <!-- note: target has no dependencies -->
...
</target>

btw, i would recommend being careful with the <call> task.  it tends
to produce a more rigid call chain and can lead to redundant task
calls.
cheers,
owen.
-- 
Owen Rogers | http://dotnetjunkies.com/weblog/exortech |
CruiseControl.NET - http://ccnet.thoughtworks.com


<Bill>
I guess maybe my Nant practices aren't the best, then.  My build files look
like this:

<target name="build-all" depends="projectA, projectB, projectC"/>

<target name="projectA"  depends="get-projectA-source, libX, libY, libZ">
   <!-- build projectA -->
   <exec program="devenv.com" commandline='projectA.vcproj /build
${build.config}'/>
</target>

<target name="projectB"  depends="get-projectB-source, libX">
   <!-- build projectB -->
   <exec program="devenv.com" commandline='projectB.vcproj /build
${build.config}'/>
</target>

<target name="projectC"  depends="projectA, libY, libZ,
get-projectC-source">
   <!-- build projectC -->
   <exec program="devenv.com" commandline='projectC.vcproj /build
${build.config}'/>
</target>

<target name="libX" depends="get-libX-source>
   <!-- build libX -->
   <exec program="devenv.com" commandline='libX.vcproj /build
${build.config}'/>
</target>

<target name="libY" depends="get-libY-source>
   <!-- build libY here -->
   <exec program="devenv.com" commandline='libY.vcproj /build
${build.config}'/>
</target>

<target name="libZ" depends="get-libZ-source>
   <!-- build libZ here -->
   <exec program="devenv.com" commandline='libZ.vcproj /build
${build.config}'/>
</target>



So 'nant projectC' results in getting all the source for libX, libY, and
libZ and invoking devenv.com on all the lib* projects and the projectA
project.  

With my suggestion, 'nant -only:projectC' would only do the body of the
projectC target and not execute the dependencies without cluttering the
build file with dependency-only targets, or with if statements and unless
attributes that short-circuit some of the tasks within a target.

</Bill>




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to