diff options
Diffstat (limited to 'mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs')
-rw-r--r-- | mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs | 85 |
1 files changed, 77 insertions, 8 deletions
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs index a95ee16cb0..3046811068 100644 --- a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs +++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs @@ -1,9 +1,11 @@ +// // ProjectTargetInstance.cs // // Author: // Rolf Bjarne Kvinge (rolf@xamarin.com) +// Atsushi Enomoto (atsshi@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 @@ -25,16 +27,83 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // + using System; +using Microsoft.Build.Construction; +using System.Collections.Generic; +using System.Linq; namespace Microsoft.Build.Execution { - public sealed class ProjectTargetInstance - { - private ProjectTargetInstance () - { - throw new NotImplementedException (); - } - } + public sealed class ProjectTargetInstance + { + internal ProjectTargetInstance (ProjectTargetElement xml) + { + FullPath = xml.ContainingProject.FullPath; + Children = xml.Children.Select<ProjectElement,ProjectTargetInstanceChild> (c => { + if (c is ProjectOnErrorElement) + return new ProjectOnErrorInstance ((ProjectOnErrorElement) c); + if (c is ProjectItemGroupElement) + return new ProjectItemGroupTaskInstance ((ProjectItemGroupElement) c); + if (c is ProjectPropertyGroupElement) + return new ProjectPropertyGroupTaskInstance ((ProjectPropertyGroupElement) c); + if (c is ProjectTaskElement) + return new ProjectTaskInstance ((ProjectTaskElement) c); + throw new NotSupportedException (); + }).ToArray (); + Condition = xml.Condition; + DependsOnTargets = xml.DependsOnTargets; + //FullPath = fullPath; + Inputs = xml.Inputs; + KeepDuplicateOutputs = xml.KeepDuplicateOutputs; + Name = xml.Name; + OnErrorChildren = xml.OnErrors.Select (c => new ProjectOnErrorInstance (c)).ToArray (); + Outputs = xml.Outputs; + Returns = xml.Returns; + Tasks = xml.Tasks.Select (t => new ProjectTaskInstance (t)).ToArray (); + AfterTargetsLocation = xml.AfterTargetsLocation; + BeforeTargetsLocation = xml.BeforeTargetsLocation; + ConditionLocation = xml.ConditionLocation; + DependsOnTargetsLocation = xml.DependsOnTargetsLocation; + InputsLocation = xml.InputsLocation; + KeepDuplicateOutputsLocation = xml.KeepDuplicateOutputsLocation; + Location = xml.Location; + OutputsLocation = xml.OutputsLocation; + ReturnsLocation = xml.ReturnsLocation; + } + + public IList<ProjectTargetInstanceChild> Children { get; private set; } + public string Condition { get; private set; } + public string DependsOnTargets { get; private set; } + public string FullPath { get; private set; } + public string Inputs { get; private set; } + public string KeepDuplicateOutputs { get; private set; } + public string Name { get; private set; } + public IList<ProjectOnErrorInstance> OnErrorChildren { get; private set; } + public string Outputs { get; private set; } + public string Returns { get; private set; } + public ICollection<ProjectTaskInstance> Tasks { get; private set; } +#if NET_4_5 + public ElementLocation AfterTargetsLocation { get; private set; } + public ElementLocation BeforeTargetsLocation { get; private set; } + public ElementLocation ConditionLocation { get; private set; } + public ElementLocation DependsOnTargetsLocation { get; private set; } + public ElementLocation InputsLocation { get; private set; } + public ElementLocation KeepDuplicateOutputsLocation { get; private set; } + public ElementLocation Location { get; private set; } + public ElementLocation OutputsLocation { get; private set; } + public ElementLocation ReturnsLocation { get; private set; } +#else + internal ElementLocation AfterTargetsLocation { get; private set; } + internal ElementLocation BeforeTargetsLocation { get; private set; } + internal ElementLocation ConditionLocation { get; private set; } + internal ElementLocation DependsOnTargetsLocation { get; private set; } + internal ElementLocation InputsLocation { get; private set; } + internal ElementLocation KeepDuplicateOutputsLocation { get; private set; } + internal ElementLocation Location { get; private set; } + internal ElementLocation OutputsLocation { get; private set; } + internal ElementLocation ReturnsLocation { get; private set; } +#endif + } } |