forked from fredrikhr/dotnet-corefx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dir.traversal.targets
334 lines (285 loc) · 16.1 KB
/
dir.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="FilterProjects">
<PropertyGroup>
<FilterToOSGroup Condition="'$(FilterToOSGroup)'=='' and '$(OSGroup)'!='' and '$(OSGroup)'!='AnyOS'">$(OSGroup)</FilterToOSGroup>
</PropertyGroup>
<ItemGroup>
<!-- list each append as a seperate item to force re-evaluation of AdditionalProperties metadata -->
<Project>
<AdditionalProperties Condition="'%(Project.TargetGroup)'!=''">TargetGroup=%(Project.TargetGroup);%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
<Project>
<FilterToTargetGroup Condition="'$(FilterToTargetGroup)'!=''">$(FilterToTargetGroup)</FilterToTargetGroup>
</Project>
<Project>
<FilterToOSGroup Condition="'$(FilterToOSGroup)'!=''">$(FilterToOSGroup)</FilterToOSGroup>
</Project>
<Project>
<AdditionalProperties Condition="'%(Project.OSGroup)'!=''">OSGroup=%(Project.OSGroup);%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
<Project>
<AdditionalProperties Condition="'%(Project.Platform)'!=''">Platform=%(Project.Platform);%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
<Project>
<AdditionalProperties Condition="'%(Project.FilterToOSGroup)'!=''">FilterToOSGroup=%(Project.FilterToOSGroup);%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
<Project>
<AdditionalProperties Condition="'%(Project.FilterToTargetGroup)'!=''">FilterToTargetGroup=%(Project.FilterToTargetGroup);%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
<Project>
<AdditionalProperties Condition="'%(Project.InputOSGroup)' != ''">InputOSGroup=%(Project.InputOSGroup);%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
<Project>
<AdditionalProperties Condition="'%(Project.BuildAllOSGroups)' != ''">BuildAllOSGroups=%(Project.BuildAllOSGroups);%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
<Project>
<!-- If a project isn't setting the OSGroup via metadata then undefine it so that the globally set OSGroup doesn't override empty OSGroup -->
<UndefineProperties Condition="'%(Project.OSGroup)'==''">%(Project.UndefineProperties);OSGroup</UndefineProperties>
</Project>
<Project>
<UndefineProperties Condition="'%(Project.Extension)'!='.builds' and '%(Project.Extension)'!='.proj'">%(Project.UndefineProperties);TestTFMs;FilterToOSGroup;FilterToTestTFM;DefaultBuildAllTarget;SerializeProjects;BuildAllOSGroups</UndefineProperties>
</Project>
</ItemGroup>
<!-- If we have enabled code coverage and set the projects to be serialized we need to pass that property down to the childe projects -->
<ItemGroup Condition="'$(CodeCoverageEnabled)'=='true' and '$(SerializeProjects)'=='true'">
<Project>
<AdditionalProperties>SerializeProjects=true;%(Project.AdditionalProperties)</AdditionalProperties>
</Project>
</ItemGroup>
<PropertyGroup>
<OSGroupList>AnyOS;$(FilterToOSGroup);</OSGroupList>
<OSGroupList Condition="'$(FilterToOSGroup)'=='OSX'">$(OSGroupList);Unix;</OSGroupList>
<OSGroupList Condition="'$(FilterToOSGroup)'=='Linux'">$(OSGroupList);Unix;</OSGroupList>
<OSGroupList Condition="'$(FilterToOSGroup)'=='FreeBSD'">$(OSGroupList);Unix;</OSGroupList>
<OSGroupList Condition="'$(FilterToOSGroup)'=='NetBSD'">$(OSGroupList);Unix;</OSGroupList>
</PropertyGroup>
<ItemGroup Condition="'$(FilterToOSGroup)'!='' and '$(BuildAllOSGroups)' != 'true'">
<ProjectsToBuild Include="@(Project)" Condition="$(OSGroupList.Contains('%(Project.OSGroup);'))" />
<Project Remove="@(Project)" />
<Project Include="@(ProjectsToBuild)" />
</ItemGroup>
<PropertyGroup>
<TargetGroupList>;$(FilterToTargetGroup);</TargetGroupList>
<TargetGroupList Condition="'$(FilterToTargetGroup)'=='net46'">$(TargetGroupList)net461;net462;</TargetGroupList>
<TargetGroupList Condition="'$(FilterToTargetGroup)'=='net461'">$(TargetGroupList)net462;</TargetGroupList>
</PropertyGroup>
<ItemGroup Condition="'$(FilterToTargetGroup)'!=''">
<FilteredProjectsToBuild Include="@(Project)" Condition="$(TargetGroupList.Contains(';%(Project.TargetGroup);')) Or '%(Project.Extension)' == '.proj' Or '%(Project.Extension)' == '.builds'" />
<Project Remove="@(Project)" />
<Project Include="@(FilteredProjectsToBuild)" />
</ItemGroup>
</Target>
<Target Name="DumpTargets" DependsOnTargets="FilterProjects">
<MSBuild Targets="$(DefaultBuildAllTarget)"
Projects="@(Project)"
Properties="DefaultBuildAllTarget=$(DefaultBuildAllTarget);BuildAllProjects=true"
ContinueOnError="ErrorAndContinue" />
</Target>
<Target Name="ProducesPackageId"
Returns="@(PackageIds)"
DependsOnTargets="FilterProjects">
<MSBuild Targets="ProducesPackageId"
Projects="@(Project)"
BuildInParallel="true"
ContinueOnError="ErrorAndContinue">
<Output TaskParameter="TargetOutputs"
ItemName="PackageIds" />
</MSBuild>
<ItemGroup>
<PackageIds Include="@(PackageIds)" />
</ItemGroup>
</Target>
<Target Name="ProducesTarget" DependsOnTargets="FilterProjects">
<MSBuild Targets="ProducesPackageId"
Projects="@(Project)"
BuildInParallel="true"
ContinueOnError="ErrorAndContinue">
<Output TaskParameter="TargetOutputs"
ItemName="PackageIds" />
</MSBuild>
<Message Text="%(PackageIds.Identity)" Importance="High" />
</Target>
<Target Name="BuildAllProjects" DependsOnTargets="FilterProjects">
<PropertyGroup>
<DefaultBuildAllTarget Condition="'$(DefaultBuildAllTarget)'==''">$(MSBuildProjectDefaultTargets)</DefaultBuildAllTarget>
</PropertyGroup>
<!-- To Serialize we use msbuild's batching functionality '%' to force it to batch all similar projects with the same identity
however since the project names are unique it will essentially force each to run in its own batch -->
<MSBuild Targets="$(DefaultBuildAllTarget)"
Projects="@(Project)"
Condition="'$(SerializeProjects)'=='true' AND '%(Identity)' != ''"
Properties="DefaultBuildAllTarget=$(DefaultBuildAllTarget);BuildAllProjects=true"
ContinueOnError="ErrorAndContinue" />
<MSBuild Targets="$(DefaultBuildAllTarget)"
Projects="@(Project)"
Condition="'$(SerializeProjects)'!='true'"
Properties="DefaultBuildAllTarget=$(DefaultBuildAllTarget);BuildAllProjects=true"
BuildInParallel="true"
ContinueOnError="ErrorAndContinue" />
<!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
<Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
</Target>
<!-- FilterProjectsToTest will filter the project list according to the FilterToTestTFM value -->
<Target Name="FilterProjectsToTest"
BeforeTargets="TestAllProjects"
Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
<ItemGroup>
<Project>
<!-- default to DefaultTestTFM defined in root dir.props if TestTFMs aren't set on the project -->
<TestTFMs Condition="'%(Project.TestTFMs)'==''">$(DefaultTestTFM)</TestTFMs>
</Project>
<Project>
<!-- make sure every defined TestTFM value are surrounded by semicolons for easier search, e.g. ";net46;"" -->
<TestTFMs>;%(Project.TestTFMs);</TestTFMs>
</Project>
<!-- Include all projects which have TestTFM from the supported set -->
<ProjectsToTest Include="@(Project)" Condition="'%(Project.Extension)'=='.csproj' And $([System.String]::new('%(Project.TestTFMs)').Contains(';$(FilterToTestTFM);'))">
<TestTFM>$(FilterToTestTFM)</TestTFM>
</ProjectsToTest>
<ProjectsToTest>
<AdditionalProperties Condition="'%(ProjectsToTest.TestTFM)'!=''">TestTFM=%(ProjectsToTest.TestTFM);%(ProjectsToTest.AdditionalProperties)</AdditionalProperties>
</ProjectsToTest>
<ProjectsToTest>
<AdditionalProperties Condition="'%(ProjectsToTest.FilterToTestTFM)'!=''">FilterToTestTFM=%(ProjectsToTest.FilterToTestTFM);%(ProjectsToTest.AdditionalProperties)</AdditionalProperties>
</ProjectsToTest>
<ProjectsToTest>
<FilterToTestTFM>$(FilterToTestTFM)</FilterToTestTFM>
</ProjectsToTest>
<ProjectsToTest>
<AdditionalProperties Condition="'%(ProjectsToTest.FilterToTestTFM)'!=''">FilterToTestTFM=%(ProjectsToTest.FilterToTestTFM);%(ProjectsToTest.AdditionalProperties)</AdditionalProperties>
</ProjectsToTest>
</ItemGroup>
</Target>
<!-- TestAllProjects will run all tests according to TestTFM value we are filtering with -->
<Target Name="TestAllProjects"
AfterTargets="BuildAllProjects"
Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
<!-- To Serialize we use msbuild's batching functionality '%' to force it to batch all similar projects with the same identity
however since the project names are unique it will essentially force each to run in its own batch -->
<MSBuild Targets="Test"
Projects="@(ProjectsToTest)"
Condition="'$(SerializeProjects)'=='true' AND '%(Identity)' != ''"
Properties="DefaultBuildAllTarget=$(DefaultBuildAllTarget);BuildAllProjects=true"
ContinueOnError="ErrorAndContinue" />
<MSBuild Targets="Test"
Projects="@(ProjectsToTest)"
Condition="'$(SerializeProjects)'!='true'"
Properties="DefaultBuildAllTarget=$(DefaultBuildAllTarget);BuildAllProjects=true"
BuildInParallel="true"
ContinueOnError="ErrorAndContinue" />
<!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
<Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
</Target>
<Target Name="GetFilesToPackage" DependsOnTargets="FilterProjects"
Returns="@(FilesToPackage)">
<MSBuild Targets="GetFilesToPackage"
Projects="@(Project)"
BuildInParallel="true"
Properties="$(ProjectProperties)"
ContinueOnError="ErrorAndContinue" >
<Output TaskParameter="TargetOutputs"
ItemName="FilesToPackage" />
</MSBuild>
<!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
<Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
</Target>
<Target Name="CleanAllProjects" DependsOnTargets="FilterProjects">
<PropertyGroup>
<DefaultCleanAllTarget Condition="'$(DefaultCleanAllTarget)'==''">Clean</DefaultCleanAllTarget>
</PropertyGroup>
<!-- To Serialize we use msbuild's batching functionality '%' to force it to batch all similar projects with the same identity
however since the project names are unique it will essentially force each to run in its own batch -->
<MSBuild Targets="$(DefaultCleanAllTarget)"
Projects="@(Project)"
Condition="'$(SerializeProjects)'=='true' AND '%(Identity)' != ''"
Properties="CleanAllProjects=true"
ContinueOnError="ErrorAndContinue" />
<MSBuild Targets="$(DefaultCleanAllTarget)"
Projects="@(Project)"
Condition="'$(SerializeProjects)'!='true'"
Properties="CleanAllProjects=true"
BuildInParallel="true"
ContinueOnError="ErrorAndContinue" />
<!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
<Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
</Target>
<Target Name="RestoreAllProjectPackages" DependsOnTargets="FilterProjects">
<Message Importance="High" Text="Restoring project packages..." />
<PropertyGroup>
<DefaultRestoreAllPackagesTarget Condition="'$(DefaultRestoreAllPackagesTarget)'==''">RestorePackages</DefaultRestoreAllPackagesTarget>
</PropertyGroup>
<!-- To Serialize we use msbuild's batching functionality '%' to force it to batch all similar projects with the same identity
however since the project names are unique it will essentially force each to run in its own batch -->
<MSBuild Targets="$(DefaultRestoreAllPackagesTarget)"
Projects="@(Project)"
Condition="'$(SerializeProjects)'=='true' AND '%(Identity)' != ''"
Properties="RestoreAllPackages=true"
ContinueOnError="ErrorAndContinue" />
<MSBuild Targets="$(DefaultRestoreAllPackagesTarget)"
Projects="@(Project)"
Condition="'$(SerializeProjects)'!='true'"
Properties="RestoreAllPackages=true"
BuildInParallel="true"
ContinueOnError="ErrorAndContinue" />
<!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
<Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
</Target>
<Target Name="GenerateAllTestProjectJsons">
<PropertyGroup>
<DefaultGenerateAllTestProjectJsonsTarget Condition="'$(DefaultGenerateAllTestProjectJsonsTarget)' == ''">GenerateAllTestProjectJsons</DefaultGenerateAllTestProjectJsonsTarget>
</PropertyGroup>
<ItemGroup>
<GeneratedProject Include="@(Project)">
<AdditionalProperties>GeneratedTargetGroup=%(Project.TargetGroup);GeneratedOSGroup=%(Project.OSGroup);%(Project.AdditionalProperties)</AdditionalProperties>
</GeneratedProject>
</ItemGroup>
<!-- To Serialize we use msbuild's batching functionality '%' to force it to batch all similar projects with the same identity
however since the project names are unique it will essentially force each to run in its own batch -->
<MSBuild Targets="$(DefaultGenerateAllTestProjectJsonsTarget)"
Projects="@(GeneratedProject)"
Condition="'$(SerializeProjects)' != 'true'"
Properties="GenerateAllTestProjectJsons=$(DefaultGenerateAllTestProjectJsonsTarget)"
BuildInParallel="true"
ContinueOnError="ErrorAndContinue" />
<MSBuild Targets="$(DefaultGenerateAllTestProjectJsonsTarget)"
Projects="@(GeneratedProject)"
Condition="'$(SerializeProjects)' == 'true' AND '%(Identity)' != ''"
Properties="GenerateAllTestProjectJsons=$(DefaultGenerateAllTestProjectJsonsTarget)"
ContinueOnError="ErrorAndContinue" />
<!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
<Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
</Target>
<PropertyGroup>
<TraversalBuildDependsOn>
BuildAllProjects;
$(TraversalBuildDependsOn);
</TraversalBuildDependsOn>
<TraversalCleanDependsOn>
CleanAllProjects;
$(TraversalCleanDependsOn);
</TraversalCleanDependsOn>
<TraversalGenerateTestProjectJsonsDependsOn>
GenerateAllTestProjectJsons;
$(TraversalGenerateTestProjectJsonsDependsOn)
</TraversalGenerateTestProjectJsonsDependsOn>
<TraversalRestorePackagesDependsOn>
RestoreAllProjectPackages;
$(TraversalRestorePackagesDependsOn)
</TraversalRestorePackagesDependsOn>
<TraversalRestorePackagesDependsOn Condition="'$(_BuildAgainstPackages)' == 'true'">
$(TraversalGenerateTestProjectJsonsDependsOn);
$(TraversalRestorePackagesDependsOn)
</TraversalRestorePackagesDependsOn>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="$(TraversalBuildDependsOn)" />
<Target Name="Clean" DependsOnTargets="$(TraversalCleanDependsOn)" />
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Target Name="RestorePackages" DependsOnTargets="$(TraversalRestorePackagesDependsOn)" />
<Target Name="BuildAndTest" DependsOnTargets="Build;Test" />
<Target Name="RebuildAndTest" DependsOnTargets="Rebuild;Test" />
<Target Name="Test" />
<!-- Target will be overridden if buildagainstpackages.targets is imported. -->
<Target Name="GenerateTestProjectJson" />
<Import Condition="'$(_BuildAgainstPackages)' == 'true'" Project="$(ToolsDir)/buildagainstpackages.targets" />
</Project>