1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
//
// ProjectTargetInstance.cs
//
// Author:
// Rolf Bjarne Kvinge (rolf@xamarin.com)
// Atsushi Enomoto (atsshi@xamarin.com)
//
// 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// 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
{
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
}
}
|