public Engine (string binPath)
{
this.binPath = binPath;
+ this.buildEnabled = true;
this.projects = new Hashtable ();
this.eventSource = new EventSource ();
this.loggers = new ArrayList ();
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).");
}
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)
loggers.Add (logger);
}
+ [MonoTODO]
public void UnregisterAllLoggers ()
{
// FIXME: check if build succeeded
public static Engine GlobalEngine {
get {
- if (globalEngine == null) {
+ if (globalEngine == null)
globalEngine = new Engine ();
- }
return globalEngine;
}
}
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.");
{
}
- 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,
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");
public override string Message {
get {
- if (projectFile == null || projectFile == "") {
+ if (projectFile == null || projectFile == String.Empty) {
return BaseMessage;
} else {
return BaseMessage + " " + ProjectFile;
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. " +