This adds the basedir attribute to the NAnt task. Please review and commit if you
find it useful.
Jim
<<NAntTask.txt>>
Index: NAntTask.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.Core/Tasks/NAntTask.cs,v
retrieving revision 1.2
diff -u -r1.2 NAntTask.cs
--- NAntTask.cs 6 Feb 2003 00:36:36 -0000 1.2
+++ NAntTask.cs 6 Feb 2003 15:19:56 -0000
@@ -36,6 +36,7 @@
[TaskName("nant")]
public class NAntTask : Task {
+ string _baseDirectory = null;
string _buildFileName = null;
string _target = null;
bool _inheritAll = true;
@@ -69,6 +70,14 @@
set { _inheritAll = value; }
}
+ /// <summary>The directory that the new instance of nant executes
+from.</summary>
+ /// <remarks><para>The basedir will be evaluated relative to the project's
+BaseDirectory if it is relative.</para></remarks>
+ [TaskAttribute("basedir")]
+ public string BaseDirectory {
+ get { return Project.GetFullPath(_baseDirectory); }
+ set { _baseDirectory = value; }
+ }
+
protected override void ExecuteTask() {
try {
Log.WriteLine(LogPrefix + "{0} {1}", BuildFileName, DefaultTarget);
@@ -88,6 +97,10 @@
excludes.Add(Project.NANT_PROPERTY_PROJECT_NAME);
excludes.Add(Project.NANT_PROPERTY_VERSION);
project.Properties.Inherit(Properties, excludes);
+ }
+
+ if (BaseDirectory != null) {
+
+project.Properties.SetValue(Properties[Project.NANT_PROPERTY_PROJECT_BASEDIR],
+BaseDirectory);
}
// handle multiple targets