MS.Build.dll: Add more missing members and implementation for some members.
authorAtsushi Eno <atsushieno@veritas-vos-liberabit.com>
Thu, 10 Oct 2013 18:56:13 +0000 (03:56 +0900)
committerAtsushi Eno <atsushieno@veritas-vos-liberabit.com>
Fri, 29 Nov 2013 09:19:40 +0000 (18:19 +0900)
mcs/class/Microsoft.Build/Microsoft.Build-useful.csproj
mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs
mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs
mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs
mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildRequestData.cs
mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildResult.cs
mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectItemGroupTaskInstance.cs
mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTaskInstance.cs
mcs/class/Microsoft.Build/Microsoft.Build.dll.sources

index 9ec2d9d867f7e6a0e6ca93c92c054c8e6ccab83d..9c576a26f9e6a3d38f6e685b7ec01456b7125748 100644 (file)
     <Compile Include="Microsoft.Build.Execution\BuildSubmissionCompleteCallback.cs" />\r
     <Compile Include="Microsoft.Build.Execution\ProjectOnErrorInstance.cs" />\r
     <Compile Include="Microsoft.Build.Execution\ProjectTargetInstanceChild.cs" />\r
-    <Compile Include="Microsoft.Build.Execution\ProjectTaskInstance.cs" />\r
     <Compile Include="Microsoft.Build.Execution\ProjectTaskInstanceChild.cs" />\r
     <Compile Include="Microsoft.Build.Execution\ProjectTaskOutputItemInstance.cs" />\r
     <Compile Include="Microsoft.Build.Execution\ProjectTaskOutputPropertyInstance.cs" />\r
-    <Compile Include="Microsoft.Build.Execution\ProjectItemGroupTaskInstance.cs" />\r
     <Compile Include="Microsoft.Build.Execution\ProjectItemGroupTaskItemInstance.cs" />\r
     <Compile Include="Microsoft.Build.Execution\ProjectItemGroupTaskMetadataInstance.cs" />\r
+    <Compile Include="Microsoft.Build.Execution\ProjectItemGroupTaskInstance.cs" />\r
+    <Compile Include="Microsoft.Build.Execution\ProjectTaskInstance.cs" />\r
   </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 6b9896f70ce024cddbfa5622c0531a8cd1c1f341..31d2cd36898b7aea84a1bfa1176baf35cc4a6f49 100644 (file)
@@ -243,7 +243,15 @@ namespace Microsoft.Build.Evaluation
 
                public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
                {
-                       throw new NotImplementedException ();
+                       var manager = new BuildManager ();
+                       var pi = manager.GetProjectInstanceForBuild (this);
+                       var parameters = new BuildParameters (this.ProjectCollection) {
+                               ForwardingLoggers = remoteLoggers,
+                               Loggers = loggers
+                       };
+                       var requestData = new BuildRequestData (pi, targets);
+                       var result = manager.Build (parameters, requestData);
+                       return result.OverallResult == BuildResultCode.Success;
                }
 
                public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
index 348a844ad40e4f4574507cf6eed4b38e0e6f9460..43ad717af94cdd60b7accd15e4e6f877033d5369 100644 (file)
 //
 
 using Microsoft.Build.Construction;
+using Microsoft.Build.Execution;
 using Microsoft.Build.Framework;
 using Microsoft.Build.Logging;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
 
 namespace Microsoft.Build.Evaluation
 {
        public class ProjectCollection : IDisposable
        {
+               // static members
+
+               static readonly ProjectCollection global_project_collection;
+
+               static ProjectCollection ()
+               {
+                       global_project_collection = new ProjectCollection ();
+                       global_project_collection.global_properties = new ReadOnlyDictionary<string, string> (new Dictionary<string, string> ());
+               }
+
+               public static string Escape (string unescapedString)
+               {
+                       return unescapedString;
+               }
+
+               public static ProjectCollection GlobalProjectCollection {
+                       get { return global_project_collection; }
+               }
+
+               // semantic model part
+
                public ProjectCollection ()
                {
                }
@@ -54,7 +79,7 @@ namespace Microsoft.Build.Evaluation
 
                public ProjectCollection (IDictionary<string, string> globalProperties, IEnumerable<ILogger> loggers,
                                ToolsetDefinitionLocations toolsetDefinitionLocations)
-               : this (globalProperties, loggers, null, toolsetDefinitionLocations, 1, false)
+                       : this (globalProperties, loggers, null, toolsetDefinitionLocations, int.MaxValue, false)
                {
                }
 
@@ -63,16 +88,23 @@ namespace Microsoft.Build.Evaluation
                                ToolsetDefinitionLocations toolsetDefinitionLocations,
                                int maxNodeCount, bool onlyLogCriticalEvents)
                {
-                       throw new NotImplementedException ();
+                       global_properties = globalProperties ?? new Dictionary<string, string> ();
+                       this.loggers = loggers != null ? loggers.ToList () : new List<ILogger> ();
+                       toolset_locations = toolsetDefinitionLocations;
+                       max_node_count = maxNodeCount;
+                       OnlyLogCriticalEvents = onlyLogCriticalEvents;
                }
 
-               public static string Escape (string unescapedString)
-               {
-                       return unescapedString;
+               int max_node_count;
+
+               [MonoTODO]
+               public int Count {
+                       get { return loaded_projects.Count; }
                }
 
-               public static ProjectCollection GlobalProjectCollection {
-                       get { return globalProjectCollection; }
+               [MonoTODO]
+               public string DefaultToolsVersion {
+                       get { throw new NotImplementedException (); }
                }
 
                public void Dispose ()
@@ -87,19 +119,47 @@ namespace Microsoft.Build.Evaluation
                        }
                }
 
-               static ProjectCollection globalProjectCollection = new ProjectCollection ();
-
                public ICollection<Project> GetLoadedProjects (string fullPath)
                {
-                       throw new NotImplementedException ();
+                       return LoadedProjects.Where (p => Path.GetFullPath (p.FullPath) == Path.GetFullPath (fullPath)).ToList ();
+               }
+
+               IDictionary<string, string> global_properties;
+
+               public IDictionary<string, string> GlobalProperties {
+                       get { return global_properties; }
                }
 
+               List<Project> loaded_projects = new List<Project> ();
+
+               [MonoTODO]
+               public ICollection<Project> LoadedProjects {
+                       get { return loaded_projects; }
+               }
+
+               List<ILogger> loggers = new List<ILogger> ();
+               [MonoTODO]
+               public ICollection<ILogger> Loggers {
+                       get { return loggers; }
+               }
+
+               [MonoTODO]
+               public bool OnlyLogCriticalEvents { get; set; }
+
+               [MonoTODO]
+               public bool SkipEvaluation { get; set; }
+
+               ToolsetDefinitionLocations toolset_locations;
                public ToolsetDefinitionLocations ToolsetLocations {
-                       get { throw new NotImplementedException (); }
+                       get { return toolset_locations; }
                }
 
+               List<Toolset> toolsets = new List<Toolset> ();
+               [MonoTODO ("unused")]
+               // so what should we do without ToolLocationHelper in Microsoft.Build.Utilities.dll? There is no reference to it in this dll.
                public ICollection<Toolset> Toolsets {
-                       get { throw new NotImplementedException (); }
+                       // For ConfigurationFile and None, they cannot be added externally.
+                       get { return (ToolsetLocations & ToolsetDefinitionLocations.Registry) != 0 ? toolsets : toolsets.ToList (); }
                }
 
                public void UnloadAllProjects ()
@@ -120,5 +180,16 @@ namespace Microsoft.Build.Evaluation
                public static Version Version {
                        get { throw new NotImplementedException (); }
                }
+
+               // Execution part
+
+               [MonoTODO]
+               public bool DisableMarkDirty { get; set; }
+
+               [MonoTODO]
+               public HostServices HostServices { get; set; }
+
+               [MonoTODO]
+               public bool IsBuildEnabled { get; set; }
        }
 }
index c5207d7181bc92b4b2cb35da3b16f59b2c1bcab2..f574faed56b5782733167f263b032455dd68bda0 100644 (file)
@@ -45,16 +45,24 @@ namespace Microsoft.Build.Execution
 
                public BuildParameters (ProjectCollection projectCollection)
                {
-                       throw new NotImplementedException ();
+                       if (projectCollection == null)
+                               throw new ArgumentNullException ("projectCollection");
+                       projects = projectCollection;
+
+                       // these properties are copied, while some members (such as Loggers) are not.
+                       this.DefaultToolsVersion = projectCollection.DefaultToolsVersion;
+                       this.ToolsetDefinitionLocations = projectCollection.ToolsetLocations;
+                       this.GlobalProperties = projectCollection.GlobalProperties;
                }
 
+               readonly ProjectCollection projects;
+
                public BuildParameters Clone ()
                {
                        var ret = (BuildParameters) MemberwiseClone ();
                        ret.ForwardingLoggers = ret.ForwardingLoggers.ToArray ();
-                       ret.GlobalProperties = new Dictionary<string, string> (ret.GlobalProperties.ToArray ());
-                       ret.Loggers = ret.Loggers.ToArray ();
-                       ret.Toolsets = ret.Toolsets.ToArray ();
+                       ret.GlobalProperties = ret.GlobalProperties.ToDictionary (p => p.Key, p => p.Value);
+                       ret.Loggers = ret.Loggers == null ? null : ret.Loggers.ToArray ();
                        return ret;
                }
 
@@ -121,7 +129,7 @@ namespace Microsoft.Build.Execution
 
                [MonoTODO]
                public ICollection<Toolset> Toolsets {
-                       get { throw new NotImplementedException (); }
+                       get { return projects.Toolsets; }
                }
 
                [MonoTODO]
index e0ac6d49e87942f688f3bf58c76bfd1e41b13146..72065323c0fd04003dd12eacaae689976db52b54 100644 (file)
@@ -61,23 +61,24 @@ namespace Microsoft.Build.Execution
 
                public BuildRequestData (string projectFullPath, IDictionary<string, string> globalProperties,
                                string toolsVersion, string[] targetsToBuild, HostServices hostServices, BuildRequestDataFlags flags)
-                       : this (new ProjectInstance (projectFullPath, globalProperties, toolsVersion), targetsToBuild, hostServices, BuildRequestDataFlags.None)
+                       : this (new ProjectInstance (projectFullPath, globalProperties, toolsVersion), targetsToBuild, hostServices, flags)
                {
+                       ExplicitlySpecifiedToolsVersion = toolsVersion;
                }
 
-               [MonoTODO]
+               [MonoTODO ("unused")]
                public string ExplicitlySpecifiedToolsVersion { get; private set; }
 
-               [MonoTODO]
+               [MonoTODO ("unused")]
                public BuildRequestDataFlags Flags { get; private set; }
 
-               [MonoTODO]
+               [MonoTODO ("unused")]
                public HostServices HostServices { get; private set; }
 
                [MonoTODO]
                public string ProjectFullPath { get; private set; }
 
-               [MonoTODO]
+               [MonoTODO ("unused")]
                public ProjectInstance ProjectInstance { get; private set; }
 
                [MonoTODO]
index 7286a247d23dc341a91d344abd1d2e7a307ab9b7..021eb624a5559196465182061beaeeaa9274541a 100644 (file)
@@ -30,64 +30,63 @@ using System.Collections.Generic;
 
 namespace Microsoft.Build.Execution
 {
-        public class BuildResult
-        {
-                public void AddResultsForTarget (string target, TargetResult result)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                public bool HasResultsForTarget (string target)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                public void MergeResults (BuildResult results)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                public bool CircularDependency {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public int ConfigurationId {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public Exception Exception {
-                        get { throw new NotImplementedException (); }
-                        set { throw new NotImplementedException (); }
-                }
-
-                public int GlobalRequestId {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public ITargetResult this [string target] {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public int NodeRequestId {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public BuildResultCode OverallResult {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public int ParentGlobalRequestId {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public IDictionary<string, TargetResult> ResultsByTarget {
-                        get { throw new NotImplementedException (); }
-                }
-
-                public int SubmissionId {
-                        get { throw new NotImplementedException (); }
-                }
-
-        }
+       public class BuildResult
+       {
+               public void AddResultsForTarget (string target, TargetResult result)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool HasResultsForTarget (string target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void MergeResults (BuildResult results)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool CircularDependency {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public int ConfigurationId {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public Exception Exception {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public int GlobalRequestId {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ITargetResult this [string target] {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public int NodeRequestId {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public BuildResultCode OverallResult {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public int ParentGlobalRequestId {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public IDictionary<string, TargetResult> ResultsByTarget {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public int SubmissionId {
+                       get { throw new NotImplementedException (); }
+               }
+       }
 }
 
index 63b547f1f1b338b99f5ffae9cabb10a1222a5dde..39d11b22ae7b1f7b1eac27c58f55974ebc4fa291 100644 (file)
@@ -4,12 +4,13 @@ using Microsoft.Build.Construction;
 
 namespace Microsoft.Build.Execution
 {
-       public sealed class ProjectTaskInstance : ProjectTargetInstanceChild
+       public sealed class ProjectItemGroupTaskInstance : ProjectTargetInstanceChild
        {
                public override string Condition {
                        get { throw new NotImplementedException (); }
                }
-               public string ExecuteTargets { get; private set; }
+               public ICollection<ProjectItemGroupTaskItemInstance> Items { get; private set; }
+
                #if NET_4_5
                public override ElementLocation ConditionLocation {
                        get { throw new NotImplementedException (); }
@@ -22,20 +23,6 @@ namespace Microsoft.Build.Execution
                }
                #endif
                public string ContinueOnError { get; private set; }
-               #if NET_4_5
-               public ElementLocation ContinueOnErrorLocation { get; private set; }
-
-
-               public string MSBuildArchitecture { get; private set; }
-               public ElementLocation MSBuildArchitectureLocation { get; private set; }
-               public string MSBuildRuntime { get; private set; }
-               public ElementLocation MSBuildRuntimeLocation { get; private set; }
-
-               #endif
-
-               public string Name { get; private set; }
-               public IList<ProjectTaskInstanceChild> Outputs { get; private set; }
-               public IDictionary<string, string> Parameters { get; private set; }
        }
 }
 
index 39d11b22ae7b1f7b1eac27c58f55974ebc4fa291..63b547f1f1b338b99f5ffae9cabb10a1222a5dde 100644 (file)
@@ -4,13 +4,12 @@ using Microsoft.Build.Construction;
 
 namespace Microsoft.Build.Execution
 {
-       public sealed class ProjectItemGroupTaskInstance : ProjectTargetInstanceChild
+       public sealed class ProjectTaskInstance : ProjectTargetInstanceChild
        {
                public override string Condition {
                        get { throw new NotImplementedException (); }
                }
-               public ICollection<ProjectItemGroupTaskItemInstance> Items { get; private set; }
-
+               public string ExecuteTargets { get; private set; }
                #if NET_4_5
                public override ElementLocation ConditionLocation {
                        get { throw new NotImplementedException (); }
@@ -23,6 +22,20 @@ namespace Microsoft.Build.Execution
                }
                #endif
                public string ContinueOnError { get; private set; }
+               #if NET_4_5
+               public ElementLocation ContinueOnErrorLocation { get; private set; }
+
+
+               public string MSBuildArchitecture { get; private set; }
+               public ElementLocation MSBuildArchitectureLocation { get; private set; }
+               public string MSBuildRuntime { get; private set; }
+               public ElementLocation MSBuildRuntimeLocation { get; private set; }
+
+               #endif
+
+               public string Name { get; private set; }
+               public IList<ProjectTaskInstanceChild> Outputs { get; private set; }
+               public IDictionary<string, string> Parameters { get; private set; }
        }
 }
 
index c19ad11cd4df8581c63596d9689c8b391233c953..5ce148b8bed13aa2ad263efaca00b1fccc9d1831 100644 (file)
@@ -53,8 +53,14 @@ Microsoft.Build.Execution/ProjectInstance.cs
 Microsoft.Build.Execution/ProjectItemDefinitionInstance.cs
 Microsoft.Build.Execution/ProjectItemInstance.cs
 Microsoft.Build.Execution/ProjectMetadataInstance.cs
+Microsoft.Build.Execution/ProjectOnErrorInstance.cs
 Microsoft.Build.Execution/ProjectPropertyInstance.cs
 Microsoft.Build.Execution/ProjectTargetInstance.cs
+Microsoft.Build.Execution/ProjectTaskInstance.cs
+Microsoft.Build.Execution/ProjectTaskInstanceChild.cs
+Microsoft.Build.Execution/ProjectTaskOutputItemInstance.cs
+Microsoft.Build.Execution/ProjectTaskOutputPropertyInstance.cs
+Microsoft.Build.Execution/ProjectTargetInstanceChild.cs
 Microsoft.Build.Execution/TargetResult.cs                           
 Microsoft.Build.Execution/TargetResultCode.cs
 Microsoft.Build.Internal/CollectionFromEnumerable.cs