<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
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)
//
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 ()
{
}
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)
{
}
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 ()
}
}
- 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 ()
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; }
}
}
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;
}
[MonoTODO]
public ICollection<Toolset> Toolsets {
- get { throw new NotImplementedException (); }
+ get { return projects.Toolsets; }
}
[MonoTODO]
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]
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 (); }
+ }
+ }
}
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 (); }
}
#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; }
}
}
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 (); }
}
#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; }
}
}
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