diff options
author | Gustavo Guerra <gustavo@codebeside.org> | 2013-09-30 00:26:00 +0400 |
---|---|---|
committer | Gustavo Guerra <gustavo@codebeside.org> | 2013-09-30 00:26:00 +0400 |
commit | 29bb48cdc733b03b3b055dafd9bb149657e17192 (patch) | |
tree | 4601deb70ad14d0d57c2d5bfa658e3ff0355b6ac /mcs/class/Microsoft.Build.Engine | |
parent | ad8b4d7a4b02d7662e664dd7263833f600fdd8fe (diff) |
[xBuild] Support for ImportGroup element
Used in the .targets files shipped with VS2013
Diffstat (limited to 'mcs/class/Microsoft.Build.Engine')
-rw-r--r-- | mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs index 9bab7d05371..660c14cb19c 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs @@ -937,6 +937,9 @@ namespace Microsoft.Build.BuildEngine { case "Import": AddImport (xe, ip, true); break; + case "ImportGroup": + AddImportGroup (xe, ip, true); + break; case "ItemGroup": AddItemGroup (xe, ip); break; @@ -947,7 +950,7 @@ namespace Microsoft.Build.BuildEngine { AddChoose (xe, ip); break; default: - throw new InvalidProjectFileException (String.Format ("Invalid element '{0}' in project file.", xe.Name)); + throw new InvalidProjectFileException (String.Format ("Invalid element '{0}' in project file '{1}'.", xe.Name, ip.FullFileName)); } } } @@ -1132,6 +1135,30 @@ namespace Microsoft.Build.BuildEngine { } } + void AddImportGroup (XmlElement xmlElement, ImportedProject importedProject, bool evaluate_properties) + { + // eval all the properties etc till the import group + if (evaluate_properties) { + groupingCollection.Evaluate (EvaluationType.Property); + groupingCollection.Evaluate (EvaluationType.Choose); + } + string condition_attribute = xmlElement.GetAttribute ("Condition"); + if (!ConditionParser.ParseAndEvaluate (condition_attribute, this)) + return; + foreach (XmlNode xn in xmlElement.ChildNodes) { + if (xn is XmlElement) { + XmlElement xe = (XmlElement) xn; + switch (xe.Name) { + case "Import": + AddImport (xe, importedProject, evaluate_properties); + break; + default: + throw new InvalidProjectFileException(String.Format("Invalid element '{0}' inside ImportGroup in project file '{1}'.", xe.Name, importedProject.FullFileName)); + } + } + } + } + bool AddSingleImport (XmlElement xmlElement, string projectPath, ImportedProject importingProject, string from_source_msg) { Import import = new Import (xmlElement, projectPath, this, importingProject); |