-
Notifications
You must be signed in to change notification settings - Fork 82
/
Traversal.targets
289 lines (254 loc) · 13.6 KB
/
Traversal.targets
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license.
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(OutputPath)' == '' ">
<!--
OutputPath is required to be set because targets like Clean will read it. Traversal projects shouldn't really emit any
output but it could be hard to track down all of the places where $(OutputPath) and $(OutDir) are expected to be set.
-->
<OutputPath Condition=" '$(Configuration)' == '' And '$(Platform)' == '' ">bin\Debug\</OutputPath>
<OutputPath Condition=" '$(Configuration)' != '' And '$(Platform)' == '' ">bin\$(Configuration)\</OutputPath>
<OutputPath Condition=" '$(Configuration)' != '' And '$(Platform)' != '' ">bin\$(Configuration)\$(Platform)\</OutputPath>
</PropertyGroup>
<!--
TargetFrameworks is used to convey that a project targets multiple frameworks. Traversal does not support multi-targeting
but having this property set to a value can confuse NuGet leading to errors. Setting the property to empty fixes an issue
where a user unknowningly sets it, breaking restore. See also: https://github.com/microsoft/MSBuildSdks/issues/196
-->
<PropertyGroup>
<TargetFrameworks></TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
<!--
TargetFramework is required for restore and used to default to .NET Framework v4.5. However, Traversal projects don't specify a version so it needs to be defaulted here.
-->
<TargetFramework Condition="'$(TargetFramework)' == ''">net45</TargetFramework>
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<ItemGroup>
<ProjectReferenceTargets Remove="Build" />
<ProjectReferenceTargets Remove="Clean" />
<ProjectReferenceTargets Remove="Rebuild" />
<ProjectReferenceTargets Remove="Test" />
<ProjectReferenceTargets Remove="VSTest" />
<ProjectReferenceTargets Remove="Publish" />
<ProjectReferenceTargets Remove="Pack" />
<ProjectReferenceTargets Include="Build" Targets=".default" OuterBuild="true" />
<ProjectReferenceTargets Include="Build" Targets=".default" />
<ProjectReferenceTargets Include="Clean" Targets="Clean" OuterBuild="true" />
<ProjectReferenceTargets Include="Clean" Targets="Clean" />
<ProjectReferenceTargets Include="Rebuild" Targets="Rebuild" />
<ProjectReferenceTargets Include="Test" Targets="Test" />
<ProjectReferenceTargets Include="VSTest" Targets="VSTest" />
<ProjectReferenceTargets Include="Publish" Targets="Publish" />
<ProjectReferenceTargets Include="Pack" Targets="Pack" />
</ItemGroup>
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildToolsVersion)' != 'Current'">$(MSBuildAllProjects);$(MsBuildThisFileFullPath)</MSBuildAllProjects>
<!--
Set by Microsoft.Common.targets, some targets must be removed while others are left as standard extension mechanisms.
-->
<CoreBuildDependsOn>
BuildOnlySettings;
PrepareForBuild;
PreBuildEvent;
ResolveReferences;
PostBuildEvent
</CoreBuildDependsOn>
<PrepareForBuildDependsOn></PrepareForBuildDependsOn>
<ResolveReferencesDependsOn>
BeforeResolveReferences;
AfterResolveReferences
</ResolveReferencesDependsOn>
<TestDependsOn>
Build
</TestDependsOn>
<VSTestDependsOn Condition="'$(VSTestNoBuild)' != 'true'">
Build
</VSTestDependsOn>
<CleanDependsOn>
BeforeClean;
UnmanagedUnregistration;
CoreClean;
PrepareProjectReferences;
CleanPublishFolder;
AfterClean
</CleanDependsOn>
<PackDependsOn>
ResolveReferences;
</PackDependsOn>
<PublishDependsOn Condition="'$(NoBuild)' != 'true'">
Build;
</PublishDependsOn>
<PublishDependsOn Condition="'$(NoBuild)' == 'true'">
</PublishDependsOn>
<GetTargetPathDependsOn></GetTargetPathDependsOn>
</PropertyGroup>
<ItemGroup Condition=" '$(TraversalTranslateProjectFileItems)' != 'false' ">
<!--
Translate the ProjectFile items by moving them to ProjectReference items instead.
-->
<ProjectReference Include="@(ProjectFile)" />
<ProjectFile Remove="@(ProjectFile)" />
</ItemGroup>
<ItemGroup Condition="'$(TraversalGlobalProperties)' != ''">
<ProjectReference Update="@(ProjectReference)"
AdditionalProperties="%(AdditionalProperties);$(TraversalGlobalProperties)" />
</ItemGroup>
<ItemGroup Condition=" '$(TraversalRemoveCurrentProject)' != 'false' ">
<!--
Remove the dirs.proj in case the user accidentally included it through a glob like **\*.*proj. Otherwise
every user has to have an Exclude="$(MSBuildProjectFullPath)".
-->
<ProjectReference Remove="$(MSBuildProjectFullPath)" />
</ItemGroup>
<PropertyGroup>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
<ContinueOnError Condition="'$(ContinueOnError)' == ''">false</ContinueOnError>
<StopOnFirstFailure Condition="'$(StopOnFirstFailure)' == ''">true</StopOnFirstFailure>
</PropertyGroup>
<Target Name="PrepareForBuild"
DependsOnTargets="$(PrepareForBuildDependsOn)" />
<Target Name="Build"
DependsOnTargets="$(BuildDependsOn)"
Condition=" '$(IsGraphBuild)' != 'true' "
Returns="@(CollectedBuildOutput)">
<MSBuild Projects="@(ProjectReference)"
Condition="'%(ProjectReference.Build)' != 'false'"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)', '$(BuildInParallel)'))"
Properties="%(ProjectReference.SetConfiguration); %(ProjectReference.SetPlatform); %(ProjectReference.SetTargetFramework)"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
Targets="%(ProjectReference.Targets)"
ContinueOnError="$(ContinueOnError)">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput" />
</MSBuild>
</Target>
<Target Name="Clean"
DependsOnTargets="$(CleanDependsOn)"
Condition=" '$(IsGraphBuild)' != 'true' ">
<MSBuild Projects="@(ProjectReference)"
Targets="Clean"
Condition="'%(ProjectReference.Clean)' != 'false'"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.CleanInParallel)',
$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)',
$([MSBuild]::ValueOrDefault('$(CleanInParallel)', '$(BuildInParallel)'))
))
))"
Properties="%(ProjectReference.SetConfiguration); %(ProjectReference.SetPlatform); %(ProjectReference.SetTargetFramework)"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
ContinueOnError="$([MSBuild]::ValueOrDefault('$(CleanContinueOnError)', '$(ContinueOnError)'))" />
</Target>
<Target Name="Rebuild"
DependsOnTargets="$(RebuildDependsOn)"
Condition=" '$(IsGraphBuild)' != 'true' "
Returns="@(CollectedBuildOutput)" />
<Target Name="Test"
DependsOnTargets="$(TestDependsOn)"
Condition=" '$(IsGraphBuild)' != 'true' ">
<MSBuild Projects="@(ProjectReference)"
Targets="Test"
Condition="'%(ProjectReference.Test)' != 'false'"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.TestInParallel)',
$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)',
$([MSBuild]::ValueOrDefault('$(TestInParallel)', '$(BuildInParallel)'))
))
))"
Properties="%(ProjectReference.SetConfiguration); %(ProjectReference.SetPlatform); %(ProjectReference.SetTargetFramework)"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
ContinueOnError="$([MSBuild]::ValueOrDefault('$(TestContinueOnError)', '$(ContinueOnError)'))" />
</Target>
<Target Name="VSTest"
DependsOnTargets="$(VSTestDependsOn)"
Condition=" '$(IsGraphBuild)' != 'true' ">
<MSBuild Projects="@(ProjectReference)"
Targets="VSTest"
Condition="'%(ProjectReference.Test)' != 'false'"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.TestInParallel)',
$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)',
$([MSBuild]::ValueOrDefault('$(TestInParallel)', '$(BuildInParallel)'))
))
))"
Properties="%(ProjectReference.SetConfiguration); %(ProjectReference.SetPlatform); %(ProjectReference.SetTargetFramework)"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
ContinueOnError="$([MSBuild]::ValueOrDefault('$(TestContinueOnError)', '$(ContinueOnError)'))" />
</Target>
<Target Name="Pack"
DependsOnTargets="$(PackDependsOn)"
Condition=" '$(IsGraphBuild)' != 'true' ">
<MSBuild Projects="@(ProjectReference)"
Targets="Pack"
Condition="'%(ProjectReference.Pack)' != 'false'"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.PackInParallel)',
$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)',
$([MSBuild]::ValueOrDefault('$(PackInParallel)', '$(BuildInParallel)'))
))
))"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
ContinueOnError="$([MSBuild]::ValueOrDefault('$(PackContinueOnError)', '$(ContinueOnError)'))" />
</Target>
<Target Name="Publish"
DependsOnTargets="$(PublishDependsOn)"
Condition=" '$(IsGraphBuild)' != 'true' ">
<MSBuild Projects="@(ProjectReference)"
Properties="$(TraversalPublishGlobalProperties)"
Targets="Publish"
Condition="'%(ProjectReference.Publish)' != 'false'"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.PublishInParallel)',
$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)',
$([MSBuild]::ValueOrDefault('$(PublishInParallel)', '$(BuildInParallel)'))
))
))"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
ContinueOnError="$([MSBuild]::ValueOrDefault('$(PublishContinueOnError)', '$(ContinueOnError)'))" />
</Target>
<Target Name="GetTargetPath"
DependsOnTargets="$(GetTargetPathDependsOn)"
Returns="@(CollectedBuildOutput)">
<MSBuild Projects="@(ProjectReference)"
Condition="'%(ProjectReference.Build)' != 'false'"
Targets="GetTargetPath"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)', '$(BuildInParallel)'))"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
Properties="%(ProjectReference.SetConfiguration); %(ProjectReference.SetPlatform); %(ProjectReference.SetTargetFramework)"
ContinueOnError="$(ContinueOnError)">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput" />
</MSBuild>
</Target>
<Target Name="GetProjectsToSkip"
Returns="@(ProjectToSkip)">
<MSBuild Projects="@(ProjectReference)"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)', '$(BuildInParallel)'))"
Properties="%(ProjectReference.SetConfiguration); %(ProjectReference.SetPlatform); %(ProjectReference.SetTargetFramework)"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="true"
StopOnFirstFailure="$(StopOnFirstFailure)"
Targets="ShouldSkipProject"
ContinueOnError="$(ContinueOnError)">
<Output TaskParameter="TargetOutputs" ItemName="ProjectToSkip" />
</MSBuild>
</Target>
<Target Name="GetTargetPathWithTargetPlatformMoniker" />
<!--
Traversal projects do not build anything and should not check for invalid configuration/platform.
-->
<Target Name="_CheckForInvalidConfigurationAndPlatform" />
<!-- For CPS/VS support. See https://github.com/dotnet/project-system/blob/master/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/DesignTimeTargets/Microsoft.Managed.DesignTime.targets#L60 -->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets"
Condition="'$(DebuggerFlavor)' == '' And Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets')" />
</Project>