Author: peterw
Date: 2006-07-06 03:33:58 -0400 (Thu, 06 Jul 2006)
New Revision: 62296

Added:
   branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/ActionLog.cs
Removed:
   branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/LoggingData.cs
Modified:
   branches/peterw/mbuild-compiled/Monkeywrench.dll.sources
   branches/peterw/mbuild-compiled/Monkeywrench/ChangeLog
   branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/ProjectManager.cs
   branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/WrenchProject.cs
   branches/peterw/mbuild-compiled/mbuild/ChangeLog
   branches/peterw/mbuild-compiled/mbuild/mbuild.cs
Log:
Monkeywrench:

2006-07-06  Peter Williams  <[EMAIL PROTECTED]>

        * Monkeywrench/ActionLog.cs: Renamed from LoggingData.

        * Monkeywrench/ProjectManager.cs: Track rename.

        * Monkeywrench/WrenchProject.cs: Same.

mbuild:

2006-07-06  Peter Williams  <[EMAIL PROTECTED]>

        * mbuild.cs: Track LoggingData -> ActionLog rename.



Modified: branches/peterw/mbuild-compiled/Monkeywrench/ChangeLog
===================================================================
--- branches/peterw/mbuild-compiled/Monkeywrench/ChangeLog      2006-07-06 
07:27:53 UTC (rev 62295)
+++ branches/peterw/mbuild-compiled/Monkeywrench/ChangeLog      2006-07-06 
07:33:58 UTC (rev 62296)
@@ -1,5 +1,13 @@
 2006-07-06  Peter Williams  <[EMAIL PROTECTED]>
 
+       * Monkeywrench/ActionLog.cs: Renamed from LoggingData.
+
+       * Monkeywrench/ProjectManager.cs: Track rename.
+
+       * Monkeywrench/WrenchProject.cs: Same.
+
+2006-07-06  Peter Williams  <[EMAIL PROTECTED]>
+
        * Monkeywrench/SourceSettings.cs: Move all the path manipulation code
        from WrenchProject here. Instead of serializing a SourceSettings object
        inside a log file in each build dir, write a small XML file in each

Copied: branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/ActionLog.cs 
(from rev 62294, 
branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/LoggingData.cs)
===================================================================
--- branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/LoggingData.cs    
2006-07-06 07:19:20 UTC (rev 62294)
+++ branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/ActionLog.cs      
2006-07-06 07:33:58 UTC (rev 62296)
@@ -0,0 +1,231 @@
+// ActionLog.cs -- data logged about build operations and user commands
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Runtime.Serialization;
+
+using Mono.Build;
+
+namespace Monkeywrench {
+
+    [Serializable]
+    public class ActionLog : IBuildLogger {
+       public static bool DebugEvents;
+
+       [Serializable]
+       public struct LogItem {
+           public string Category;
+           public string Message;
+           public string ExtraInfo;
+
+           public override string ToString ()
+           {
+               if (ExtraInfo == null)
+                   return String.Format ("[{0}]: {1}", Category, 
+                                         Message);
+
+               return String.Format ("[{0}]: {1} ({2})", Category, 
+                                     Message, ExtraInfo);
+           }
+       }
+
+       LogItem[] items;
+       int nextitem;
+
+       void AppendItem (string category, string message, object extra) 
+       {
+           items[nextitem].Category = category;
+           items[nextitem].Message = message;
+
+           if (extra != null)
+               items[nextitem].ExtraInfo = extra.ToString ();
+           else
+               items[nextitem].ExtraInfo = null;
+
+           if (DebugEvents)
+               Console.WriteLine ("{0}", items[nextitem]);
+
+           if (++nextitem >= items.Length)
+               nextitem = 0;
+       }
+
+       class ItemEnumerator : IEnumerable, IEnumerator {
+           ActionLog owner;
+           int idx;
+           int saved_nextitem;
+           bool first;
+
+           public ItemEnumerator (ActionLog owner)
+           {
+               this.owner = owner;
+
+               saved_nextitem = owner.nextitem;
+               Reset ();
+           }
+
+           public IEnumerator GetEnumerator ()
+           {
+               return this;
+           }
+
+           void Check ()
+           {
+               if (owner.nextitem != saved_nextitem)
+                   throw new InvalidOperationException ("Iterator sync error");
+           }
+
+           // items[saved_nextitem - 1] is the most recent item
+           // in the loop buffer.
+           // items[saved_nextitem] is the oldest item, so long
+           // as nothing is appended to log while we're iterating
+           // If the items[] array is not full, then the empty
+           // parts will be consecutive starting at 
+           // items[saved_nextitem] up until items[items.Length - 1]
+
+           public void Reset ()
+           {
+               Check ();
+               idx = saved_nextitem;
+
+               if (owner.items[idx].Category == null)
+                   // If there are any empty slots, they must
+                   // be continguous to the end of the array,
+                   // we have less than 40 items, and the 
+                   // chronologically first item is just ...
+                   idx = 0;
+
+               // Position ourselves before it.
+               idx--;
+
+               first = true;
+           }
+
+           public bool MoveNext ()
+           {
+               Check ();
+               idx++;
+
+               if (idx >= owner.items.Length)
+                   idx = 0;
+
+               if (!first)
+                   return idx != saved_nextitem;
+
+               first = false;
+               return owner.items[idx].Category != null;
+           }
+
+           public object Current {
+               get {
+                   Check ();
+                   return owner.items[idx];
+               }
+           }
+       }
+
+       public IEnumerable SavedItems {
+           get { return new ItemEnumerator (this); }
+       }
+
+       // IBuildLogger.
+
+       public void Log (string category, string value, object extra) 
+       {
+           AppendItem (category, value, extra);
+       }
+
+       public void Log (string category, string value) 
+       {
+           AppendItem (category, value, null);
+       }
+
+       // IWarningLogger
+      
+       [NonSerialized] IWarningLogger uilog;
+
+       public void PushLocation (string loc)
+       {
+           uilog.PushLocation (loc);
+       }
+
+       public void PopLocation ()
+       {
+           uilog.PopLocation ();
+       }
+
+       string WarnErrMessage (int category, string text, string detail)
+       {
+           string loc = uilog.Location;
+
+           if (loc != null && loc.Length > 0)
+               return String.Format ("{0}: {1}: {2}", loc, category, text);
+
+           return String.Format ("{0}: {1}", category, text);
+       }
+
+       public void Warning (int category, string text, string detail)
+       {
+           uilog.Warning (category, text, detail);
+
+           Log ("warning", WarnErrMessage (category, text, detail), detail);
+       }
+
+       public void Error (int category, string text, string detail)
+       {
+           uilog.Error (category, text, detail);
+
+           Log ("error", WarnErrMessage (category, text, detail), detail);
+       }
+
+       public string Location { get { return uilog.Location; } }
+
+       public int NumErrors { get { return uilog.NumErrors; } }
+
+       // Loading and saving.
+
+       ActionLog (int numitems) 
+       {
+           this.items = new LogItem[numitems];
+           this.nextitem = 0;
+
+           // UIlog is set in Load to merge two 
+           // potential code paths.
+       }
+
+       ActionLog () : this (40) {}
+
+       public const string LogName = "eventlog.dat";
+
+       static string GetPath (SourceSettings ss)
+       {
+           string srcrel = Path.Combine (WrenchProject.ProviderInfo.StateDir, 
LogName);
+           return ss.PathToBuildRelative (srcrel);
+       }
+
+       public static ActionLog Load (SourceSettings ss, IWarningLogger uilog)
+       {
+           ActionLog ld = null;
+
+           if (uilog == null)
+               throw new ArgumentNullException ();
+
+           string path = GetPath (ss);
+
+           if (File.Exists (path))
+               ld = (ActionLog) SafeFileSerializer.Load (path, uilog);
+
+           if (ld == null)
+               // Didn't exist or failed to recover
+               ld = new ActionLog ();
+
+           ld.uilog = uilog;
+           return ld;
+       }
+
+       public bool Save (SourceSettings ss)
+       {
+           return SafeFileSerializer.Save (GetPath (ss), this, uilog);
+       }
+    }
+}

Deleted: 
branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/LoggingData.cs
===================================================================
--- branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/LoggingData.cs    
2006-07-06 07:27:53 UTC (rev 62295)
+++ branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/LoggingData.cs    
2006-07-06 07:33:58 UTC (rev 62296)
@@ -1,231 +0,0 @@
-// LoggingData.cs -- data logged about build operations and user commands
-
-using System;
-using System.IO;
-using System.Collections;
-using System.Runtime.Serialization;
-
-using Mono.Build;
-
-namespace Monkeywrench {
-
-    [Serializable]
-    public class LoggingData : IBuildLogger {
-       public static bool DebugEvents;
-
-       [Serializable]
-       public struct LogItem {
-           public string Category;
-           public string Message;
-           public string ExtraInfo;
-
-           public override string ToString ()
-           {
-               if (ExtraInfo == null)
-                   return String.Format ("[{0}]: {1}", Category, 
-                                         Message);
-
-               return String.Format ("[{0}]: {1} ({2})", Category, 
-                                     Message, ExtraInfo);
-           }
-       }
-
-       LogItem[] items;
-       int nextitem;
-
-       void AppendItem (string category, string message, object extra) 
-       {
-           items[nextitem].Category = category;
-           items[nextitem].Message = message;
-
-           if (extra != null)
-               items[nextitem].ExtraInfo = extra.ToString ();
-           else
-               items[nextitem].ExtraInfo = null;
-
-           if (DebugEvents)
-               Console.WriteLine ("{0}", items[nextitem]);
-
-           if (++nextitem >= items.Length)
-               nextitem = 0;
-       }
-
-       class ItemEnumerator : IEnumerable, IEnumerator {
-           LoggingData owner;
-           int idx;
-           int saved_nextitem;
-           bool first;
-
-           public ItemEnumerator (LoggingData owner)
-           {
-               this.owner = owner;
-
-               saved_nextitem = owner.nextitem;
-               Reset ();
-           }
-
-           public IEnumerator GetEnumerator ()
-           {
-               return this;
-           }
-
-           void Check ()
-           {
-               if (owner.nextitem != saved_nextitem)
-                   throw new InvalidOperationException ("Iterator sync error");
-           }
-
-           // items[saved_nextitem - 1] is the most recent item
-           // in the loop buffer.
-           // items[saved_nextitem] is the oldest item, so long
-           // as nothing is appended to log while we're iterating
-           // If the items[] array is not full, then the empty
-           // parts will be consecutive starting at 
-           // items[saved_nextitem] up until items[items.Length - 1]
-
-           public void Reset ()
-           {
-               Check ();
-               idx = saved_nextitem;
-
-               if (owner.items[idx].Category == null)
-                   // If there are any empty slots, they must
-                   // be continguous to the end of the array,
-                   // we have less than 40 items, and the 
-                   // chronologically first item is just ...
-                   idx = 0;
-
-               // Position ourselves before it.
-               idx--;
-
-               first = true;
-           }
-
-           public bool MoveNext ()
-           {
-               Check ();
-               idx++;
-
-               if (idx >= owner.items.Length)
-                   idx = 0;
-
-               if (!first)
-                   return idx != saved_nextitem;
-
-               first = false;
-               return owner.items[idx].Category != null;
-           }
-
-           public object Current {
-               get {
-                   Check ();
-                   return owner.items[idx];
-               }
-           }
-       }
-
-       public IEnumerable SavedItems {
-           get { return new ItemEnumerator (this); }
-       }
-
-       // IBuildLogger.
-
-       public void Log (string category, string value, object extra) 
-       {
-           AppendItem (category, value, extra);
-       }
-
-       public void Log (string category, string value) 
-       {
-           AppendItem (category, value, null);
-       }
-
-       // IWarningLogger
-      
-       [NonSerialized] IWarningLogger uilog;
-
-       public void PushLocation (string loc)
-       {
-           uilog.PushLocation (loc);
-       }
-
-       public void PopLocation ()
-       {
-           uilog.PopLocation ();
-       }
-
-       string WarnErrMessage (int category, string text, string detail)
-       {
-           string loc = uilog.Location;
-
-           if (loc != null && loc.Length > 0)
-               return String.Format ("{0}: {1}: {2}", loc, category, text);
-
-           return String.Format ("{0}: {1}", category, text);
-       }
-
-       public void Warning (int category, string text, string detail)
-       {
-           uilog.Warning (category, text, detail);
-
-           Log ("warning", WarnErrMessage (category, text, detail), detail);
-       }
-
-       public void Error (int category, string text, string detail)
-       {
-           uilog.Error (category, text, detail);
-
-           Log ("error", WarnErrMessage (category, text, detail), detail);
-       }
-
-       public string Location { get { return uilog.Location; } }
-
-       public int NumErrors { get { return uilog.NumErrors; } }
-
-       // Loading and saving.
-
-       LoggingData (int numitems) 
-       {
-           this.items = new LogItem[numitems];
-           this.nextitem = 0;
-
-           // UIlog is set in Load to merge two 
-           // potential code paths.
-       }
-
-       LoggingData () : this (40) {}
-
-       public const string LogName = "eventlog.dat";
-
-       static string GetPath (SourceSettings ss)
-       {
-           string srcrel = Path.Combine (WrenchProject.ProviderInfo.StateDir, 
LogName);
-           return ss.PathToBuildRelative (srcrel);
-       }
-
-       public static LoggingData Load (SourceSettings ss, IWarningLogger uilog)
-       {
-           LoggingData ld = null;
-
-           if (uilog == null)
-               throw new ArgumentNullException ();
-
-           string path = GetPath (ss);
-
-           if (File.Exists (path))
-               ld = (LoggingData) SafeFileSerializer.Load (path, uilog);
-
-           if (ld == null)
-               // Didn't exist or failed to recover
-               ld = new LoggingData ();
-
-           ld.uilog = uilog;
-           return ld;
-       }
-
-       public bool Save (SourceSettings ss)
-       {
-           return SafeFileSerializer.Save (GetPath (ss), this, uilog);
-       }
-    }
-}

Modified: 
branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/ProjectManager.cs
===================================================================
--- branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/ProjectManager.cs 
2006-07-06 07:27:53 UTC (rev 62295)
+++ branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/ProjectManager.cs 
2006-07-06 07:33:58 UTC (rev 62296)
@@ -18,7 +18,7 @@
 
        BundleManager bm; // FIXME: need to sync this up with GraphBuilder.bm 
somehow
        SourceSettings ss;
-       LoggingData log;
+       ActionLog log;
        IGraphState graph;
        WrenchProject proj;
 
@@ -33,7 +33,7 @@
 
        public BundleManager Bundles { get { return bm; } }
        
-       public LoggingData Logger { get { return log; } }
+       public ActionLog Logger { get { return log; } }
 
        // Loading
 
@@ -55,7 +55,7 @@
 
        public bool LoadRest (IWarningLogger uilog) 
        {
-           if ((log = LoggingData.Load (ss, uilog)) == null)
+           if ((log = ActionLog.Load (ss, uilog)) == null)
                return true;
 
            if ((graph = GetGraph ()) == null)

Modified: 
branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/WrenchProject.cs
===================================================================
--- branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/WrenchProject.cs  
2006-07-06 07:27:53 UTC (rev 62295)
+++ branches/peterw/mbuild-compiled/Monkeywrench/Monkeywrench/WrenchProject.cs  
2006-07-06 07:33:58 UTC (rev 62296)
@@ -16,12 +16,12 @@
     
     public class WrenchProject : IDisposable {
        SourceSettings ss;
-       LoggingData log;
+       ActionLog log;
        IGraphState graph;
        IBuildManager manager;
        
        public WrenchProject (SourceSettings ss, IGraphState graph, 
-                             LoggingData log) 
+                             ActionLog log) 
        {
            this.ss = ss;
            this.log = log;
@@ -31,7 +31,7 @@
 
        public SourceSettings SourceSettings { get { return ss ; } }
 
-       public LoggingData Log { get { return log; } }
+       public ActionLog Log { get { return log; } }
 
        public IGraphState Graph { get { return graph; } }
 

Modified: branches/peterw/mbuild-compiled/Monkeywrench.dll.sources
===================================================================
--- branches/peterw/mbuild-compiled/Monkeywrench.dll.sources    2006-07-06 
07:27:53 UTC (rev 62295)
+++ branches/peterw/mbuild-compiled/Monkeywrench.dll.sources    2006-07-06 
07:33:58 UTC (rev 62296)
@@ -1,7 +1,7 @@
+Monkeywrench/Monkeywrench/ActionLog.cs
 Monkeywrench/Monkeywrench/BuildServices.cs
 Monkeywrench/Monkeywrench/FileStateTable.cs
 Monkeywrench/Monkeywrench/IProviderPersistence.cs
-Monkeywrench/Monkeywrench/LoggingData.cs
 Monkeywrench/Monkeywrench/MakeDictionaryRule.cs
 Monkeywrench/Monkeywrench/OperationFunc.cs
 Monkeywrench/Monkeywrench/OperationScope.cs

Modified: branches/peterw/mbuild-compiled/mbuild/ChangeLog
===================================================================
--- branches/peterw/mbuild-compiled/mbuild/ChangeLog    2006-07-06 07:27:53 UTC 
(rev 62295)
+++ branches/peterw/mbuild-compiled/mbuild/ChangeLog    2006-07-06 07:33:58 UTC 
(rev 62296)
@@ -1,5 +1,9 @@
 2006-07-06  Peter Williams  <[EMAIL PROTECTED]>
 
+       * mbuild.cs: Track LoggingData -> ActionLog rename.
+
+2006-07-06  Peter Williams  <[EMAIL PROTECTED]>
+
        * mbuild.cs (SetMajorMode): Quick function to try and signal an 
        error if conflicting 'major modes' (eg, install and distribute) are
        specified.

Modified: branches/peterw/mbuild-compiled/mbuild/mbuild.cs
===================================================================
--- branches/peterw/mbuild-compiled/mbuild/mbuild.cs    2006-07-06 07:27:53 UTC 
(rev 62295)
+++ branches/peterw/mbuild-compiled/mbuild/mbuild.cs    2006-07-06 07:33:58 UTC 
(rev 62296)
@@ -623,7 +623,7 @@
 
        public int ShowLog (ProjectManager pm) 
        {
-           foreach (LoggingData.LogItem li in pm.Logger.SavedItems)
+           foreach (ActionLog.LogItem li in pm.Logger.SavedItems)
                Console.WriteLine ("{0}", li);
            return 0;
        }
@@ -791,7 +791,7 @@
 #endif
 
                BuildfileParser.DebugParser = debug_parser;
-               LoggingData.DebugEvents = debug_logs;
+               ActionLog.DebugEvents = debug_logs;
                Monkeywrench.Compiler.XmlGraphSerializer.DebugOutput = true; // 
FIXME
                ProjectManager pm = null;
                string here = "/";

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to