Author: msierad
Date: 2007-01-12 17:28:52 -0500 (Fri, 12 Jan 2007)
New Revision: 70940
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
Log:
2007-01-12 Marek Sieradzki <[EMAIL PROTECTED]>
* BuildPropertyGroup.cs: Don't trigger reevaluation just after a
change but just mark that it needs it.
* Project.cs: Reevaluate when it needs reevaluation and one of
Evaluated* properties is used.
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
2007-01-12 22:26:14 UTC (rev 70939)
+++
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
2007-01-12 22:28:52 UTC (rev 70940)
@@ -97,7 +97,8 @@
prop = new BuildProperty (parentProject, xe);
AddProperty (prop);
- parentProject.EvaluatedProperties.AddProperty
(prop);
+ parentProject.NeedToReevaluate ();
+
return prop;
} else
throw new InvalidOperationException ("This
method is only valid for persisted <System.Object[]> elements.");
@@ -187,7 +188,7 @@
{
if (read_only)
return;
-
+
if (propertiesByName.ContainsKey (propertyName))
propertiesByName.Remove (propertyName);
@@ -196,11 +197,14 @@
bp = new BuildProperty (propertyName,
Utilities.Escape (propertyValue));
else
bp = new BuildProperty (propertyName,
propertyValue);
+
+ if (Char.IsDigit (propertyName [0]))
+ throw new ArgumentException (String.Format
("The name \"{0}\" contains an invalid character \"{1}\".", propertyName,
propertyName [0]));
AddProperty (bp);
if (IsGlobal)
- parentProject.ProcessXml ();
+ parentProject.NeedToReevaluate ();
}
internal void Evaluate ()
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
2007-01-12 22:26:14 UTC (rev 70939)
+++
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
2007-01-12 22:28:52 UTC (rev 70940)
@@ -1,5 +1,13 @@
2007-01-12 Marek Sieradzki <[EMAIL PROTECTED]>
+ * BuildPropertyGroup.cs: Don't trigger reevaluation just after a
+ change but just mark that it needs it.
+
+ * Project.cs: Reevaluate when it needs reevaluation and one of
+ Evaluated* properties is used.
+
+2007-01-12 Marek Sieradzki <[EMAIL PROTECTED]>
+
* Target.cs: Throw an exception when <OnError> is not last element in
target.
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
2007-01-12 22:26:14 UTC (rev 70939)
+++
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
2007-01-12 22:28:52 UTC (rev 70940)
@@ -59,6 +59,7 @@
BuildItemGroupCollection itemGroups;
ImportCollection imports;
string initialTargets;
+ bool needToReevaluate;
Engine parentEngine;
BuildPropertyGroupCollection propertyGroups;
string schemaFile;
@@ -111,6 +112,7 @@
Import import = new Import (importElement, this, null);
imports.Add (import);
MarkProjectAsDirty ();
+ NeedToReevaluate ();
}
public BuildItem AddNewItem (string itemName,
@@ -136,6 +138,7 @@
BuildItemGroup big = new BuildItemGroup (element, this,
null, false);
itemGroups.Add (big);
MarkProjectAsDirty ();
+ NeedToReevaluate ();
return big;
}
@@ -149,6 +152,7 @@
BuildPropertyGroup bpg = new BuildPropertyGroup
(element, this, null, false);
propertyGroups.Add (bpg);
MarkProjectAsDirty ();
+ NeedToReevaluate ();
return bpg;
}
@@ -224,6 +228,7 @@
{
CheckUnloaded ();
ParentEngine.StartBuild ();
+ NeedToReevaluate ();
if (targetNames.Length == 0) {
if (defaultTargets != null &&
defaultTargets.Length != 0)
@@ -393,16 +398,19 @@
public void Save (string projectFileName)
{
Save (projectFileName, Encoding.Default);
+ isDirty = false;
}
public void Save (string projectFileName, Encoding encoding)
{
xmlDocument.Save (projectFileName);
+ isDirty = false;
}
public void Save (TextWriter outTextWriter)
{
xmlDocument.Save (outTextWriter);
+ isDirty = false;
}
public void SetImportedProperty (string propertyName,
@@ -511,6 +519,11 @@
if (unloaded)
throw new InvalidOperationException ("This
project object has been unloaded from the MSBuild engine and is no longer
valid.");
}
+
+ internal void NeedToReevaluate ()
+ {
+ needToReevaluate = true;
+ }
// Does the actual loading.
void DoLoad (TextReader textReader)
@@ -548,8 +561,13 @@
}
}
- internal void ProcessXml ()
+ void Reevaluate ()
{
+ ProcessXml ();
+ }
+
+ void ProcessXml ()
+ {
groupingCollection = new GroupingCollection (this);
imports = new ImportCollection (groupingCollection);
usingTasks = new UsingTaskCollection (this);
@@ -611,7 +629,7 @@
}
}
- internal void Evaluate ()
+ void Evaluate ()
{
evaluatedItems = new BuildItemGroup (null, this, null,
true);
evaluatedItemsIgnoringCondition = new BuildItemGroup
(null, this, null, true);
@@ -734,23 +752,55 @@
}
public BuildItemGroup EvaluatedItems {
- get { return evaluatedItems; }
+ get {
+ if (needToReevaluate) {
+ needToReevaluate = false;
+ Reevaluate ();
+ }
+ return evaluatedItems;
+ }
}
public BuildItemGroup EvaluatedItemsIgnoringCondition {
- get { return evaluatedItemsIgnoringCondition; }
+ get {
+ if (needToReevaluate) {
+ needToReevaluate = false;
+ Reevaluate ();
+ }
+ return evaluatedItemsIgnoringCondition;
+ }
}
internal IDictionary <string, BuildItemGroup>
EvaluatedItemsByName {
- get { return evaluatedItemsByName; }
+ get {
+ // FIXME: do we need to do this here?
+ if (needToReevaluate) {
+ needToReevaluate = false;
+ Reevaluate ();
+ }
+ return evaluatedItemsByName;
+ }
}
internal IDictionary <string, BuildItemGroup>
EvaluatedItemsByNameIgnoringCondition {
- get { return evaluatedItemsByNameIgnoringCondition; }
+ get {
+ // FIXME: do we need to do this here?
+ if (needToReevaluate) {
+ needToReevaluate = false;
+ Reevaluate ();
+ }
+ return evaluatedItemsByNameIgnoringCondition;
+ }
}
public BuildPropertyGroup EvaluatedProperties {
- get { return evaluatedProperties; }
+ get {
+ if (needToReevaluate) {
+ needToReevaluate = false;
+ Reevaluate ();
+ }
+ return evaluatedProperties;
+ }
}
public string FullFileName {
@@ -768,6 +818,7 @@
throw new InvalidOperationException
("Can't do that.");
globalProperties = value;
+ NeedToReevaluate ();
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches