forked from dotnet/upgrade-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extensions.targets
105 lines (88 loc) · 5.49 KB
/
Extensions.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
<Project>
<PropertyGroup>
<ExtensionDirectory>extensions\</ExtensionDirectory>
<_IsExtensionHost>$(IsExtensionHost)</_IsExtensionHost>
<_IsExtensionHost Condition=" '$(_IsExtensionHost)' == '' ">false</_IsExtensionHost>
<!-- Because the extensions are not referenced, VS ends up not correctly identifying if incremental builds should be rebuilt -->
<DisableFastUpToDateCheck Condition=" $(_IsExtensionHost) AND '$(BuildingInsideVisualStudio)' == 'true' ">true</DisableFastUpToDateCheck>
</PropertyGroup>
<ItemGroup Condition="$(_IsExtensionHost)">
<ProjectReference Include="@(Extension)">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<Target Name="_VerifyExtensionHostSetIfExtensionsSpecified" BeforeTargets="Build" Condition=" !$(_IsExtensionHost) AND '@(Extension->Count())' != '0'">
<Error Text="If extensions are specified, the property `IsExtensionHost=true` must be set." />
</Target>
<Target Name="_VerifyExtensionHasName" BeforeTargets="VerifyExtensionHostSetIfExtensionsSpecified" Condition="$(_IsExtensionHost)">
<Error Text="Extension %(Extension.Identity) must define a name" Condition=" '%(Extension.Name)' == '' " />
</Target>
<Target Name="AssignExtensionProjectTargetPaths" Condition="$(_IsExtensionHost)" BeforeTargets="AssignTargetPaths">
<ItemGroup>
<Content Include="@(ExtensionFiles)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Message Text="Published extension '%(Extension.Name)' into $(ProjectName) [$(TargetFramework)]" Importance="high" />
</Target>
<Target Name="_FilterExtensionProjectFiles" BeforeTargets="AssignExtensionProjectTargetPaths" Condition="$(_IsExtensionHost)">
<ItemGroup>
<!-- Create a collection of the extension files by their relative path while maintaining metadata -->
<_ExtensionArtifactsByRelativePath Include="%(_AllExtensionProjectFilesContent.OriginalRelativePath)">
<OriginalIdentity>%(Identity)</OriginalIdentity>
<TargetPath>%(TargetPath)</TargetPath>
</_ExtensionArtifactsByRelativePath>
<!-- Remove the host supplied assemblies -->
<_FilteredExtensionArtifactsMinusExclusions Include="@(_ExtensionArtifactsByRelativePath)" Exclude="@(_HostProvidedAssemblies)" />
<!-- Transform the filtered list back to include the appropriate metadata to be added to -->
<ExtensionFiles Include="%(_FilteredExtensionArtifactsMinusExclusions.OriginalIdentity)">
<RelativePath>%(TargetPath)</RelativePath>
<TargetPath>%(TargetPath)</TargetPath>
</ExtensionFiles>
</ItemGroup>
</Target>
<Target Name="_GatherExtensionProjectFiles" BeforeTargets="_FilterExtensionProjectFiles" Condition="$(_IsExtensionHost)">
<ItemGroup>
<_ExtensionProjectReferenceExistent Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.Name)' != '' " />
</ItemGroup>
<MSBuild
Projects="@(_ExtensionProjectReferenceExistent)"
Targets="PublishItemsOutputGroup"
BuildInParallel="$(BuildInParallel)"
Properties="%(_ExtensionProjectReferenceExistent.SetConfiguration); %(_ExtensionProjectReferenceExistent.SetPlatform); %(_ExtensionProjectReferenceExistent.SetTargetFramework)"
Condition="'%(_ExtensionProjectReferenceExistent.Name)' != '' "
ContinueOnError="$(ContinueOnError)"
SkipNonexistentTargets="true"
RemoveProperties="%(_ExtensionProjectReferenceExistent.GlobalPropertiesToRemove)$(_GlobalPropertiesToRemoveFromProjectReferences)">
<Output TaskParameter="TargetOutputs" ItemName="_ExtensionProjectOutput"/>
</MSBuild>
<ItemGroup>
<_AllExtensionProjectFilesContent Include="@(_ExtensionProjectOutput)">
<TargetPath>$(ExtensionDirectory)%(_ExtensionProjectOutput.Name)\%(_ExtensionProjectOutput.TargetPath)</TargetPath>
<OriginalRelativePath>%(_ExtensionProjectOutput.TargetPath)</OriginalRelativePath>
</_AllExtensionProjectFilesContent>
</ItemGroup>
</Target>
<Target Name="_GenerateHostProvidedAssemblies" BeforeTargets="_FilterExtensionProjectFiles">
<ItemGroup>
<_NotHostProvidedAssembly Include="Newtonsoft.Json.dll" />
</ItemGroup>
<!-- Create a list of all assemblies included by host and framework -->
<ItemGroup>
<_HostProvidedAssemblies Include="Microsoft.DotNet.UpgradeAssistant.Abstractions.dll" />
<_HostProvidedAssemblies Include="Microsoft.DotNet.UpgradeAssistant.Abstractions.Internal.dll" />
<_HostProvidedAssemblies Include="System.ComponentModel.Annotations.dll" />
<_HostProvidedAssemblies Include="System.Memory.dll" />
<_HostProvidedAssemblies Include="System.Numerics.Vectors.dll" />
<_HostProvidedAssemblies Include="System.Reflection.Emit.dll" />
<_HostProvidedAssemblies Include="System.Text.Encodings.Web.dll" />
<_HostProvidedAssemblies Include="System.Threading.Tasks.Extensions.dll" />
<_HostProvidedAssemblies Include="%(ReferenceCopyLocalPaths.DestinationSubPath)" />
<_HostProvidedAssemblies Include="%(RuntimeCopyLocalItems.DestinationSubPath)" />
<_HostProvidedAssemblies Remove="@(_NotHostProvidedAssembly)" />
</ItemGroup>
</Target>
<Import Project="$(MSBuildThisFileDirectory)src\common\Microsoft.DotNet.UpgradeAssistant.Abstractions\build\Microsoft.DotNet.UpgradeAssistant.Abstractions.targets" />
</Project>