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