2007-01-26 Marek Sieradzki <marek.sieradzki@gmail.com>
authorMarek Sieradzki <msierad@mono-cvs.ximian.com>
Fri, 26 Jan 2007 10:44:13 +0000 (10:44 -0000)
committerMarek Sieradzki <msierad@mono-cvs.ximian.com>
Fri, 26 Jan 2007 10:44:13 +0000 (10:44 -0000)
        * BuildPropertyGroup.cs (SetProperty): Made it work with persisted
        properties.

svn path=/trunk/mcs/; revision=71739

mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog

index 1b2cf7e882a7765015c205eb9e79f2e85662d2b8..9e4c00e67dca293551d8b450a25115a77ecddf1f 100644 (file)
@@ -183,22 +183,32 @@ namespace Microsoft.Build.BuildEngine {
                        if (read_only)
                                return;
 
-                       if (propertiesByName.ContainsKey (propertyName))
-                               propertiesByName.Remove (propertyName);
-
-                       BuildProperty bp;
                        if (treatPropertyValueAsLiteral)
-                               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]));
+                               propertyValue = Utilities.Escape (propertyValue);
+
+                       if (FromXml) {
+                               int idx = properties.FindIndex (delegate (BuildProperty p) {
+                                       return p.Name == propertyName;
+                               });
 
-                       AddProperty (bp);
+                               if (idx == -1)
+                                       AddNewProperty (propertyName, propertyValue, false);
+                               else
+                                       properties [idx].Value = propertyValue;
+                       } else {
+                               if (propertiesByName.ContainsKey (propertyName))
+                                       propertiesByName.Remove (propertyName);
+
+                               BuildProperty 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]));
 
-                       if (IsGlobal)
-                               parentProject.NeedToReevaluate ();
+                               AddProperty (bp);
+
+                               if (IsGlobal)
+                                       parentProject.NeedToReevaluate ();
+                       }
                }
                
                internal void Evaluate ()
index 33de51e84e213d9aa91deb339dc3be97f2b54d0b..ed7b22acdb653c2408c63f353e2f6e2233cdb41d 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-26  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildPropertyGroup.cs (SetProperty): Made it work with persisted
+       properties.
+
 2007-01-23  Marek Sieradzki  <marek.sieradzki@gmail.com>
 
        * BuildTask.cs, ConditionFactorExpression.cs, Target.cs,