Hi all,

attached to this email you will find the patch
I promised yesterday.

Now, it's up to you...

j3d.

-- 
----------------------------------------
Giuseppe Greco

::agamura::

phone:  +41 91 604 67 65
mobile: +41 76 390 60 32
email:  [EMAIL PROTECTED]
web:    www.agamura.com
----------------------------------------
? wildtarget.patch
? bin/ICSharpCode.SharpCvsLib.dll
? bin/NDoc.Core.dll
? bin/NDoc.Documenter.Msdn.dll
? bin/NUnitCore.dll
? bin/nunit.framework.dll
Index: bin/NAnt.Core.dll
===================================================================
RCS file: /cvsroot/nant/nant/bin/NAnt.Core.dll,v
retrieving revision 1.60
diff -c -r1.60 NAnt.Core.dll
Binary files /tmp/cvsdEVwVk and NAnt.Core.dll differ
Index: bin/NAnt.DotNetTasks.dll
===================================================================
RCS file: /cvsroot/nant/nant/bin/NAnt.DotNetTasks.dll,v
retrieving revision 1.31
diff -c -r1.31 NAnt.DotNetTasks.dll
Binary files /tmp/cvslesIDo and NAnt.DotNetTasks.dll differ
Index: bin/NAnt.exe
===================================================================
RCS file: /cvsroot/nant/nant/bin/NAnt.exe,v
retrieving revision 1.63
diff -c -r1.63 NAnt.exe
Binary files /tmp/cvshCExos and NAnt.exe differ
Index: bin/log4net.dll
===================================================================
RCS file: /cvsroot/nant/nant/bin/log4net.dll,v
retrieving revision 1.1
diff -c -r1.1 log4net.dll
Binary files /tmp/cvspEZMhw and log4net.dll differ
Index: src/NAnt.Core/Project.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.Core/Project.cs,v
retrieving revision 1.63
diff -c -r1.63 Project.cs
*** src/NAnt.Core/Project.cs	28 Feb 2004 08:24:40 -0000	1.63
--- src/NAnt.Core/Project.cs	4 Mar 2004 15:41:41 -0000
***************
*** 78,83 ****
--- 78,84 ----
          private const string ProjectDefaultAttribte = "default";
          private const string ProjectBaseDirAttribute = "basedir";
          private const string TargetXml = "target";
+         private const string WildTarget = "*";
  
          /// <summary>
          /// Constant for the "visiting" state, used when traversing a DFS of 
***************
*** 128,133 ****
--- 129,135 ----
          private string _defaultTargetName = null;
          private int _indentationSize = 4;
          private int _indentationLevel = 0;
+         private Target _currentTarget = null;
          private BuildListenerCollection _buildListeners = new BuildListenerCollection();
          private StringCollection _buildTargets = new StringCollection();
          private TargetCollection _targets = new TargetCollection();
***************
*** 405,410 ****
--- 407,419 ----
              }
          }
  
+         /// <remarks>
+         /// Gets the current target.
+         /// </remarks>
+         public Target CurrentTarget {
+             get { return _currentTarget; }
+         }
+ 
          /// <summary>
          /// Gets the path to the build file.
          /// </summary>
***************
*** 761,766 ****
--- 770,776 ----
              int currentIndex = 0;
              Target currentTarget;
  
+             /*
              do {
                  currentTarget = (Target) sortedTargets[currentIndex++];
                  //only execute targets that have not been executed already, if we are not forcing.
***************
*** 768,774 ****
--- 778,799 ----
                      currentTarget.Execute();
                  }
              } while (!currentTarget.Name.Equals(targetName));
+             */
+             do {
+                 currentTarget = (Target) sortedTargets[currentIndex++];
+                 if (currentTarget.Name.Equals(WildTarget) && _currentTarget != null) {
+                     currentTarget.Name = _currentTarget.Name;
+                 }
+ 
+                 _currentTarget = currentTarget;
+ 
+                 //only execute targets that have not been executed already, if we are not forcing.
+                 if(forceDependencies || !_currentTarget.Executed) {
+                     _currentTarget.Execute();
+                 }
+             } while (!_currentTarget.Name.Equals(targetName));
          }
+ 
          /// <summary>
          /// Executes the default target and wraps in error handling and time 
          /// stamping.
***************
*** 1384,1389 ****
--- 1409,1422 ----
              visiting.Push(root);
  
              Target target = (Target) targets.Find(root);
+ 
+             if (target == null) {
+                 target = (Target) targets.Find(WildTarget);
+                 if (target != null) {
+                     target.Name = root;
+                     _currentTarget = target;
+                 }
+             }
  
              // Make sure the target exists
              if (target == null) {
Index: src/NAnt.Core/Functions/NAntFunctions.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.Core/Functions/NAntFunctions.cs,v
retrieving revision 1.5
diff -c -r1.5 NAntFunctions.cs
*** src/NAnt.Core/Functions/NAntFunctions.cs	27 Feb 2004 17:42:38 -0000	1.5
--- src/NAnt.Core/Functions/NAntFunctions.cs	4 Mar 2004 15:41:44 -0000
***************
*** 80,85 ****
--- 80,102 ----
              return target.Executed;
          }
  
+         /// <summary>
+         /// Returns the name of the target being executed.
+         /// </summary>
+         /// <returns>
+         /// A <see cref="System.String" /> that contains the name of the target
+         /// being executed.
+         /// </returns>
+         [Function("get-current-target")]
+         public string GetCurrentTarget() {
+             Target target = Project.CurrentTarget;
+             if (target == null) {
+                 throw new InvalidOperationException("No target is being executed.");
+             }
+ 
+             return target.Name;
+         }
+ 
          #endregion Public Instance Methods
      }
  

Reply via email to