Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Reflection;
@@ -59,4 +58,3 @@ using System.Runtime.InteropServices;
[assembly: AssemblyFileVersion (XBuildConsts.FileVersion)]
#endif

View File

@@ -20,4 +20,3 @@ Microsoft.Build.Utilities/ToolTask.cs
Mono.XBuild.Utilities/MonoLocationHelper.cs
Mono.XBuild.Utilities/ReservedNameUtils.cs
Mono.XBuild.Utilities/MSBuildUtils.cs
../System/System.Collections.Specialized/ProcessStringDictionary.cs

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.Resources;
@@ -112,4 +111,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.Collections;
@@ -329,11 +328,7 @@ namespace Microsoft.Build.Utilities
}
}
#if NET_4_0
public
#else
protected
#endif
void AppendTextUnquoted (string textToAppend)
{
commandLine.Append (textToAppend);
@@ -377,4 +372,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -26,7 +26,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
namespace Microsoft.Build.Utilities
{
@@ -38,4 +37,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.Text;
@@ -119,4 +118,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -59,15 +59,31 @@ namespace Microsoft.Build.Utilities
//
public static Result TryParseLine (string line)
{
int originEnd, originStart = 0;
var result = new Result ();
int originStart = 0;
MoveNextNonSpace (line, ref originStart);
if (originStart >= line.Length)
return null;
//find the origin section
//the filename may include a colon for Windows drive e.g. C:\foo, so ignore colon in first 2 chars
int originEnd = line[originStart] == ':'? originStart : line.IndexOf (':', originStart + 2) - 1;
if (line[originStart] != ':') {
if (originStart + 2 >= line.Length)
return null;
if ((originEnd = line.IndexOf (':', originStart + 2) - 1) < 0)
return null;
} else {
originEnd = originStart;
}
int categoryStart = originEnd + 2;
if (categoryStart > line.Length)
return null;
MovePrevNonSpace (line, ref originEnd);
//if there is no origin section, then we can't parse the message
@@ -76,8 +92,10 @@ namespace Microsoft.Build.Utilities
//find the category section, if there is one
MoveNextNonSpace (line, ref categoryStart);
int categoryEnd = line.IndexOf (':', categoryStart) - 1;
int messageStart = categoryEnd + 2;
if (categoryEnd >= 0) {
MovePrevNonSpace (line, ref categoryEnd);
if (categoryEnd <= categoryStart)

View File

@@ -1,22 +1,19 @@
#if NET_2_0
using System;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Diagnostics;
using SCS = System.Collections.Specialized;
namespace Microsoft.Build.Utilities
{
internal static class ProcessService {
static SCS.ProcessStringDictionary globalEnvironmentVariablesOverride;
static Dictionary<string, string> globalEnvironmentVariablesOverride;
public static StringDictionary GlobalEnvironmentVariblesOverride {
public static Dictionary<string, string> GlobalEnvironmentVariblesOverride {
get {
if (globalEnvironmentVariablesOverride == null)
globalEnvironmentVariablesOverride = new SCS.ProcessStringDictionary ();
globalEnvironmentVariablesOverride = new Dictionary<string, string> (StringComparer.InvariantCultureIgnoreCase);
return globalEnvironmentVariablesOverride;
}
}
@@ -59,7 +56,7 @@ namespace Microsoft.Build.Utilities
return StartProcess (startInfo, outWriter, errorWriter, exited, null);
}
public static ProcessWrapper StartProcess (ProcessStartInfo startInfo, TextWriter outWriter, TextWriter errorWriter, EventHandler exited, StringDictionary environmentOverride)
public static ProcessWrapper StartProcess (ProcessStartInfo startInfo, TextWriter outWriter, TextWriter errorWriter, EventHandler exited, Dictionary<string, string> environmentOverride)
{
ProcessEventHandler wout = OutWriter.GetWriteHandler (outWriter);
ProcessEventHandler werr = OutWriter.GetWriteHandler (errorWriter);
@@ -67,7 +64,7 @@ namespace Microsoft.Build.Utilities
}
// @environmentOverride overrides even the global override values
public static ProcessWrapper StartProcess (ProcessStartInfo startInfo, ProcessEventHandler outputStreamChanged, ProcessEventHandler errorStreamChanged, EventHandler exited, StringDictionary environmentOverride)
public static ProcessWrapper StartProcess (ProcessStartInfo startInfo, ProcessEventHandler outputStreamChanged, ProcessEventHandler errorStreamChanged, EventHandler exited, Dictionary<string, string> environmentOverride)
{
if (startInfo == null)
throw new ArgumentException ("startInfo");
@@ -122,14 +119,14 @@ namespace Microsoft.Build.Utilities
return startInfo;
}
public static void ProcessEnvironmentVariableOverrides (ProcessStartInfo info, StringDictionary environmentOverride)
public static void ProcessEnvironmentVariableOverrides (ProcessStartInfo info, Dictionary<string, string> environmentOverride)
{
if (globalEnvironmentVariablesOverride != null)
foreach (DictionaryEntry entry in globalEnvironmentVariablesOverride)
foreach (var entry in globalEnvironmentVariablesOverride)
ProcessEnvironmentVariable (info, (string)entry.Key, (string)entry.Value);
if (environmentOverride != null)
foreach (DictionaryEntry entry in environmentOverride)
foreach (var entry in environmentOverride)
ProcessEnvironmentVariable (info, (string)entry.Key, (string)entry.Value);
}
@@ -164,4 +161,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -40,30 +40,23 @@ namespace Microsoft.Build.Utilities
{
Version11,
Version20,
#if NET_3_5
Version30,
Version35,
#endif
#if NET_4_0
Version40,
#endif
#if NET_4_5
Version45,
#endif
#if XBUILD_12
Version451,
#endif
#if XBUILD_14
Version453,
#endif
#if XBUILD_12
#if XBUILD_14
VersionLatest = Version453
#elif XBUILD_12
VersionLatest = Version451
#elif NET_4_5
VersionLatest = Version45
#elif NET_4_0
VersionLatest = Version40
#elif NET_3_5
VersionLatest = Version35
#else
VersionLatest = Version20
VersionLatest = Version45
#endif
}
}

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.Resources;
@@ -109,4 +108,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.Collections;
@@ -40,9 +39,7 @@ namespace Microsoft.Build.Utilities
public
#endif
sealed class TaskItem : MarshalByRefObject, ITaskItem
#if NET_4_0
, ITaskItem2
#endif
{
IDictionary escapedMetadata;
string escapedItemSpec;
@@ -58,13 +55,11 @@ namespace Microsoft.Build.Utilities
if (sourceItem == null)
throw new ArgumentNullException ("sourceItem");
#if NET_4_0
var ti2 = sourceItem as ITaskItem2;
if (ti2 != null) {
escapedItemSpec = ti2.EvaluatedIncludeEscaped;
escapedMetadata = ti2.CloneCustomMetadataEscaped ();
} else
#endif
{
escapedItemSpec = MSBuildUtils.Escape (sourceItem.ItemSpec);
escapedMetadata = sourceItem.CloneCustomMetadata ();
@@ -107,12 +102,10 @@ namespace Microsoft.Build.Utilities
return CollectionsUtil.CreateCaseInsensitiveHashtable (escapedMetadata);
}
#if NET_4_0
IDictionary ITaskItem2.CloneCustomMetadataEscaped ()
{
return CloneCustomMetadataEscaped ();
}
#endif
public void CopyMetadataTo (ITaskItem destinationItem)
{
@@ -140,12 +133,10 @@ namespace Microsoft.Build.Utilities
return ((string) escapedMetadata [metadataName]) ?? String.Empty;
}
#if NET_4_0
string ITaskItem2.GetMetadataValueEscaped (string metadataName)
{
return GetMetadataValue (metadataName);
}
#endif
public override object InitializeLifetimeService ()
{
@@ -176,12 +167,10 @@ namespace Microsoft.Build.Utilities
escapedMetadata [metadataName] = metadataValue;
}
#if NET_4_0
void ITaskItem2.SetMetadataValueLiteral (string metadataName, string metadataValue)
{
SetMetadata (metadataName, MSBuildUtils.Escape (metadataValue));
}
#endif
public override string ToString ()
{
return escapedItemSpec;
@@ -192,12 +181,10 @@ namespace Microsoft.Build.Utilities
set { escapedItemSpec = value; }
}
#if NET_4_0
string ITaskItem2.EvaluatedIncludeEscaped {
get { return escapedItemSpec; }
set { escapedItemSpec = value; }
}
#endif
public int MetadataCount {
get { return escapedMetadata.Count + 11; }
@@ -219,4 +206,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.IO;
@@ -430,4 +429,3 @@ namespace Microsoft.Build.Utilities
}
}
#endif

View File

@@ -57,10 +57,8 @@ namespace Microsoft.Build.Utilities
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 [] {
@@ -133,11 +131,9 @@ namespace Microsoft.Build.Utilities
//Mono doesn't ship multiple versions of tools that are backwards/forwards compatible
if (!runningOnDotNet) {
#if NET_3_5
//most of the 3.5 tools are in the 2.0 directory
if (version == TargetDotNetFrameworkVersion.Version35)
return GetPathToDotNetFrameworkFile (fileName, TargetDotNetFrameworkVersion.Version20);
#endif
//unversioned tools are in the 4.5 directory
if (version == TargetDotNetFrameworkVersion.Version20)
return GetPathToDotNetFrameworkFile (fileName, (TargetDotNetFrameworkVersion)5);
@@ -158,7 +154,6 @@ namespace Microsoft.Build.Utilities
throw new NotImplementedException ();
}
#if NET_4_0
public static string GetPathToStandardLibraries (string targetFrameworkIdentifier,
string targetFrameworkVersion,
string targetFrameworkProfile)
@@ -209,7 +204,6 @@ namespace Microsoft.Build.Utilities
// I'm not sure if this is completely valid assumption...
return path;
}
#endif
[MonoTODO]
public static string GetPathToSystemFile (string fileName)
@@ -233,11 +227,20 @@ namespace Microsoft.Build.Utilities
public static string GetPathToBuildTools (string toolsVersion)
{
if (toolsVersion != "12.0")
string path;
switch (toolsVersion) {
case "12.0":
path = "xbuild_12";
break;
case "14.0":
path = "xbuild_14";
break;
default:
return null;
}
if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null)
return Path.Combine (lib_mono_dir, "xbuild_12");
return Path.Combine (lib_mono_dir, path);
if (runningOnDotNet) {
//see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx

View File

@@ -40,15 +40,14 @@ using System.Text.RegularExpressions;
using Microsoft.Build.Framework;
using Mono.XBuild.Utilities;
using System.Threading;
using System.Collections.Generic;
using SCS = System.Collections.Specialized;
namespace Microsoft.Build.Utilities
{
public abstract class ToolTask : Task
#if NET_4_0
, ICancelableTask
#endif
{
int exitCode;
int timeout;
@@ -58,9 +57,7 @@ namespace Microsoft.Build.Utilities
MessageImportance standardOutputLoggingImportance;
StringBuilder toolOutput;
bool typeLoadException;
#if NET_4_0
ManualResetEvent canceled;
#endif
protected ToolTask ()
: this (null, null)
@@ -81,9 +78,7 @@ namespace Microsoft.Build.Utilities
this.HelpKeywordPrefix = helpKeywordPrefix;
this.responseFileEncoding = Encoding.UTF8;
this.timeout = Int32.MaxValue;
#if NET_4_0
canceled = new ManualResetEvent (false);
#endif
}
[MonoTODO]
@@ -406,29 +401,29 @@ namespace Microsoft.Build.Utilities
// EnvironmentOverride is Obsolete'd in 4.0
//
// Returns the final set of environment variables and logs them
SCS.StringDictionary GetAndLogEnvironmentVariables ()
Dictionary<string, string> GetAndLogEnvironmentVariables ()
{
var env_vars = GetEnvironmentVariables ();
if (env_vars == null)
return env_vars;
Log.LogMessage (MessageImportance.Low, "Environment variables being passed to the tool:");
foreach (DictionaryEntry entry in env_vars)
foreach (var entry in env_vars)
Log.LogMessage (MessageImportance.Low, "\t{0}={1}", (string)entry.Key, (string)entry.Value);
return env_vars;
}
SCS.StringDictionary GetEnvironmentVariables ()
Dictionary<string, string> GetEnvironmentVariables ()
{
if (EnvironmentVariables == null || EnvironmentVariables.Length == 0)
return EnvironmentOverride;
var env_vars = new Dictionary<string, string> (StringComparer.InvariantCultureIgnoreCase);
var env_vars = new SCS.ProcessStringDictionary ();
foreach (string pair in EnvironmentVariables) {
string [] key_value = pair.Split ('=');
if (!String.IsNullOrEmpty (key_value [0]))
env_vars [key_value [0]] = key_value.Length > 1 ? key_value [1] : String.Empty;
if (EnvironmentVariables != null) {
foreach (string pair in EnvironmentVariables) {
string [] key_value = pair.Split ('=');
if (!String.IsNullOrEmpty (key_value [0]))
env_vars [key_value [0]] = key_value.Length > 1 ? key_value [1] : String.Empty;
}
}
if (EnvironmentOverride != null)
@@ -506,7 +501,6 @@ namespace Microsoft.Build.Utilities
set { toolPath = value; }
}
#if NET_4_0
protected ManualResetEvent ToolCanceled {
get {
return canceled;
@@ -517,7 +511,6 @@ namespace Microsoft.Build.Utilities
{
canceled.Set ();
}
#endif
#if XBUILD_12
protected MessageImportance StandardErrorImportanceToUse {
@@ -533,6 +526,7 @@ namespace Microsoft.Build.Utilities
}
public bool LogStandardErrorAsError { get; set; }
public string StandardOutputImportance { get; set; }
#endif
}
}

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.IO;
@@ -76,4 +75,3 @@ namespace Mono.XBuild.Utilities {
}
}
#endif