public class BuildPropertyGroup : IEnumerable {
XmlElement propertyGroup;
- XmlAttribute condition;
- string importedFromFilename;
bool isImported;
GroupingCollection parentCollection;
Project parentProject;
IDictionary propertiesByName;
public BuildPropertyGroup ()
- : this (true, null)
+ : this (null, null)
{
}
-
- internal BuildPropertyGroup (bool forXml, Project project)
+
+ internal BuildPropertyGroup (XmlElement xmlElement, Project project)
{
this.propertyGroup = null;
- this.condition = null;
- this.importedFromFilename = null;
this.isImported = false;
this.parentCollection = null;
this.parentProject = project;
- if (forXml == true)
+ if (xmlElement != null) {
this.properties = new ArrayList ();
- else
+ BindToXml(xmlElement);
+ } else
this.propertiesByName = CollectionsUtil.CreateCaseInsensitiveHashtable ();
}
((BuildProperty) propertiesByName [propertyName]).Value = propertyValue;
}
- internal void BindToXml (XmlElement propertyGroupElement)
+ private void BindToXml (XmlElement propertyGroupElement)
{
if (propertyGroupElement == null)
throw new ArgumentNullException ();
this.properties = new ArrayList ();
this.propertyGroup = propertyGroupElement;
- this.condition = propertyGroupElement.GetAttributeNode ("Condition");
- this.importedFromFilename = null;
this.isImported = false;
foreach (XmlElement xe in propertyGroupElement.ChildNodes) {
BuildProperty bp = AddNewProperty(xe.Name, xe.InnerText);
public string Condition {
get {
- if (condition == null)
- return null;
- else
- return condition.Value;
+ return propertyGroup.GetAttribute("Condition");
}
set {
- if (condition != null)
- condition.Value = value;
+ propertyGroup.SetAttribute("Condition", value);
}
}
}
}
- internal string ImportedFromFilename {
- get {
- return importedFromFilename;
- }
- }
-
public bool IsImported {
get {
return isImported;
}
}
-#endif
\ No newline at end of file
+#endif
bool isReset;
BuildItemGroupCollection itemGroups;
IDictionary importedProjects;
+ ImportCollection imports;
+ string initialTargets;
Engine parentEngine;
BuildPropertyGroupCollection propertyGroups;
BuildPropertyGroup reservedProperties;
TaskDatabase taskDatabase;
TargetCollection targets;
DateTime timeOfLastDirty;
+ UsingTaskCollection usingTasks;
IList usingTaskElements;
XmlDocument xmlDocument;
- XmlElement xmlElement;
+ //XmlElement xmlElement;
public Project ()
: this (null)
evaluatedItemsByName = CollectionsUtil.CreateCaseInsensitiveHashtable ();
evaluatedItemsByNameIgnoringCondition = CollectionsUtil.CreateCaseInsensitiveHashtable ();
evaluatedItemsIgnoringCondition = new BuildItemGroup (this);
- evaluatedProperties = new BuildPropertyGroup (false, null);
+ evaluatedProperties = new BuildPropertyGroup ();
groups = new GroupingCollection ();
itemGroups = new BuildItemGroupCollection (groups);
propertyGroups = new BuildPropertyGroupCollection (groups);
throw new NotImplementedException ();
}
+ [MonoTODO]
+ public void AddNewUsingTaskFromAssemblyFile (string taskName,
+ string assemblyFile)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddNewUsingTaskFromAssemblyName (string taskName,
+ string assemblyName)
+ {
+ throw new NotImplementedException ();
+ }
+
[MonoTODO]
public bool Build ()
{
throw new NotImplementedException ();
}
+ // Does the actual loading.
+ private void DoLoad (TextReader textReader)
+ {
+ XmlReaderSettings settings = new XmlReaderSettings ();
+
+ if (SchemaFile != null) {
+ settings.Schemas.Add (null, SchemaFile);
+ settings.ValidationType = ValidationType.Schema;
+ settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
+ }
+
+ XmlReader xmlReader = XmlReader.Create (textReader, settings);
+ xmlDocument.Load (xmlReader);
+ ProcessXml ();
+ }
+
public void Load (string projectFileName)
{
this.fullFileName = Path.GetFullPath (projectFileName);
- XmlSchemaCollection xmlSchemaCollection = null;
- XmlTextReader xmlTextReader = null;
- XmlValidatingReader xmlValidatingReader = null;
-
- if (this.schemaFile != null) {
- xmlSchemaCollection = new XmlSchemaCollection ();
- xmlSchemaCollection.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
- xmlSchemaCollection.Add (null, this.schemaFile);
- if (xmlSchemaCollection.Count > 0) {
- xmlTextReader = new XmlTextReader (projectFileName);
- xmlValidatingReader = new XmlValidatingReader (xmlTextReader);
- xmlValidatingReader.ValidationType = ValidationType.Schema;
- xmlValidatingReader.Schemas.Add (xmlSchemaCollection);
- xmlValidatingReader.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
- }
- } else {
- xmlTextReader = new XmlTextReader (projectFileName);
- }
- if (xmlValidatingReader != null)
- xmlDocument.Load (xmlValidatingReader);
- else if (xmlTextReader != null)
- xmlDocument.Load (xmlTextReader);
- else
- throw new Exception ();
- xmlElement = xmlDocument.DocumentElement;
- if (xmlElement.Name != "Project")
- throw new InvalidProjectFileException ("Invalid root element.");
- if (xmlElement.GetAttributeNode ("DefaultTargets") != null)
- defaultTargets = xmlElement.GetAttribute ("DefaultTargets").Split (';');
- else
- defaultTargets = new string [0];
-
- ProcessElements (xmlElement, null);
-
- isDirty = false;
+ DoLoad (new StreamReader (projectFileName));
}
[MonoTODO]
- public void Load (TextWriter textWriter)
+ public void Load (TextReader textReader)
{
throw new NotImplementedException ();
}
- public void LoadFromXml (XmlDocument projectXml)
+ [MonoTODO]
+ public void LoadXml (string projectXml)
+ {
+ fullFileName = String.Empty;
+ DoLoad (new StringReader (projectXml));
+ }
+
+ private void ProcessXml ()
{
- fullFileName = "";
- xmlDocument = projectXml;
- xmlElement = xmlDocument.DocumentElement;
+ XmlElement xmlElement = xmlDocument.DocumentElement;
if (xmlElement.Name != "Project")
throw new InvalidProjectFileException ("Invalid root element.");
if (xmlElement.GetAttributeNode ("DefaultTargets") != null)
throw new NotImplementedException ();
}
- [MonoTODO]
- public void RemoveAllPropertyGroupsByCondition (string condition)
- {
- throw new NotImplementedException ();
- }
-
[MonoTODO]
public void RemoveItem (BuildItem itemToRemove)
{
{
throw new NotImplementedException ();
}
+
+ [MonoTODO]
+ public void SetProperty (string propertyName,
+ string propertyValue)
+ {
+ SetProperty (propertyName, propertyValue, "true",
+ PropertyPosition.UseExistingOrCreateAfterLastPropertyGroup, false);
+ }
[MonoTODO]
public void SetProperty (string propertyName,
string importedFile;
Expression importedFileExpr;
- ImportedProject ImportedProject;
importedFileExpr = new Expression (this, xmlElement.GetAttribute ("Project"));
importedFile = (string) importedFileExpr.ToNonArray (typeof (string));
{
if (xmlElement == null)
throw new ArgumentNullException ("xmlElement");
- BuildPropertyGroup bpg = new BuildPropertyGroup (true, this);
- bpg.BindToXml (xmlElement);
+ BuildPropertyGroup bpg = new BuildPropertyGroup (xmlElement, this);
propertyGroups.Add (bpg);
}
}
public string DefaultTargets {
- get { return xmlElement.GetAttribute ("DefaultTargets"); }
+ get {
+ return xmlDocument.DocumentElement.GetAttribute ("DefaultTargets");
+ }
set {
- xmlElement.SetAttribute ("DefaultTargets",value);
+ xmlDocument.DocumentElement.SetAttribute ("DefaultTargets", value);
defaultTargets = value.Split (';');
}
}
public BuildItemGroupCollection ItemGroups {
get { return itemGroups; }
}
+
+ public ImportCollection Imports {
+ get { return imports; }
+ }
+
+ public string InitialTargets {
+ get { return initialTargets; }
+ set { initialTargets = value; }
+ }
public Engine ParentEngine {
get { return parentEngine; }
public DateTime TimeOfLastDirty {
get { return timeOfLastDirty; }
}
+
+ public UsingTaskCollection UsingTasks {
+ get { return usingTasks; }
+ }
[MonoTODO]
public string Xml {
}
}
-#endif
\ No newline at end of file
+#endif