diff options
Diffstat (limited to 'mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs')
-rw-r--r-- | mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs | 239 |
1 files changed, 118 insertions, 121 deletions
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs index 26944910f9..61f8393cda 100644 --- a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs +++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs @@ -2,8 +2,9 @@ // // Author: // Rolf Bjarne Kvinge (rolf@xamarin.com) +// Atsushi Enomoto (atsushi@xamarin.com) // -// Copyright (C) 2011 Xamarin Inc. +// Copyright (C) 2011,2013 Xamarin Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -28,132 +29,128 @@ using Microsoft.Build.Evaluation; using Microsoft.Build.Framework; using Microsoft.Build.Logging; - using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Threading; +using System.Collections; namespace Microsoft.Build.Execution { - public class BuildParameters - { - public BuildParameters () - { - throw new NotImplementedException (); - } - - public BuildParameters (ProjectCollection projectCollection) - { - throw new NotImplementedException (); - } - - public BuildParameters Clone () - { - throw new NotImplementedException (); - } - - public Toolset GetToolset (string toolsVersion) - { - throw new NotImplementedException (); - } - - public ThreadPriority BuildThreadPriority { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public CultureInfo Culture { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public string DefaultToolsVersion { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public bool DetailedSummary { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public bool EnableNodeReuse { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public IDictionary<string, string> EnvironmentProperties { - get { throw new NotImplementedException (); } - } - - public IEnumerable<ForwardingLoggerRecord> ForwardingLoggers { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public IDictionary<string, string> GlobalProperties { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public HostServices HostServices { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public bool LegacyThreadingSemantics { get; set; } - - public IEnumerable<ILogger> Loggers { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public int MaxNodeCount { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public int MemoryUseLimit { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public string NodeExeLocation { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public bool OnlyLogCriticalEvents { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public bool ResetCaches { get; set; } - - public bool SaveOperatingEnvironment { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public ToolsetDefinitionLocations ToolsetDefinitionLocations { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public ICollection<Toolset> Toolsets { - get { throw new NotImplementedException (); } - } - - public CultureInfo UICulture { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public bool UseSynchronousLogging { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - } + public class BuildParameters + { + public BuildParameters () + : this (new ProjectCollection ()) + { + } + + public BuildParameters (ProjectCollection projectCollection) + { + if (projectCollection == null) + throw new ArgumentNullException ("projectCollection"); + projects = projectCollection; + + EnableNodeReuse = true; + Culture = CultureInfo.CurrentCulture; + UICulture = CultureInfo.CurrentUICulture; + MaxNodeCount = projectCollection.MaxNodeCount; + + // these properties are copied, while some members (such as Loggers) are not. + this.DefaultToolsVersion = projectCollection.DefaultToolsVersion; + this.ToolsetDefinitionLocations = projectCollection.ToolsetLocations; + this.GlobalProperties = projectCollection.GlobalProperties; + environment_properties = new Dictionary<string,string> (); + foreach (DictionaryEntry p in Environment.GetEnvironmentVariables ()) + environment_properties [(string) p.Key] = (string) p.Value; + } + + readonly ProjectCollection projects; + Dictionary<string,string> environment_properties; + + internal ProjectCollection ProjectCollection { + get { return projects; } + } + + public BuildParameters Clone () + { + var ret = (BuildParameters) MemberwiseClone (); + ret.ForwardingLoggers = ForwardingLoggers == null ? null : ForwardingLoggers.ToArray (); + ret.GlobalProperties = GlobalProperties == null ? null : GlobalProperties.ToDictionary (p => p.Key, p => p.Value); + ret.Loggers = Loggers == null ? null : new List<ILogger> (Loggers); + ret.environment_properties = new Dictionary<string, string> (environment_properties); + return ret; + } + + public Toolset GetToolset (string toolsVersion) + { + // can return null. + return projects.Toolsets.FirstOrDefault (t => t.ToolsVersion == toolsVersion); + } + + [MonoTODO] + public ThreadPriority BuildThreadPriority { get; set; } + + [MonoTODO] + public CultureInfo Culture { get; set; } + + public string DefaultToolsVersion { get; set; } + + [MonoTODO] + public bool DetailedSummary { get; set; } + + public bool EnableNodeReuse { get; set; } + + [MonoTODO] + public IDictionary<string, string> EnvironmentProperties { + get { return environment_properties; } + } + + [MonoTODO] + public IEnumerable<ForwardingLoggerRecord> ForwardingLoggers { get; set; } + + [MonoTODO] + public IDictionary<string, string> GlobalProperties { get; set; } + + public HostServices HostServices { get; set; } + + [MonoTODO] + public bool LegacyThreadingSemantics { get; set; } + + [MonoTODO] + public IEnumerable<ILogger> Loggers { get; set; } + + [MonoTODO] + public int MaxNodeCount { get; set; } + + [MonoTODO] + public int MemoryUseLimit { get; set; } + + [MonoTODO] + public string NodeExeLocation { get; set; } + + [MonoTODO] + public bool OnlyLogCriticalEvents { get; set; } + + [MonoTODO] + public bool ResetCaches { get; set; } + + [MonoTODO] + public bool SaveOperatingEnvironment { get; set; } + + [MonoTODO] + public ToolsetDefinitionLocations ToolsetDefinitionLocations { get; set; } + + [MonoTODO] + public ICollection<Toolset> Toolsets { + get { return projects.Toolsets; } + } + + [MonoTODO] + public CultureInfo UICulture { get; set; } + + [MonoTODO] + public bool UseSynchronousLogging { get; set; } + } } |