namespace Microsoft.Build.BuildEngine {
internal class BuildWhen {
- XmlAttribute condition;
Project parentProject;
GroupingCollection groupingCollection;
XmlElement whenElement;
- public BuildWhen (Project parentProject)
+ public BuildWhen (XmlElement whenElement, Project parentProject)
{
- this.parentProject = parentProject;
- this.groupingCollection = new GroupingCollection ();
- }
- public void BindToXml (XmlElement whenElement)
- {
+ this.parentProject = parentProject;
+ this.groupingCollection = new GroupingCollection (null);
if (whenElement == null)
throw new ArgumentNullException ("whenElement");
this.whenElement = whenElement;
- if (whenElement.GetAttribute ("Condition") != String.Empty)
- condition = whenElement.GetAttributeNode ("Condition");
foreach (XmlElement xe in whenElement.ChildNodes) {
if (xe.Name == "ItemGroup") {
- BuildItemGroup big = new BuildItemGroup ();
+ BuildItemGroup big = new BuildItemGroup (xe, parentProject, null, true);
//big.BindToXml (xe);
groupingCollection.Add (big);
// FIXME: add nested chooses
} else
throw new InvalidProjectFileException ("Invalid element in When.");
}
+
+ }
+
+ public void Evaluate()
+ {
+ groupingCollection.Evaluate ();
}
public string Condition {
- get { return condition.Value; }
- set { condition.Value = value; }
+ get { return whenElement.GetAttribute ("Condition"); }
+ set { whenElement.SetAttribute ("Condition", value); }
}
public GroupingCollection GroupingCollection {
}
}
-#endif
\ No newline at end of file
+#endif