[xbuild] Copy metadata from Project items to target outputs.
authorAnkit Jain <radical@corewars.org>
Tue, 11 Jan 2011 18:08:23 +0000 (23:38 +0530)
committerAnkit Jain <radical@corewars.org>
Tue, 11 Jan 2011 18:12:47 +0000 (23:42 +0530)
Copy metadata from Project items to the corresponding target
outputs in MSBuild task.

Fix the corresponding test also.

mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs

index acec0e9121c864baaed66c6d81540d51000ec5b4..d46108b8464cef109968d2f2f1c07117ba40c444 100755 (executable)
@@ -862,9 +862,10 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
 
                        CreateAndCheckGlobalPropertiesTest (mainProject, firstProject, secondProject,
                                null, null,
-                               4, 3, 12,
+                               4, 3, 13,
                                new string [] {
-                                       "foofoo;barbar;foofoo;barbar: F.Unique: true",
+                                       "foofoo;barbar: F.Unique: true",
+                                       "foofoo;barbar: F.Unique: false",
                                        "from_second: F.Unique: unique",
                                        "foofoo;foofoo;from_second: F.Prop1: false",
                                        "barbar;barbar: F.Prop1: bar_false",
index 6409867cca34ff94da90944690a1643a4378c4a1..0359b966da70b64e239813f3d4ed4a5fbb590f83 100644 (file)
@@ -66,7 +66,6 @@ namespace Microsoft.Build.Tasks {
                        Hashtable outputs;
                
                        var global_properties = SplitPropertiesToDictionary ();
-                       Dictionary<string, ITaskItem> projectsByFileName = new Dictionary<string, ITaskItem> ();
 
                        Log.LogMessage (MessageImportance.Low, "Global Properties:");
                        if (global_properties != null)
@@ -104,11 +103,6 @@ namespace Microsoft.Build.Tasks {
                                }
 
                                if (result) {
-                                       // Metadata from the first item for the project file is copied
-                                       ITaskItem first_item;
-                                       if (!projectsByFileName.TryGetValue (filename, out first_item))
-                                               projectsByFileName [filename] = first_item = project;
-
                                        foreach (DictionaryEntry de in outputs) {
                                                ITaskItem [] array = (ITaskItem []) de.Value;
                                                foreach (ITaskItem item in array) {
@@ -117,7 +111,7 @@ namespace Microsoft.Build.Tasks {
 
                                                        // copy the metadata from original @project to here
                                                        // CopyMetadataTo does _not_ overwrite
-                                                       first_item.CopyMetadataTo (new_item);
+                                                       project.CopyMetadataTo (new_item);
 
                                                        outputItems.Add (new_item);