Bernard: I'm forwarding this to the group to see if we can find a
resolution.
Others: Please at least skim this and do a sanity check for the ideas.

Summary:
Nant is ambiguous of how it treat's base directories in projects.
Currently there is a -basedir command line switch, a basedir attribute
in the project and a basedir attribute in the <nant> task.  If all were
set to different values would it be clear what should happen.  I believe
no.

Proposal:
Remove the -basedir command line option and basedir attribute from
<nant> task.  Standardize and document exactly how base directories
should be concatenated within tasks.

Discussion:

Ahhh... Now I see the problem, it's the basedir="....."

There is somebody posting on the message board that is having problems
with this as well.

I'm quite busy today but if I have time tonight or Wed I'll try to fix
this up and add some tests to prevent it.

The problem is with the ambiguity of how nant defines relative paths.
Here is what I'm going to lay down in stone and then comb through the
project looking for area's where it breaks.  I'll then update the
documentation to make this clear.

Project basedir:
* By default the project's base directory is the same as the build file
(not the current directory).  This is the same as doing <project
basedir=".">

* If the basedir value is a relative path than it is relative to the
build file, i.e., <project basedir="src"> would change the base
directory to the "src" subdirectory (the buildfile would be in same
folder as src).

Tasks and File Set's basedir:
* If the basedir value for a element (task/fileset/etc...) then it is
combined with the Project's BaseDirectory property.  The proper way of
initializing a directory for a task is to use the Project.GetFullPath()
method.  This will do the right thing.  Examples:

// Task with just a filename attribute
string resolved = Project.GetFullPath(_fileName);

// Task with just a basedir attribute
string resolved = Project.GetFullPath(_baseDir);

// Task with basedir and filename attributes
string resolved = Project.GetFullPath(Path.Combine(_baseDir,
_fileName));


Nested build files (via <nant> task)
* By default you should just specify the build file you wish.  Early
versions of nant had you just specify the folder but that left a problem
when there was more than one .build file in the folder.

* The basedir attribute on the <nant> task will be removed as it just
causes ambiguity.  Similar the -basedir option on nant will also be
removed.  Allowing these options makes it impossible to know for sure
how the buildfile will be run and thus how can you write a buildfile
that will work?  It would be wrong for a calling If a project wishes to
change a nested build file's base dir it should set a property and then
have the nested build file expand the property.

This will (I hope) make it very clear on how to use the <nant> task and
also make it easy to write nested builds that work as expected.
Currently the nested builds for the examples has seen no end of trouble
(and are once again broken).
 


> -----Original Message-----
> From: Bernard Vander Beken [mailto:[EMAIL PROTECTED]] 
> Sent: Tue, April 16, 2002 3:55 AM
> To: Gerry Shaw
> Subject: RE: NAnt bug : BaseDirectory problems in NantTask.cs 
> AND/OR Project.cs
> 
> 
> 
> Thanks, but this does not solve the problem.
> 
> The previous build file *should work* with the removed target.
> 
> -----Original Message-----
> From: Gerry Shaw [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, April 16, 2002 2:31 AM
> To: Bernard Vander Beken
> Subject: RE: NAnt bug : BaseDirectory problems in NantTask.cs 
> AND/OR Project.cs
> 
> 
> You kick ass.  With that bug report it was so easy to find 
> and fix the problem.
> 
> I took the offending target out of the build file but here is 
> what the output would look like if it was in:
> 
> C:\work\nant>build\nant extras
> Buildfile: C:\work\nant\NAnt.build
>    [tstamp] Mon, April 15, 2002 5:26:44 PM
> 
> clean:
>    [delete] Deleting directory C:\work\nant\build
> 
> extras:
>      [nant] Sourcesafe.build
>             Buildfile: C:\work\nant\Sourcesafe.build
> 
>             BUILD FAILED
>             C:\work\nant\Sourcesafe.build: Error loading buildfile
>             Could not find file "C:\work\nant\Sourcesafe.build".
> 
> BUILD FAILED
> Nested build failed.  Refer to build log for exact reason.
> Try 'nant -help' for more information
> 


_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to