Support for PropertyGroup as a child of When and Otherwise
authorRodrigo B. de Oliveira <rbo@acm.org>
Tue, 12 Jan 2010 18:47:48 +0000 (18:47 -0000)
committerRodrigo B. de Oliveira <rbo@acm.org>
Tue, 12 Jan 2010 18:47:48 +0000 (18:47 -0000)
svn path=/trunk/mcs/; revision=149426

mcs/class/Microsoft.Build.Engine/ChangeLog
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildWhen.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildChooseTest.cs

index 8b1448e71f6731dbce4ff52842f90882eefb4a66..c62af4fe872bdaf3fc8da016a4c881f277712ebb 100644 (file)
@@ -1,3 +1,9 @@
+2010-01-12     Rodrigo B. de Oliveira <rodrigo@unity3d.com>
+
+       * Microsoft.Build.BuildEngine/BuildWhen.cs
+       * Test/Microsoft.Build.BuildEngine/BuildChooseTest.cs:
+               Support for PropertyGroup as a child of When and Otherwise
+
 2009-08-20  Ankit Jain  <jankit@novell.com>
 
        * Microsoft.Build.Engine.dll.sources: Add tools/xbuild/SolutionParser.cs
index 9523b766603d5a0ab2f5f9b943994f1344bd5440..87799bbd4bd884aa29c718810e8376401c0b387d 100644 (file)
@@ -52,7 +52,7 @@ namespace Microsoft.Build.BuildEngine {
                                        groupingCollection.Add (big);
                                // FIXME: add nested chooses
                                } else if (xe.Name == "PropertyGroup") {
-                                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                                       BuildPropertyGroup bpg = new BuildPropertyGroup (xe, parentProject, null, true);
                                        //bpg.BindToXml (xe);
                                        groupingCollection.Add (bpg);
                                } else
index 1a09b50a2e9a42a817f4d2d7fde9b9706ef42127..b794507afc2e8de2d81fdbb2a6d5e432ba481a82 100644 (file)
@@ -275,5 +275,59 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
             Assert.AreEqual ("B", project.EvaluatedItems[0].Name, "A4");
             Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A5");
         }
+               
+               [Test]
+        public void ChooseWhenPropertyGroup () {
+            
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                    <Choose>
+                        <When Condition=""'$(Configuration)' == ''"">
+                                               <PropertyGroup>
+                                                       <Foo>Bar</Foo>
+                                               </PropertyGroup>
+                        </When>
+                        <Otherwise>
+                                               <PropertyGroup>
+                                                       <Foo>Baz</Foo>
+                                               </PropertyGroup>
+                        </Otherwise>
+                    </Choose>
+                               </Project>
+                       ";
+
+                       Engine engine = new Engine (Consts.BinPath);
+            Project project = engine.CreateNewProject ();
+            project.LoadXml (documentString);
+                       
+                       Assert.AreEqual ("Bar", project.GetEvaluatedProperty ("Foo"), "A1");
+        }
+               
+               [Test]
+        public void ChooseOtherwisePropertyGroup () {
+            
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                    <Choose>
+                        <When Condition=""'$(Configuration)' == 'dummy'"">
+                                               <PropertyGroup>
+                                                       <Foo>Bar</Foo>
+                                               </PropertyGroup>
+                        </When>
+                        <Otherwise>
+                                               <PropertyGroup>
+                                                       <Foo>Baz</Foo>
+                                               </PropertyGroup>
+                        </Otherwise>
+                    </Choose>
+                               </Project>
+                       ";
+
+                       Engine engine = new Engine (Consts.BinPath);
+            Project project = engine.CreateNewProject ();
+            project.LoadXml (documentString);
+                       
+                       Assert.AreEqual ("Baz", project.GetEvaluatedProperty ("Foo"), "A1");
+        }
        }
 }