diff options
Diffstat (limited to 'mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs')
-rw-r--r-- | mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs | 45 |
1 files changed, 42 insertions, 3 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 5b6d2553c8..c22b8c749c 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs @@ -38,6 +38,7 @@ using System.Text; using System.Xml; using System.Xml.Schema; using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; using Mono.XBuild.Framework; using Mono.XBuild.CommandLine; @@ -937,6 +938,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 +951,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)); } } } @@ -1029,7 +1033,17 @@ namespace Microsoft.Build.BuildEngine { SetExtensionsPathProperties (DefaultExtensionsPath); evaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDefaultTargets", DefaultTargets, PropertyType.Reserved)); evaluatedProperties.AddProperty (new BuildProperty ("OS", OS, PropertyType.Environment)); +#if XBUILD_12 + // see http://msdn.microsoft.com/en-us/library/vstudio/hh162058(v=vs.120).aspx + if (effective_tools_version == "12.0") { + evaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath32", toolsPath, PropertyType.Reserved)); + + var frameworkToolsPath = ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version451); + evaluatedProperties.AddProperty (new BuildProperty ("MSBuildFrameworkToolsPath", frameworkToolsPath, PropertyType.Reserved)); + evaluatedProperties.AddProperty (new BuildProperty ("MSBuildFrameworkToolsPath32", frameworkToolsPath, PropertyType.Reserved)); + } +#endif // FIXME: make some internal method that will work like GetDirectoryName but output String.Empty on null/String.Empty string projectDir; if (FullFileName == String.Empty) @@ -1104,9 +1118,10 @@ namespace Microsoft.Build.BuildEngine { void AddImport (XmlElement xmlElement, ImportedProject importingProject, bool evaluate_properties) { // eval all the properties etc till the import - if (evaluate_properties) + if (evaluate_properties) { groupingCollection.Evaluate (EvaluationType.Property); - + groupingCollection.Evaluate (EvaluationType.Choose); + } try { PushThisFileProperty (importingProject != null ? importingProject.FullFileName : FullFileName); @@ -1121,6 +1136,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); |