2006-12-11 Marek Sieradzki <marek.sieradzki@gmail.com>
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / Project.cs
1 //
2 // Project.cs: Project class
3 //
4 // Author:
5 //   Marek Sieradzki (marek.sieradzki@gmail.com)
6 //
7 // (C) 2005 Marek Sieradzki
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 #if NET_2_0
29
30 using System;
31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Collections.Specialized;
34 using System.IO;
35 using System.Text;
36 using System.Xml;
37 using System.Xml.Schema;
38 using Microsoft.Build.Framework;
39 using Mono.XBuild.Framework;
40
41 namespace Microsoft.Build.BuildEngine {
42         public class Project {
43         
44                 bool                            buildEnabled;
45                 Dictionary <string, List <string>>      conditionedProperties;
46                 string[]                        defaultTargets;
47                 Encoding                        encoding;
48                 BuildItemGroup                  evaluatedItems;
49                 BuildItemGroup                  evaluatedItemsIgnoringCondition;
50                 Dictionary <string, BuildItemGroup>     evaluatedItemsByName;
51                 Dictionary <string, BuildItemGroup>     evaluatedItemsByNameIgnoringCondition;
52                 BuildPropertyGroup              evaluatedProperties;
53                 string                          firstTargetName;
54                 string                          fullFileName;
55                 BuildPropertyGroup              globalProperties;
56                 GroupingCollection              groupingCollection;
57                 bool                            isDirty;
58                 bool                            isValidated;
59                 BuildItemGroupCollection        itemGroups;
60                 ImportCollection                imports;
61                 string                          initialTargets;
62                 Engine                          parentEngine;
63                 BuildPropertyGroupCollection    propertyGroups;
64                 string                          schemaFile;
65                 TaskDatabase                    taskDatabase;
66                 TargetCollection                targets;
67                 DateTime                        timeOfLastDirty;
68                 UsingTaskCollection             usingTasks;
69                 XmlDocument                     xmlDocument;
70                 bool                            unloaded;
71
72                 static XmlNamespaceManager      manager;
73                 static string ns = "http://schemas.microsoft.com/developer/msbuild/2003";
74
75                 public Project ()
76                         : this (Engine.GlobalEngine)
77                 {
78                 }
79
80                 public Project (Engine engine)
81                 {
82                         parentEngine  = engine;
83                         xmlDocument = new XmlDocument ();
84                         groupingCollection = new GroupingCollection (this);
85                         imports = new ImportCollection (groupingCollection);
86                         usingTasks = new UsingTaskCollection (this);
87                         itemGroups = new BuildItemGroupCollection (groupingCollection);
88                         propertyGroups = new BuildPropertyGroupCollection (groupingCollection);
89                         targets = new TargetCollection (this);
90                         
91                         taskDatabase = new TaskDatabase ();
92                         if (engine.DefaultTasksRegistered) {
93                                 taskDatabase.CopyTasks (engine.DefaultTasks);
94                         }
95                         
96                         globalProperties = new BuildPropertyGroup ();
97                         fullFileName = String.Empty;
98
99                         foreach (BuildProperty bp in parentEngine.GlobalProperties) {
100                                 GlobalProperties.AddProperty (bp.Clone (true));
101                         }
102
103                         // You can evaluate an empty project.
104                         Evaluate ();
105                 }
106
107                 [MonoTODO]
108                 public void AddNewImport (string importLocation,
109                                           string importCondition)
110                 {
111                         throw new NotImplementedException ();
112                 }
113
114                 [MonoTODO]
115                 public BuildItem AddNewItem (string itemName,
116                                              string itemInclude)
117                 {
118                         return AddNewItem (itemName, itemInclude, false);
119                 }
120                 
121                 [MonoTODO]
122                 public BuildItem AddNewItem (string itemName,
123                                              string itemInclude,
124                                              bool treatItemIncludeAsLiteral)
125                 {
126                         throw new NotImplementedException ();
127                 }
128
129                 [MonoTODO]
130                 public BuildItemGroup AddNewItemGroup ()
131                 {
132                         throw new NotImplementedException ();
133                 }
134
135                 [MonoTODO]
136                 public BuildPropertyGroup AddNewPropertyGroup (bool insertAtEndOfProject)
137                 {
138                         throw new NotImplementedException ();
139                 }
140                 
141                 [MonoTODO]
142                 public void AddNewUsingTaskFromAssemblyFile (string taskName,
143                                                              string assemblyFile)
144                 {
145                         throw new NotImplementedException ();
146                 }
147                 
148                 [MonoTODO]
149                 public void AddNewUsingTaskFromAssemblyName (string taskName,
150                                                              string assemblyName)
151                 {
152                         throw new NotImplementedException ();
153                 }
154                 
155                 [MonoTODO]
156                 public bool Build ()
157                 {
158                         return true;
159                 }
160                 
161                 [MonoTODO]
162                 public bool Build (string targetName)
163                 {
164                         return Build (new string [1] { targetName });
165                 }
166                 
167                 [MonoTODO]
168                 public bool Build (string[] targetNames)
169                 {
170                         return Build (targetNames, null);
171                 }
172                 
173                 [MonoTODO]
174                 public bool Build (string[] targetNames,
175                                    IDictionary targetOutputs)
176                 {
177                         return Build (targetNames, targetOutputs, BuildSettings.None);
178                 }
179                 
180                 [MonoTODO]
181                 public bool Build (string[] targetNames,
182                                    IDictionary targetOutputs,
183                                    BuildSettings buildFlags)
184                 
185                 {
186                         CheckUnloaded ();
187                         
188                         if (targetNames.Length == 0) {
189                                 if (defaultTargets != null && defaultTargets.Length != 0)
190                                         targetNames = defaultTargets;
191                                 else if (firstTargetName != null)
192                                         targetNames = new string [1] { firstTargetName};
193                                 else
194                                         return false;
195                         }
196                         
197                         foreach (string target in targetNames) {
198                                 if (!targets.Exists (target))
199                                         // FIXME: test if it's logged
200                                         return false;
201                                 
202                                 if (!targets [target].Build ())
203                                         return false;
204                         }
205                                 
206                         return true;
207                 }
208
209                 [MonoTODO]
210                 public string[] GetConditionedPropertyValues (string propertyName)
211                 {
212                         if (conditionedProperties.ContainsKey (propertyName))
213                                 return conditionedProperties [propertyName].ToArray ();
214                         else
215                                 return new string [0];
216                 }
217
218                 public BuildItemGroup GetEvaluatedItemsByName (string itemName)
219                 {
220                         if (evaluatedItemsByName.ContainsKey (itemName))
221                                 return evaluatedItemsByName [itemName];
222                         else
223                                 return new BuildItemGroup ();
224                 }
225
226                 public BuildItemGroup GetEvaluatedItemsByNameIgnoringCondition (string itemName)
227                 {
228                         if (evaluatedItemsByNameIgnoringCondition.ContainsKey (itemName))
229                                 return evaluatedItemsByNameIgnoringCondition [itemName];
230                         else
231                                 return new BuildItemGroup ();
232                 }
233
234                 public string GetEvaluatedProperty (string propertyName)
235                 {
236                         if (propertyName == null)
237                                 throw new ArgumentNullException ("propertyName");
238
239                         BuildProperty bp = evaluatedProperties [propertyName];
240
241                         return bp == null ? null : (string) bp;
242                 }
243
244                 public string GetProjectExtensions (string id)
245                 {
246                         if (id == null || id == String.Empty)
247                                 return String.Empty;
248
249                         XmlNode node = xmlDocument.SelectSingleNode (String.Format ("/tns:Project/tns:ProjectExtensions/tns:{0}", id), XmlNamespaceManager);
250
251                         if (node == null)
252                                 return String.Empty;
253                         else
254                                 return node.InnerXml;
255                 }
256
257
258                 public void Load (string projectFileName)
259                 {
260                         this.fullFileName = Path.GetFullPath (projectFileName);
261                         try {
262                                 DoLoad (new StreamReader (projectFileName));
263                         } catch {
264                                 Console.WriteLine ("Failure to load: {0}", projectFileName);
265                         }
266                 }
267                 
268                 [MonoTODO]
269                 public void Load (TextReader textReader)
270                 {
271                         fullFileName = String.Empty;
272                         DoLoad (textReader);
273                 }
274
275                 public void LoadXml (string projectXml)
276                 {
277                         fullFileName = String.Empty;
278                         DoLoad (new StringReader (projectXml));
279                 }
280
281
282                 public void MarkProjectAsDirty ()
283                 {
284                         isDirty = true;
285                 }
286
287                 [MonoTODO]
288                 public void RemoveAllItemGroups ()
289                 {
290                         throw new NotImplementedException ();
291                 }
292
293                 [MonoTODO]
294                 public void RemoveAllPropertyGroups ()
295                 {
296                         throw new NotImplementedException ();
297                 }
298
299                 [MonoTODO]
300                 public void RemoveItem (BuildItem itemToRemove)
301                 {
302                         throw new NotImplementedException ();
303                 }
304
305                 [MonoTODO]
306                 public void RemoveItemGroup (BuildItemGroup itemGroupToRemove)
307                 {
308                         throw new NotImplementedException ();
309                 }
310                 
311                 [MonoTODO]
312                 // NOTE: does not modify imported projects
313                 public void RemoveItemGroupsWithMatchingCondition (string matchingCondition)
314                 {
315                         throw new NotImplementedException ();
316                 }
317
318                 [MonoTODO]
319                 public void RemoveItemsByName (string itemName)
320                 {
321                         throw new NotImplementedException ();
322                 }
323
324                 [MonoTODO]
325                 public void RemovePropertyGroup (BuildPropertyGroup propertyGroupToRemove)
326                 {
327                         throw new NotImplementedException ();
328                 }
329                 
330                 [MonoTODO]
331                 // NOTE: does not modify imported projects
332                 public void RemovePropertyGroupsWithMatchingCondition (string matchCondition)
333                 {
334                         throw new NotImplementedException ();
335                 }
336
337                 [MonoTODO]
338                 public void ResetBuildStatus ()
339                 {
340                         throw new NotImplementedException ();
341                 }
342
343                 public void Save (string projectFileName)
344                 {
345                         Save (projectFileName, Encoding.Default);
346                 }
347
348                 public void Save (string projectFileName, Encoding encoding)
349                 {
350                         xmlDocument.Save (projectFileName);
351                 }
352
353                 public void Save (TextWriter outTextWriter)
354                 {
355                         xmlDocument.Save (outTextWriter);
356                 }
357
358                 public void SetImportedProperty (string propertyName,
359                                                  string propertyValue,
360                                                  string condition,
361                                                  Project importProject)
362                 {
363                         SetImportedProperty (propertyName, propertyValue, condition, importProject,
364                                 PropertyPosition.UseExistingOrCreateAfterLastPropertyGroup);
365                 }
366
367                 public void SetImportedProperty (string propertyName,
368                                                  string propertyValue,
369                                                  string condition,
370                                                  Project importedProject,
371                                                  PropertyPosition position)
372                 {
373                         SetImportedProperty (propertyName, propertyValue, condition, importedProject,
374                                 PropertyPosition.UseExistingOrCreateAfterLastPropertyGroup, false);
375                 }
376
377                 [MonoTODO]
378                 public void SetImportedProperty (string propertyName,
379                                                  string propertyValue,
380                                                  string condition,
381                                                  Project importedProject,
382                                                  PropertyPosition position,
383                                                  bool treatPropertyValueAsLiteral)
384                 {
385                         throw new NotImplementedException ();
386                 }
387
388                 public void SetProjectExtensions (string id, string xmlText)
389                 {
390                         XmlNode projectExtensions, node;
391
392                         if (id == null || id == String.Empty || xmlText == null)
393                                 return;
394
395                         projectExtensions = xmlDocument.SelectSingleNode ("/tns:Project/tns:ProjectExtensions", XmlNamespaceManager);
396                         
397                         
398                         if (projectExtensions == null) {
399                                 projectExtensions = xmlDocument.CreateElement ("ProjectExtensions", XmlNamespace);
400                                 xmlDocument.DocumentElement.AppendChild (projectExtensions);
401
402                                 node = xmlDocument.CreateElement (id, XmlNamespace);
403                                 node.InnerXml = xmlText;
404                                 projectExtensions.AppendChild (node);
405                         } else {
406                                 node = xmlDocument.SelectSingleNode (String.Format ("/tns:Project/tns:ProjectExtensions/tns:{0}", id), XmlNamespaceManager);
407
408                                 if (node == null) {
409                                         node = xmlDocument.CreateElement (id, XmlNamespace);
410                                         projectExtensions.AppendChild (node);
411                                 }
412                                 
413                                 node.InnerXml = xmlText;
414                                 
415                         }
416                 }
417                 
418                 [MonoTODO]
419                 public void SetProperty (string propertyName,
420                                          string propertyValue)
421                 {
422                         SetProperty (propertyName, propertyValue, "true",
423                                 PropertyPosition.UseExistingOrCreateAfterLastPropertyGroup, false);
424                 }
425
426                 [MonoTODO]
427                 public void SetProperty (string propertyName,
428                                          string propertyValue,
429                                          string condition)
430                 {
431                         SetProperty (propertyName, propertyValue, condition,
432                                 PropertyPosition.UseExistingOrCreateAfterLastPropertyGroup);
433                 }
434
435                 [MonoTODO]
436                 public void SetProperty (string propertyName,
437                                          string propertyValue,
438                                          string condition,
439                                          PropertyPosition position)
440                 {
441                         SetProperty (propertyName, propertyValue, condition,
442                                 PropertyPosition.UseExistingOrCreateAfterLastPropertyGroup, false);
443                 }
444
445                 [MonoTODO]
446                 public void SetProperty (string propertyName,
447                                          string propertyValue,
448                                          string condition,
449                                          PropertyPosition position,
450                                          bool treatPropertyValueAsLiteral)
451                 {
452                         throw new NotImplementedException ();
453                 }
454
455                 internal void Unload ()
456                 {
457                         unloaded = true;
458                 }
459
460                 internal void CheckUnloaded ()
461                 {
462                         if (unloaded)
463                                 throw new InvalidOperationException ("This project object is no longer valid.");
464                 }
465                                 
466                 // Does the actual loading.
467                 private void DoLoad (TextReader textReader)
468                 {
469                         ParentEngine.RemoveLoadedProject (this);
470
471                         XmlReaderSettings settings = new XmlReaderSettings ();
472
473                         if (SchemaFile != null) {
474                                 settings.Schemas.Add (null, SchemaFile);
475                                 settings.ValidationType = ValidationType.Schema;
476                                 settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
477                         }
478
479                         XmlReader xmlReader = XmlReader.Create (textReader, settings);
480                         xmlDocument.Load (xmlReader);
481
482                         if (xmlDocument.DocumentElement.GetAttribute ("xmlns") != ns) {
483                                 throw new InvalidProjectFileException (
484                                         @"The default XML namespace of the project must be the MSBuild XML namespace." + 
485                                         " If the project is authored in the MSBuild 2003 format, please add " +
486                                         "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" to the <Project> element. " +
487                                         "If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.  ");
488                         }
489                         ProcessXml ();
490                         ParentEngine.AddLoadedProject (this);
491                 }
492
493                 private void ProcessXml ()
494                 {
495                         XmlElement xmlElement = xmlDocument.DocumentElement;
496                         if (xmlElement.Name != "Project")
497                                 throw new InvalidProjectFileException ("Invalid root element.");
498                         if (xmlElement.GetAttributeNode ("DefaultTargets") != null)
499                                 defaultTargets = xmlElement.GetAttribute ("DefaultTargets").Split (';');
500                         else
501                                 defaultTargets = new string [0];
502                         
503                         ProcessElements (xmlElement, null);
504                         
505                         isDirty = false;
506                         Evaluate ();
507                 }
508                 
509                 internal void ProcessElements (XmlElement rootElement, ImportedProject ip)
510                 {
511                         foreach (XmlNode xn in rootElement.ChildNodes) {
512                                 if (xn is XmlElement) {
513                                         XmlElement xe = (XmlElement) xn;
514                                         switch (xe.Name) {
515                                         case "ProjectExtensions":
516                                                 AddProjectExtensions (xe);
517                                                 break;
518                                         case "Warning":
519                                         case "Message":
520                                         case "Error":
521                                                 AddMessage (xe);
522                                                 break;
523                                         case "Target":
524                                                 AddTarget (xe, ip);
525                                                 break;
526                                         case "UsingTask":
527                                                 AddUsingTask (xe, ip);
528                                                 break;
529                                         case "Import":
530                                                 AddImport (xe, ip);
531                                                 break;
532                                         case "ItemGroup":
533                                                 AddItemGroup (xe);
534                                                 break;
535                                         case "PropertyGroup":
536                                                 AddPropertyGroup (xe);
537                                                 break;
538                                         case  "Choose":
539                                                 AddChoose (xe);
540                                                 break;
541                                         default:
542                                                 throw new InvalidProjectFileException ("Invalid element in project file.");
543                                         }
544                                 }
545                         }
546                 }
547                 
548                 internal void Evaluate ()
549                 {
550                         evaluatedItems = new BuildItemGroup (null, this);
551                         evaluatedItemsIgnoringCondition = new BuildItemGroup (null, this);
552                         evaluatedItemsByName = new Dictionary <string, BuildItemGroup> (StringComparer.InvariantCultureIgnoreCase);
553                         evaluatedItemsByNameIgnoringCondition = new Dictionary <string, BuildItemGroup> (StringComparer.InvariantCultureIgnoreCase);
554                         evaluatedProperties = new BuildPropertyGroup ();
555
556                         InitializeProperties ();
557
558                         groupingCollection.Evaluate ();
559
560                         //FIXME: UsingTasks aren't really evaluated. (shouldn't use expressions or anything)
561                         foreach (UsingTask usingTask in UsingTasks)
562                                 usingTask.Evaluate ();
563                 }
564
565                 private void InitializeProperties ()
566                 {
567                         BuildProperty bp;
568
569                         foreach (BuildProperty gp in GlobalProperties) {
570                                 bp = new BuildProperty (gp.Name, gp.Value, PropertyType.Global);
571                                 EvaluatedProperties.AddProperty (bp);
572                         }
573                         
574                         foreach (DictionaryEntry de in Environment.GetEnvironmentVariables ()) {
575                                 bp = new BuildProperty ((string) de.Key, (string) de.Value, PropertyType.Environment);
576                                 EvaluatedProperties.AddProperty (bp);
577                         }
578
579                         bp = new BuildProperty ("MSBuildBinPath", parentEngine.BinPath, PropertyType.Reserved);
580                         EvaluatedProperties.AddProperty (bp);
581                 }
582                 
583                 private void AddProjectExtensions (XmlElement xmlElement)
584                 {
585                         if (xmlElement == null)
586                                 throw new ArgumentNullException ("xmlElement");
587                 }
588                 
589                 private void AddMessage (XmlElement xmlElement)
590                 {
591                         if (xmlElement == null)
592                                 throw new ArgumentNullException ("xmlElement");
593                 }
594                 
595                 private void AddTarget (XmlElement xmlElement, ImportedProject importedProject)
596                 {
597                         if (xmlElement == null)
598                                 throw new ArgumentNullException ("xmlElement");
599                         Target target = new Target (xmlElement, this);
600                         targets.AddTarget (target);
601                         if (importedProject == null) {
602                                 target.IsImported = false;
603                                 if (firstTargetName == null)
604                                         firstTargetName = target.Name;
605                         } else
606                                 target.IsImported = true;
607                 }
608                 
609                 private void AddUsingTask (XmlElement xmlElement, ImportedProject importedProject)
610                 {
611                         UsingTask usingTask;
612
613                         usingTask = new UsingTask (xmlElement, this, importedProject);
614                         UsingTasks.Add (usingTask);
615                 }
616                 
617                 private void AddImport (XmlElement xmlElement, ImportedProject importingProject)
618                 {
619                         Import import;
620                         
621                         import = new Import (xmlElement, this, importingProject);
622                         Imports.Add (import);
623                 }
624                 
625                 private void AddItemGroup (XmlElement xmlElement)
626                 {
627                         if (xmlElement == null)
628                                 throw new ArgumentNullException ("xmlElement");
629                         BuildItemGroup big = new BuildItemGroup (xmlElement, this);
630                         ItemGroups.Add (big);
631                 }
632                 
633                 private void AddPropertyGroup (XmlElement xmlElement)
634                 {
635                         if (xmlElement == null)
636                                 throw new ArgumentNullException ("xmlElement");
637                         BuildPropertyGroup bpg = new BuildPropertyGroup (xmlElement, this);
638                         PropertyGroups.Add (bpg);
639                 }
640                 
641                 private void AddChoose (XmlElement xmlElement)
642                 {
643                         if (xmlElement == null)
644                                 throw new ArgumentNullException ("xmlElement");
645                                 
646                         BuildChoose bc = new BuildChoose (xmlElement, this);
647                         groupingCollection.Add (bc);
648                         
649                 }
650                 
651                 private static void ValidationCallBack (object sender, ValidationEventArgs e)
652                 {
653                         Console.WriteLine ("Validation Error: {0}", e.Message);
654                 }
655                 
656                 public bool BuildEnabled {
657                         get {
658                                 return buildEnabled;
659                         }
660                         set {
661                                 buildEnabled = value;
662                         }
663                 }
664
665                 public Encoding Encoding {
666                         get { return encoding; }
667                 }
668
669                 public string DefaultTargets {
670                         get {
671                                 return xmlDocument.DocumentElement.GetAttribute ("DefaultTargets");
672                         }
673                         set {
674                                 xmlDocument.DocumentElement.SetAttribute ("DefaultTargets", value);
675                                 defaultTargets = value.Split (';');
676                         }
677                 }
678
679                 public BuildItemGroup EvaluatedItems {
680                         get { return evaluatedItems; }
681                 }
682
683                 public BuildItemGroup EvaluatedItemsIgnoringCondition {
684                         get { return evaluatedItemsIgnoringCondition; }
685                 }
686                 
687                 internal IDictionary <string, BuildItemGroup> EvaluatedItemsByName {
688                         get { return evaluatedItemsByName; }
689                 }
690                 
691                 internal IDictionary <string, BuildItemGroup> EvaluatedItemsByNameIgnoringCondition {
692                         get { return evaluatedItemsByNameIgnoringCondition; }
693                 }
694
695                 public BuildPropertyGroup EvaluatedProperties {
696                         get { return evaluatedProperties; }
697                 }
698
699                 public string FullFileName {
700                         get { return fullFileName; }
701                         set { fullFileName = value; }
702                 }
703
704                 public BuildPropertyGroup GlobalProperties {
705                         get { return globalProperties; }
706                         set {
707                                 if (value == null) {
708                                         throw new ArgumentNullException ("value");
709                                 }
710                                 if (value.FromXml) {
711                                         throw new InvalidOperationException ("Can't do that.");
712                                 }
713                                 globalProperties = value;
714                         }
715                 }
716
717                 public bool IsDirty {
718                         get { return isDirty; }
719                 }
720
721                 public bool IsValidated {
722                         get { return isValidated; }
723                         set { isValidated = value; }
724                 }
725
726                 public BuildItemGroupCollection ItemGroups {
727                         get { return itemGroups; }
728                 }
729                 
730                 public ImportCollection Imports {
731                         get { return imports; }
732                 }
733                 
734                 public string InitialTargets {
735                         get { return initialTargets; }
736                         set { initialTargets = value; }
737                 }
738
739                 public Engine ParentEngine {
740                         get { return parentEngine; }
741                 }
742
743                 public BuildPropertyGroupCollection PropertyGroups {
744                         get { return propertyGroups; }
745                 }
746
747                 public string SchemaFile {
748                         get { return schemaFile; }
749                         set { schemaFile = value; }
750                 }
751
752                 public TargetCollection Targets {
753                         get { return targets; }
754                 }
755
756                 public DateTime TimeOfLastDirty {
757                         get { return timeOfLastDirty; }
758                 }
759                 
760                 public UsingTaskCollection UsingTasks {
761                         get { return usingTasks; }
762                 }
763
764                 [MonoTODO]
765                 public string Xml {
766                         get { return xmlDocument.InnerXml; }
767                 }
768                 
769                 internal static XmlNamespaceManager XmlNamespaceManager {
770                         get {
771                                 if (manager == null) {
772                                         manager = new XmlNamespaceManager (new NameTable ());
773                                         manager.AddNamespace ("tns", ns);
774                                 }
775                                 
776                                 return manager;
777                         }
778                 }
779                 
780                 internal TaskDatabase TaskDatabase {
781                         get { return taskDatabase; }
782                 }
783                 
784                 internal XmlDocument XmlDocument {
785                         get { return xmlDocument; }
786                 }
787                 
788                 internal static string XmlNamespace {
789                         get { return ns; }
790                 }
791         }
792 }
793
794 #endif