-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Microsoft.NET.Sdk.StaticWebAssets.EmbeddedAssets.targets
317 lines (261 loc) · 17.7 KB
/
Microsoft.NET.Sdk.StaticWebAssets.EmbeddedAssets.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
<!--
***********************************************************************************************
Microsoft.NET.Sdk.StaticWebAssets.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project ToolsVersion="14.0">
<Target Name="GetStaticWebAssetsCrosstargetingProjectConfiguration"
Returns="@(_StaticWebAssetThisEmbeddedProjectConfiguration)"
DependsOnTargets="ResolveStaticWebAssetsConfiguration">
<PropertyGroup>
<StaticWebAssetsGetEmbeddedPublishAssetsTargets Condition="'$(StaticWebAssetsGetEmbeddedPublishAssetsTargets)' == ''">ComputeReferencedStaticWebAssetsPublishManifest;GetCurrentProjectEmbeddedPublishStaticWebAssetItems</StaticWebAssetsGetEmbeddedPublishAssetsTargets>
<StaticWebAssetsGetEmbeddedBuildAssetsTargets Condition="'$(StaticWebAssetsGetEmbeddedBuildAssetsTargets)' == ''">Build;GetCurrentProjectEmbeddedBuildStaticWebAssetItems</StaticWebAssetsGetEmbeddedBuildAssetsTargets>
<GetReferencedEmbeddedAssetsProperties>$(GetReferencedEmbeddedAssetsProperties);TargetFramework=$(TargetFramework);ResolveEmbeddedStaticWebAssets=false</GetReferencedEmbeddedAssetsProperties>
<StaticWebAssetsAdditionalEmbeddedBuildProperties>$(StaticWebAssetsAdditionalEmbeddedBuildProperties);TargetFramework=$(TargetFramework);ResolveEmbeddedStaticWebAssets=false</StaticWebAssetsAdditionalEmbeddedBuildProperties>
<StaticWebAssetsAdditionalEmbeddedPublishProperties>$(StaticWebAssetsAdditionalEmbeddedPublishProperties);TargetFramework=$(TargetFramework);ResolveEmbeddedStaticWebAssets=false</StaticWebAssetsAdditionalEmbeddedPublishProperties>
</PropertyGroup>
<ItemGroup>
<_StaticWebAssetThisEmbeddedProjectConfiguration Include="$(MSBuildProjectFullPath)">
<Version>2</Version>
<Source>$(PackageId)</Source>
<TargetFramework>$(TargetFramework)</TargetFramework>
<!-- Get embedded referenced assets properties -->
<GetReferencedEmbeddedAssetsProperties>$(GetReferencedEmbeddedAssetsProperties)</GetReferencedEmbeddedAssetsProperties>
<GetReferencedEmbeddedAssetsPropertiesToRemove>$(GetReferencedEmbeddedAssetsPropertiesToRemove)</GetReferencedEmbeddedAssetsPropertiesToRemove>
<!-- Build -->
<GetEmbeddedBuildAssetsTargets>$(StaticWebAssetsGetEmbeddedBuildAssetsTargets)</GetEmbeddedBuildAssetsTargets>
<AdditionalEmbeddedBuildProperties>$(StaticWebAssetsAdditionalEmbeddedBuildProperties)</AdditionalEmbeddedBuildProperties>
<AdditionalEmbeddedBuildPropertiesToRemove>$(StaticWebAssetsAdditionalEmbeddedBuildPropertiesToRemove)</AdditionalEmbeddedBuildPropertiesToRemove>
<!-- Publish -->
<GetEmbeddedPublishAssetsTargets>$(StaticWebAssetsGetEmbeddedPublishAssetsTargets)</GetEmbeddedPublishAssetsTargets>
<AdditionalEmbeddedPublishProperties>$(StaticWebAssetsAdditionalEmbeddedPublishProperties)</AdditionalEmbeddedPublishProperties>
<AdditionalEmbeddedPublishPropertiesToRemove>$(StaticWebAssetsAdditionalEmbeddedPublishPropertiesToRemove)</AdditionalEmbeddedPublishPropertiesToRemove>
</_StaticWebAssetThisEmbeddedProjectConfiguration>
</ItemGroup>
</Target>
<Target Name="ResolveStaticWebAssetsCrossTargetingConfiguration"
Condition="'$(TargetFrameworks)' != '' And '@(StaticWebAssetsEmbeddedConfiguration)' != ''"
Returns="@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)">
<!-- Call the outer build to resolve all the project configurations to this project. -->
<MSBuild
Targets="GetStaticWebAssetsCrossTargetingProjectConfiguration"
Properties="Configuration=$(Configuration)"
RemoveProperties="TargetFramework"
Projects="$(MSBuildProjectFullPath)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="!$(BuildingProject)"
SkipNonexistentTargets="true">
<Output TaskParameter="TargetOutputs" ItemName="_StaticWebAssetsCrossTargetingProjectConfiguration" />
</MSBuild>
<!-- Break down the target framework into its components. We do it here because we can't do it inside the task without
referencing additional dlls, which is painful.
-->
<ItemGroup>
<_ExtendedStaticWebAssetsCrossTargetingProjectConfiguration Include="@(_StaticWebAssetsCrossTargetingProjectConfiguration)">
<TargetFrameworkIdentifier>$([MSBuild]::GetTargetFrameworkIdentifier('%(_StaticWebAssetsCrossTargetingProjectConfiguration.TargetFramework)'))</TargetFrameworkIdentifier>
<TargetFrameworkVersion>$([MSBuild]::GetTargetFrameworkVersion('%(_StaticWebAssetsCrossTargetingProjectConfiguration.TargetFramework)'))</TargetFrameworkVersion>
<Platform>$([MSBuild]::GetTargetPlatformIdentifier('%(_StaticWebAssetsCrossTargetingProjectConfiguration.TargetFramework)'))</Platform>
<PlatformVersion>$([MSBuild]::GetTargetPlatformVersion('%(_StaticWebAssetsCrossTargetingProjectConfiguration.TargetFramework)'))</PlatformVersion>
</_ExtendedStaticWebAssetsCrossTargetingProjectConfiguration>
</ItemGroup>
<!-- Evaluate the embedding rules for this target framework. -->
<ResolveStaticWebAssetsEmbeddedProjectConfiguration
Condition="'@(_StaticWebAssetsCrossTargetingProjectConfiguration)' != ''"
StaticWebAssetProjectConfiguration="@(_ExtendedStaticWebAssetsCrossTargetingProjectConfiguration)"
EmbeddingConfiguration="@(StaticWebAssetsEmbeddedConfiguration)"
TargetFramework="$(TargetFramework)"
>
<Output TaskParameter="EmbeddedProjectAssetConfigurations" ItemName="_StaticWebAssetsEmbeddedProjectAssetConfigurations" />
</ResolveStaticWebAssetsEmbeddedProjectConfiguration>
<ItemGroup>
<_StaticWebAssetsEmbeddedProjectAssetConfigurations Condition="'%(Identity)' != ''" KeepMetadata="@(_StaticWebAssetEmbeddedProjectConfigurationCanonicalMetadata)" />
</ItemGroup>
</Target>
<Target Name="ResolveStaticWebAssetsEmbeddingRules" Returns="@(StaticWebAssetsEmbeddedConfiguration)" />
<Target Name="ResolveEmbeddedProjectsStaticWebAssets"
Condition="'$(ResolveEmbeddedStaticWebAssets)' != 'false'"
DependsOnTargets="ResolveStaticWebAssetsCrossTargetingConfiguration">
<MSBuild
Condition="'@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)' != '' and %(_StaticWebAssetsEmbeddedProjectAssetConfigurations.TargetFramework) != '$(TargetFramework)'"
Targets="%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.GetEmbeddedBuildAssetsTargets)"
Properties="%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.AdditionalEmbeddedBuildProperties)"
RemoveProperties="%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.AdditionalEmbeddedBuildPropertiesToRemove);$(_GlobalPropertiesToRemoveFromProjectReferences)"
Projects="@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="!$(BuildingProject)"
SkipNonexistentTargets="false"
>
<Output TaskParameter="TargetOutputs" ItemName="_EmbeddedBuildStaticWebAssetsItems" />
</MSBuild>
<ItemGroup>
<StaticWebAsset
Include="@(_EmbeddedBuildStaticWebAssetsItems)"
Condition="'%(_EmbeddedBuildStaticWebAssetsItems.ResultType)' == 'StaticWebAsset'"
KeepMetadata="@(_StaticWebAssetCanonicalMetadata)" />
<StaticWebAssetDiscoveryPattern
Include="@(_EmbeddedBuildStaticWebAssetsItems)"
Condition="'%(_EmbeddedBuildStaticWebAssetsItems.ResultType)' == 'StaticWebAssetDiscoveryPattern'"
KeepMetadata="@(_StaticWebAssetDiscoveryPatternCanonicalMetadata)" />
</ItemGroup>
</Target>
<Target Name="ResolveEmbeddedConfigurationsPackageAssets"
Condition="'$(ResolveEmbeddedStaticWebAssets)' != 'false'"
DependsOnTargets="ResolveStaticWebAssetsCrossTargetingConfiguration">
<MSBuild
Condition="'@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)' != '' and %(_StaticWebAssetsEmbeddedProjectAssetConfigurations.TargetFramework) != '$(TargetFramework)'"
Targets="GetEmbeddedReferencedPackageAssets"
Properties="%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.GetReferencedEmbeddedAssetsProperties)"
RemoveProperties="%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.GetReferencedEmbeddedAssetsPropertiesToRemove);$(_GlobalPropertiesToRemoveFromProjectReferences)"
Projects="@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="!$(BuildingProject)"
SkipNonexistentTargets="false"
>
<Output TaskParameter="TargetOutputs" ItemName="_EmbeddedBuildStaticWebAssetsItems" />
</MSBuild>
<ItemGroup>
<StaticWebAsset Include="@(_EmbeddedBuildStaticWebAssetsItems)" KeepMetadata="@(_StaticWebAssetCanonicalMetadata)" />
</ItemGroup>
</Target>
<Target Name="GetEmbeddedReferencedPackageAssets" Returns="@(_StaticWebAssetPackageAsset)">
<ItemGroup>
<_StaticWebAssetPackageAsset Include="@(StaticWebAsset)" Condition="'%(StaticWebAsset.SourceType)' == 'Package">
<AssetMergeSource>$(TargetFramework)</AssetMergeSource>
</_StaticWebAssetPackageAsset>
</ItemGroup>
</Target>
<Target Name="ResolveEmbeddedConfigurationsReferencedProjects"
Condition="'$(ResolveEmbeddedStaticWebAssets)' != 'false'"
DependsOnTargets="ResolveStaticWebAssetsCrossTargetingConfiguration">
<MSBuild
Condition="'@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)' != '' and %(_StaticWebAssetsEmbeddedProjectAssetConfigurations.TargetFramework) != '$(TargetFramework)'"
Targets="GetEmbeddedConfigurationReferencedProjects"
Properties="%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.GetReferencedProjectsProperties)"
RemoveProperties="%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.GetReferencedProjectsPropertiesToRemove);$(_GlobalPropertiesToRemoveFromProjectReferences)"
Projects="@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="!$(BuildingProject)"
SkipNonexistentTargets="false"
>
<Output TaskParameter="TargetOutputs" ItemName="_EmbeddedBuildStaticWebAssetProjectReference" />
</MSBuild>
<ItemGroup>
<StaticWebAsset Include="@(_EmbeddedBuildStaticWebAssetProjectReference)" KeepMetadata="@(_StaticWebAssetProjectConfigurationCanonicalMetadata)" />
</ItemGroup>
</Target>
<Target Name="GetEmbeddedConfigurationReferencedProjects"
DependsOnTargets="ResolveReferencedProjectsStaticWebAssetsConfiguration"
Returns="@(StaticWebAssetProjectConfiguration)">
</Target>
<Target Name="ResolveEmbeddedConfigurationReferencedProjectsStaticWebAssets"
DependsOnTargets="ResolveEmbeddedConfigurationsReferencedProjects">
<MSBuild
Condition="'@(StaticWebAssetProjectConfiguration)' != ''"
Targets="%(StaticWebAssetProjectConfiguration.GetBuildAssetsTargets)"
Properties="%(StaticWebAssetProjectConfiguration.AdditionalBuildProperties)"
RemoveProperties="%(StaticWebAssetProjectConfiguration.AdditionalBuildPropertiesToRemove);$(_GlobalPropertiesToRemoveFromProjectReferences)"
Projects="@(StaticWebAssetProjectConfiguration)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="!$(BuildingProject)"
SkipNonexistentTargets="false"
>
<Output TaskParameter="TargetOutputs" ItemName="_ReferencedProjectBuildStaticWebAssetsItems" />
</MSBuild>
<ItemGroup>
<StaticWebAsset
Include="@(_ReferencedProjectBuildStaticWebAssetsItems)"
Condition="'%(_ReferencedProjectBuildStaticWebAssetsItems.ResultType)' == 'StaticWebAsset'"
KeepMetadata="@(_StaticWebAssetCanonicalMetadata)" />
<StaticWebAssetDiscoveryPattern
Include="@(_ReferencedProjectBuildStaticWebAssetsItems)"
Condition="'%(_ReferencedProjectBuildStaticWebAssetsItems.ResultType)' == 'StaticWebAssetDiscoveryPattern'"
KeepMetadata="@(_StaticWebAssetDiscoveryPatternCanonicalMetadata)" />
</ItemGroup>
</Target>
<Target Name="ComputeReferencedProjectsEmbeddedPublishAssets"
Condition="'$(ResolveEmbeddedStaticWebAssets)' != 'false'"
DependsOnTargets="LoadStaticWebAssetsBuildManifest">
<ItemGroup>
<_ProjectConfigurationsWithEmbeddedPublishTargets
Include="@(_StaticWebAssetsEmbeddedProjectAssetConfigurations)"
Condition="'%(_StaticWebAssetsEmbeddedProjectAssetConfigurations.GetEmbeddedPublishAssetsTargets)' != ''" />
</ItemGroup>
<PropertyGroup>
<_HasProjectsWithStaticWebAssetEmbeddedPublishTargets>false</_HasProjectsWithStaticWebAssetEmbeddedPublishTargets>
<_HasProjectsWithStaticWebAssetEmbeddedPublishTargets Condition="'@(_ProjectConfigurationsWithEmbeddedPublishTargets)' != ''">true</_HasProjectsWithStaticWebAssetEmbeddedPublishTargets>
</PropertyGroup>
<MSBuild Condition="$(_HasProjectsWithStaticWebAssetEmbeddedPublishTargets)"
Targets="%(_ProjectConfigurationsWithEmbeddedPublishTargets.GetEmbeddedPublishAssetsTargets)"
Properties="%(_ProjectConfigurationsWithEmbeddedPublishTargets.AdditionalEmbeddedPublishProperties)"
RemoveProperties="%(_ProjectConfigurationsWithEmbeddedPublishTargets.AdditionalEmbeddedPublishPropertiesToRemove);$(_GlobalPropertiesToRemoveFromProjectReferences)"
Projects="@(_ProjectConfigurationsWithEmbeddedPublishTargets)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="!$(BuildingProject)"
SkipNonexistentTargets="false"
>
<Output TaskParameter="TargetOutputs" ItemName="_ReferencedProjectEmbeddedPublishStaticWebAssetsItems" />
</MSBuild>
<ItemGroup Condition="$(_HasProjectsWithStaticWebAssetEmbeddedPublishTargets)">
<StaticWebAsset Remove="@(_ReferencedProjectEmbeddedPublishStaticWebAssetsItems)" />
<StaticWebAsset
Include="@(_ReferencedProjectEmbeddedPublishStaticWebAssetsItems)"
Condition="'%(_ReferencedProjectEmbeddedPublishStaticWebAssetsItems.ResultType)' == 'StaticWebAsset'"
RemoveMetadata="ResultType" />
</ItemGroup>
</Target>
<Target Name="GetCurrentProjectEmbeddedBuildStaticWebAssetItems" DependsOnTargets="ResolveStaticWebAssetsConfiguration" Returns="@(_CachedEmbeddedBuildStaticWebAssetItems)">
<PropertyGroup>
<_ShouldReadEmbeddedBuildManifestAndUpdateItemGroup>false</_ShouldReadEmbeddedBuildManifestAndUpdateItemGroup>
<_ShouldReadEmbeddedBuildManifestAndUpdateItemGroup Condition="@(_CachedEmbeddedBuildStaticWebAssets) == '' and @(_CachedEmbeddedBuildStaticWebAssetDiscoveryPatterns) == ''">true</_ShouldReadEmbeddedBuildManifestAndUpdateItemGroup>
</PropertyGroup>
<ReadStaticWebAssetsManifestFile ManifestPath="$(StaticWebAssetBuildManifestPath)"
Condition="'$(_ShouldReadEmbeddedBuildManifestAndUpdateItemGroup)' == 'true'">
<Output TaskParameter="Assets" ItemName="_CachedEmbeddedBuildStaticWebAssets" />
<Output TaskParameter="DiscoveryPatterns" ItemName="_CachedEmbeddedBuildStaticWebAssetDiscoveryPatterns" />
</ReadStaticWebAssetsManifestFile>
<ComputeStaticWebAssetsForCurrentProject
Assets="@(_CachedEmbeddedBuildStaticWebAssets)"
ProjectMode="$(StaticWebAssetProjectMode)"
AssetKind="Build"
Source="$(PackageId)"
>
<Output TaskParameter="StaticWebAssets" ItemName="_CachedEmbeddedBuildReferencedStaticWebAsset" />
</ComputeStaticWebAssetsForCurrentProject>
<ItemGroup>
<_CachedEmbeddedBuildStaticWebAssetItems Include="@(_CachedEmbeddedBuildReferencedStaticWebAsset)">
<ResultType>StaticWebAsset</ResultType>
</_CachedEmbeddedBuildStaticWebAssetItems>
<_CachedEmbeddedBuildStaticWebAssetItems Include="@(_CachedEmbeddedBuildStaticWebAssetDiscoveryPatterns)">
<ResultType>StaticWebAssetDiscoveryPattern</ResultType>
</_CachedEmbeddedBuildStaticWebAssetItems>
</ItemGroup>
</Target>
<Target Name="GetCurrentProjectEmbeddedPublishStaticWebAssetItems" DependsOnTargets="ResolveStaticWebAssetsConfiguration" Returns="@(_CachedEmbeddedPublishStaticWebAssetItems)">
<PropertyGroup>
<_ShouldReadEmbeddedPublishManifestAndUpdateItemGroup>false</_ShouldReadEmbeddedPublishManifestAndUpdateItemGroup>
<_ShouldReadEmbeddedPublishManifestAndUpdateItemGroup Condition="@(_CachedEmbeddedPublishStaticWebAssets) == '' and @(_CachedEmbeddedPublishStaticWebAssetDiscoveryPatterns) == ''">true</_ShouldReadEmbeddedPublishManifestAndUpdateItemGroup>
</PropertyGroup>
<ReadStaticWebAssetsManifestFile ManifestPath="$(StaticWebAssetPublishManifestPath)"
Condition="'$(_ShouldReadEmbeddedPublishManifestAndUpdateItemGroup)' == 'true'">
<Output TaskParameter="Assets" ItemName="_CachedEmbeddedPublishStaticWebAssets" />
<Output TaskParameter="DiscoveryPatterns" ItemName="_CachedEmbeddedPublishStaticWebAssetDiscoveryPatterns" />
</ReadStaticWebAssetsManifestFile>
<ComputeReferenceStaticWebAssetItems
Assets="@(_CachedEmbeddedPublishStaticWebAssets)"
ProjectMode="$(StaticWebAssetProjectMode)"
AssetKind="Publish"
Source="$(PackageId)"
>
<Output TaskParameter="StaticWebAssets" ItemName="_CachedEmbeddedPublishReferencedStaticWebAsset" />
</ComputeReferenceStaticWebAssetItems>
<ItemGroup>
<_CachedEmbeddedPublishStaticWebassetItems Include="@(_CachedEmbeddedPublishReferencedStaticWebAsset)">
<ResultType>StaticWebAsset</ResultType>
</_CachedEmbeddedPublishStaticWebassetItems>
</ItemGroup>
</Target>
</Project>