2006-03-29 Marek Sieradzki <marek.sieradzki@gmail.com>
authorMarek Sieradzki <msierad@mono-cvs.ximian.com>
Wed, 29 Mar 2006 07:50:16 +0000 (07:50 -0000)
committerMarek Sieradzki <msierad@mono-cvs.ximian.com>
Wed, 29 Mar 2006 07:50:16 +0000 (07:50 -0000)
        * InternalLoggerException.cs, InvalidProjectFileException.cs,
        Engine.cs, Project.cs: Coding style fixes.

svn path=/trunk/mcs/; revision=58690

mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InternalLoggerException.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/InvalidProjectFileException.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs

index ff4f500aa7e2939cdf8376cd2109e8434ad0d080..d3a0819c56d5604a512d11c73ffae80926bf9180 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-29  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * InternalLoggerException.cs, InvalidProjectFileException.cs,
+       Engine.cs, Project.cs: Coding style fixes.
+
 2006-03-29  Crestez Leonard  <cdleonard@gmail.com>
        
        * InternalLoggerException.cs, InvalidProjectFileException.cs: Fixed
index 715ca07258d3e6170402b3794824281b9510ad25..9d3f8bcade01960762fccefb205c37617f46bc28 100644 (file)
@@ -62,6 +62,7 @@ namespace Microsoft.Build.BuildEngine {
                public Engine (string binPath)
                {
                        this.binPath = binPath;
+                       this.buildEnabled = true;
                        this.projects = new Hashtable ();
                        this.eventSource = new EventSource ();
                        this.loggers = new ArrayList ();
@@ -172,10 +173,10 @@ namespace Microsoft.Build.BuildEngine {
                        return result;
                }
 
-               internal void CheckBinPath ()
+               private void CheckBinPath ()
                {
                        if (BinPath == null) {
-                               throw new InvalidOperationException("Before a project can be instantiated, " +
+                               throw new InvalidOperationException ("Before a project can be instantiated, " +
                                        "Engine.BinPath must be set to the location on disk where MSBuild " + 
                                        "is installed. This is used to evaluate $(MSBuildBinPath).");
                        }
@@ -189,45 +190,44 @@ namespace Microsoft.Build.BuildEngine {
 
                public Project GetLoadedProject (string projectFullFileName)
                {
-                       if (projectFullFileName == null) {
+                       if (projectFullFileName == null)
                                throw new ArgumentNullException ("projectFullFileName");
-                       }
+                       
                        return (Project) projects [projectFullFileName];
                }
 
                internal void RemoveLoadedProject (Project p)
                {
-                       if (p.FullFileName != "") {
+                       if (p.FullFileName != String.Empty)
                                projects.Remove (p.FullFileName);
-                       }
                }
 
                internal void AddLoadedProject (Project p)
                {
-                       if (p.FullFileName != "") {
+                       if (p.FullFileName != String.Empty)
                                projects.Add (p.FullFileName, p);
-                       }
                }
        
                public void UnloadProject (Project project)
                {
-                       if (project.ParentEngine != this) {
-                               throw new InvalidOperationException("This project is not loaded in this engine");
-                       }
+                       if (project.ParentEngine != this)
+                               throw new InvalidOperationException ("This project is not loaded in this engine");
+                       
                        project.CheckUnloaded ();
-                       if (project.FullFileName != "") {
+                       
+                       if (project.FullFileName != String.Empty)
                                projects.Remove (project.FullFileName);
-                       }
+                       
                        project.Unload ();
                }
 
                public void UnloadAllProjects ()
                {
-                       foreach (DictionaryEntry e in projects) {
+                       foreach (DictionaryEntry e in projects)
                                UnloadProject ((Project) e.Value);
-                       }
                }
 
+               [MonoTODO]
                public void RegisterLogger (ILogger logger)
                {
                        if (logger == null)
@@ -236,6 +236,7 @@ namespace Microsoft.Build.BuildEngine {
                        loggers.Add (logger);
                }
                
+               [MonoTODO]
                public void UnregisterAllLoggers ()
                {
                        // FIXME: check if build succeeded
@@ -298,9 +299,8 @@ namespace Microsoft.Build.BuildEngine {
 
                public static Engine GlobalEngine {
                        get {
-                               if (globalEngine == null) {
+                               if (globalEngine == null)
                                        globalEngine = new Engine ();
-                               }
                                return globalEngine;
                        }
                }
index d12cc389573875985b74333e09f5b06ffc405c91..8e8d982ec6c42dda41d25b3c6908d75921c374d6 100644 (file)
@@ -41,7 +41,7 @@ namespace Microsoft.Build.BuildEngine {
                
                public InternalLoggerException ()
                {
-                       throw new System.InvalidOperationException(
+                       throw new System.InvalidOperationException (
                                "An InternalLoggerException can only be thrown by the MSBuild engine. " +
                                "The public constructors of this class cannot be used to create an " +
                                "instance of the exception.");
@@ -57,12 +57,13 @@ namespace Microsoft.Build.BuildEngine {
                {
                }
 
-               protected InternalLoggerException (SerializationInfo info, StreamingContext context)
+               // FIXME: I made it private temporarily, later we can change it to internal (but not protected)
+               private InternalLoggerException (SerializationInfo info, StreamingContext context)
                        : base (info, context)
                {
-                       buildEventArgs = (BuildEventArgs) info.GetValue("BuildEventArgs", typeof(BuildEventArgs));
-                       errorCode = info.GetString("ErrorCode");
-                       helpKeyword = info.GetString("HelpKeywordPrefix");
+                       buildEventArgs = (BuildEventArgs) info.GetValue ("BuildEventArgs", typeof (BuildEventArgs));
+                       errorCode = info.GetString ("ErrorCode");
+                       helpKeyword = info.GetString ("HelpKeywordPrefix");
                }
 
                public override void GetObjectData (SerializationInfo info,
index ad9e6127fa7047d8d9251985fc72303f5e73e75b..a21d3f4118d593c65c14cd637a70963fc55177c7 100644 (file)
@@ -95,7 +95,8 @@ namespace Microsoft.Build.BuildEngine {
                        this.helpKeyword = helpKeyword;
                }
 
-               protected InvalidProjectFileException (SerializationInfo info, StreamingContext context)
+               // FIXME: private temporarily
+               private InvalidProjectFileException (SerializationInfo info, StreamingContext context)
                        : base (info, context)
                {
                        this.columnNumber = info.GetInt32 ("ColumnNumber");
@@ -172,7 +173,7 @@ namespace Microsoft.Build.BuildEngine {
 
                public override string Message {
                        get {
-                               if (projectFile == null || projectFile == "") {
+                               if (projectFile == null || projectFile == String.Empty) {
                                        return BaseMessage;
                                } else {
                                        return BaseMessage + "  " + ProjectFile;
index 295eccac7288c837e1de6e365dc5b858d8db4744..a08e53f3b47f94c842da80d93431a7b03959a0df 100644 (file)
@@ -246,8 +246,8 @@ namespace Microsoft.Build.BuildEngine {
                        XmlReader xmlReader = XmlReader.Create (textReader, settings);
                        xmlDocument.Load (xmlReader);
 
-                       if (xmlDocument.DocumentElement.GetAttribute("xmlns") != "http://schemas.microsoft.com/developer/msbuild/2003") {
-                               throw new InvalidProjectFileException(
+                       if (xmlDocument.DocumentElement.GetAttribute ("xmlns") != "http://schemas.microsoft.com/developer/msbuild/2003") {
+                               throw new InvalidProjectFileException (
                                        @"The default XML namespace of the project must be the MSBuild XML namespace." + 
                                        " If the project is authored in the MSBuild 2003 format, please add " +
                                        "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" to the <Project> element. " +