2 // ProjectTargetInstance.cs
5 // Rolf Bjarne Kvinge (rolf@xamarin.com)
6 // Atsushi Enomoto (atsshi@xamarin.com)
8 // Copyright (C) 2011,2013 Xamarin Inc.
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using Microsoft.Build.Construction;
33 using System.Collections.Generic;
36 namespace Microsoft.Build.Execution
38 public sealed class ProjectTargetInstance
40 internal ProjectTargetInstance (ProjectTargetElement xml)
42 FullPath = xml.ContainingProject.FullPath;
43 Children = xml.Children.Select<ProjectElement,ProjectTargetInstanceChild> (c => {
44 if (c is ProjectOnErrorElement)
45 return new ProjectOnErrorInstance ((ProjectOnErrorElement) c);
46 if (c is ProjectItemGroupElement)
47 return new ProjectItemGroupTaskInstance ((ProjectItemGroupElement) c);
48 if (c is ProjectPropertyGroupElement)
49 return new ProjectPropertyGroupTaskInstance ((ProjectPropertyGroupElement) c);
50 if (c is ProjectTaskElement)
51 return new ProjectTaskInstance ((ProjectTaskElement) c);
52 throw new NotSupportedException ();
54 Condition = xml.Condition;
55 DependsOnTargets = xml.DependsOnTargets;
56 //FullPath = fullPath;
58 KeepDuplicateOutputs = xml.KeepDuplicateOutputs;
60 OnErrorChildren = xml.OnErrors.Select (c => new ProjectOnErrorInstance (c)).ToArray ();
61 Outputs = xml.Outputs;
62 Returns = xml.Returns;
63 Tasks = xml.Tasks.Select (t => new ProjectTaskInstance (t)).ToArray ();
64 AfterTargetsLocation = xml.AfterTargetsLocation;
65 BeforeTargetsLocation = xml.BeforeTargetsLocation;
66 ConditionLocation = xml.ConditionLocation;
67 DependsOnTargetsLocation = xml.DependsOnTargetsLocation;
68 InputsLocation = xml.InputsLocation;
69 KeepDuplicateOutputsLocation = xml.KeepDuplicateOutputsLocation;
70 Location = xml.Location;
71 OutputsLocation = xml.OutputsLocation;
72 ReturnsLocation = xml.ReturnsLocation;
75 public IList<ProjectTargetInstanceChild> Children { get; private set; }
76 public string Condition { get; private set; }
77 public string DependsOnTargets { get; private set; }
78 public string FullPath { get; private set; }
79 public string Inputs { get; private set; }
80 public string KeepDuplicateOutputs { get; private set; }
81 public string Name { get; private set; }
82 public IList<ProjectOnErrorInstance> OnErrorChildren { get; private set; }
83 public string Outputs { get; private set; }
84 public string Returns { get; private set; }
85 public ICollection<ProjectTaskInstance> Tasks { get; private set; }
87 public ElementLocation AfterTargetsLocation { get; private set; }
88 public ElementLocation BeforeTargetsLocation { get; private set; }
89 public ElementLocation ConditionLocation { get; private set; }
90 public ElementLocation DependsOnTargetsLocation { get; private set; }
91 public ElementLocation InputsLocation { get; private set; }
92 public ElementLocation KeepDuplicateOutputsLocation { get; private set; }
93 public ElementLocation Location { get; private set; }
94 public ElementLocation OutputsLocation { get; private set; }
95 public ElementLocation ReturnsLocation { get; private set; }
97 internal ElementLocation AfterTargetsLocation { get; private set; }
98 internal ElementLocation BeforeTargetsLocation { get; private set; }
99 internal ElementLocation ConditionLocation { get; private set; }
100 internal ElementLocation DependsOnTargetsLocation { get; private set; }
101 internal ElementLocation InputsLocation { get; private set; }
102 internal ElementLocation KeepDuplicateOutputsLocation { get; private set; }
103 internal ElementLocation Location { get; private set; }
104 internal ElementLocation OutputsLocation { get; private set; }
105 internal ElementLocation ReturnsLocation { get; private set; }