diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2013-12-22 10:08:47 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2014-01-08 03:39:31 +0400 |
commit | 76d9d6a4583025641a2457b970c6e0e81d3aa744 (patch) | |
tree | 663e0245374353c5d83ab8be669fe64b15f727bf /mcs/class | |
parent | 92ac9868a3a4db9a2d7837590cd493118e99d89d (diff) |
[xbuild] Fix 12.0 toolset location and public API
Diffstat (limited to 'mcs/class')
6 files changed, 47 insertions, 34 deletions
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs index 40a4d251606..cbb5fd6d052 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs @@ -119,9 +119,7 @@ namespace Microsoft.Build.BuildEngine { ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40))); #endif #if XBUILD_12 - Toolsets.Add (new Toolset("12.0", - ToolLocationHelper.GetMSBuildInstallPath ("12.0"), - ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40))); + Toolsets.Add (new Toolset ("12.0", ToolLocationHelper.GetPathToBuildTools ("12.0"))); #endif } 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 ae1a9a8effe..c22b8c749c9 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; @@ -1036,9 +1037,9 @@ namespace Microsoft.Build.BuildEngine { // 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)); - string frameworkToolsPath = parentEngine.Toolsets [effective_tools_version].FrameworkToolsPath; - if (frameworkToolsPath == null) - throw new Exception (String.Format ("Invalid tools version '{0}', no framework tools path set for this.", effective_tools_version)); + + var frameworkToolsPath = ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version451); + evaluatedProperties.AddProperty (new BuildProperty ("MSBuildFrameworkToolsPath", frameworkToolsPath, PropertyType.Reserved)); evaluatedProperties.AddProperty (new BuildProperty ("MSBuildFrameworkToolsPath32", frameworkToolsPath, PropertyType.Reserved)); } diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Toolset.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Toolset.cs index 0957f298c50..895bbeebf7a 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Toolset.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Toolset.cs @@ -31,21 +31,15 @@ namespace Microsoft.Build.BuildEngine { public class Toolset { - public Toolset (string toolsVersion, string toolsPath, string toolsFrameworkPath, BuildPropertyGroup buildProperties) + public Toolset (string toolsVersion, string toolsPath, BuildPropertyGroup buildProperties) { ToolsVersion = toolsVersion; ToolsPath = toolsPath; - FrameworkToolsPath = toolsFrameworkPath; BuildProperties = buildProperties; } - public Toolset (string toolsVersion, string toolsPath, string toolsFrameworkPath) - : this (toolsVersion, toolsPath, toolsFrameworkPath, null) - { - } - - public Toolset(string toolsVersion, string toolsPath) - : this (toolsVersion, toolsPath, toolsPath) + public Toolset (string toolsVersion, string toolsPath) + : this (toolsVersion, toolsPath, null) { } @@ -53,6 +47,5 @@ namespace Microsoft.Build.BuildEngine public string ToolsVersion { get; private set; } public string ToolsPath { get; private set; } - public string FrameworkToolsPath { get; private set; } } } diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs index 0906ef3ebf5..04940d5e8ba 100644 --- a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs +++ b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs @@ -48,8 +48,13 @@ namespace Microsoft.Build.Utilities #if NET_4_5 Version45, #endif +#if XBUILD_12 + Version451, +#endif -#if NET_4_5 +#if XBUILD_12 + VersionLatest = Version451 +#elif NET_4_5 VersionLatest = Version45 #elif NET_4_0 VersionLatest = Version40 diff --git a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs index e61094bc867..35226c1a8b1 100644 --- a/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs +++ b/mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs @@ -39,6 +39,7 @@ namespace Microsoft.Build.Utilities { static string lib_mono_dir; static string [] mono_dir; + static bool runningOnDotNet; static ToolLocationHelper () { @@ -53,9 +54,12 @@ namespace Microsoft.Build.Utilities t2 = t1.Parent; lib_mono_dir = t2.FullName; + #if NET_4_0 var windowsPath = Environment.GetFolderPath (Environment.SpecialFolder.Windows); + runningOnDotNet = !string.IsNullOrEmpty (windowsPath) && lib_mono_dir.StartsWith (windowsPath); #endif + if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null) { mono_dir = new string [] { Path.Combine (lib_mono_dir, "net_1_0"), @@ -63,20 +67,19 @@ namespace Microsoft.Build.Utilities Path.Combine (lib_mono_dir, "net_2_0"), Path.Combine (lib_mono_dir, "net_3_5"), Path.Combine (lib_mono_dir, "net_4_0"), + Path.Combine (lib_mono_dir, "net_4_5"), Path.Combine (lib_mono_dir, "net_4_5") }; -#if NET_4_0 - } else if (!string.IsNullOrEmpty (windowsPath) && lib_mono_dir.StartsWith (windowsPath)) { - //running in .NET, not Mono + } else if (runningOnDotNet) { mono_dir = new string [] { Path.Combine (lib_mono_dir, "v1.0.3705"), Path.Combine (lib_mono_dir, "v2.0.50727"), Path.Combine (lib_mono_dir, "v2.0.50727"), Path.Combine (lib_mono_dir, "v3.5"), Path.Combine (lib_mono_dir, "v4.0.30319"), + Path.Combine (lib_mono_dir, "v4.0.30319"), Path.Combine (lib_mono_dir, "v4.0.30319") }; -#endif } else { mono_dir = new string [] { Path.Combine (lib_mono_dir, "1.0"), @@ -84,7 +87,8 @@ namespace Microsoft.Build.Utilities Path.Combine (lib_mono_dir, "2.0"), Path.Combine (lib_mono_dir, "3.5"), Path.Combine (lib_mono_dir, "4.0"), - Path.Combine (lib_mono_dir, "4.5") + Path.Combine (lib_mono_dir, "4.5"), + Path.Combine (lib_mono_dir, "4.5"), }; } @@ -113,15 +117,6 @@ namespace Microsoft.Build.Utilities return mono_dir [(int)version]; } -#if NET_4_0 - public static string GetMSBuildInstallPath (string version) - { - //see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx - var programFiles = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86); - return Path.Combine (programFiles, "MSBuild", version, "bin"); - } -#endif - [MonoTODO] public static string GetPathToDotNetFrameworkFile (string fileName, TargetDotNetFrameworkVersion version) @@ -153,5 +148,27 @@ namespace Microsoft.Build.Utilities throw new NotImplementedException (); } } + +#if XBUILD_12 + public static string CurrentToolsVersion { + get { + return XBuildConsts.Version; + } + } + + public static string GetPathToBuildTools (string toolsVersion) + { + if (toolsVersion != "12.0") + return null; + + if (runningOnDotNet) { + //see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx + var programFiles = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86); + return Path.Combine (programFiles, "MSBuild", toolsVersion, "bin"); + } + + return Path.Combine (lib_mono_dir, "xbuild", toolsVersion, "bin"); + } +#endif } } diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs index 0c3d226fcd3..ab3ee066389 100644 --- a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs +++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs @@ -259,9 +259,8 @@ namespace Microsoft.Build.Evaluation AddToolset (new Toolset ("4.0", ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40), this, null)); #endif -#if NET_4_5 - AddToolset (new Toolset ("12.0", - ToolLocationHelper.GetMSBuildInstallPath ("12.0"), this, ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40))); +#if XBUILD_12 + AddToolset (new Toolset ("12.0", ToolLocationHelper.GetPathToBuildTools ("12.0"), this, null)); #endif default_tools_version = toolsets.First ().ToolsVersion; } |