forked from dotnet/sdk
/
Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj
126 lines (104 loc) · 5.76 KB
/
Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj
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
<Project>
<PropertyGroup>
<StaticWebAssetsSdkRoot>$(RepoRoot)\src\StaticWebAssetsSdk\</StaticWebAssetsSdkRoot>
<PackageId>Microsoft.NET.Sdk.StaticWebAssets</PackageId>
<OutDirName>$(Configuration)\Sdks\$(PackageId)\tasks</OutDirName>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OutputType>Library</OutputType>
<EnableDefaultItems>false</EnableDefaultItems>
<GenerateDependencyFile>false</GenerateDependencyFile>
<IncludeBuildOutput>false</IncludeBuildOutput>
<NoPackageAnalysis>true</NoPackageAnalysis>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CopyLocalLockFileAssemblies Condition="'$(TargetFramework)'!='net472'">false</CopyLocalLockFileAssemblies>
<!-- MSBuild Task DLLs need to be versioned with every build -->
<AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
<OutputPath>$(BaseOutputPath)</OutputPath>
<IsPackable>true</IsPackable>
<PackageLayoutOutputPath>$(ArtifactsBinDir)$(Configuration)\Sdks\$(PackageId)\</PackageLayoutOutputPath>
<NoDefaultExcludes>true</NoDefaultExcludes>
</PropertyGroup>
<PropertyGroup>
<Description>SDK for building and publishing applications containing static web assets.</Description>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.NET.Sdk.StaticWebAssets</RootNamespace>
<TargetFrameworks>$(SdkTargetFramework);net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="Runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="Runtime" />
<PackageReference Include="System.Reflection.Metadata" Condition="'$(TargetFramework)'=='net472'" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)'=='net472'" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" />
<PackageReference Include="Microsoft.Css.Parser" />
</ItemGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<AdditionalContent Include="$(StaticWebAssetsSdkRoot)Targets\**\*.*">
<Pack>true</Pack>
<PackagePath>targets</PackagePath>
</AdditionalContent>
<AdditionalContent Include="$(StaticWebAssetsSdkRoot)Sdk\**\*.*">
<Pack>true</Pack>
<PackagePath>Sdk</PackagePath>
</AdditionalContent>
</ItemGroup>
<ItemDefinitionGroup>
<PackageReference>
<PrivateAssets>All</PrivateAssets>
<Publish>true</Publish>
</PackageReference>
</ItemDefinitionGroup>
<Target Name="CopyFileSystemGlobbing" BeforeTargets="PrepareAdditionalFilesToLayout" AfterTargets="ResolveReferences" Condition="'$(TargetFramework)' == '$(SdkTargetFramework)'">
<ItemGroup>
<_FileSystemGlobbing Include="@(ReferencePath)" Condition="'%(ReferencePath.NuGetPackageId)' == 'Microsoft.Extensions.FileSystemGlobbing'" />
<_FileSystemGlobbingContent Include ="@(_FileSystemGlobbing)" TargetPath="tasks\$(SdkTargetFramework)\%(_FileSystemGlobbing.Filename)%(_FileSystemGlobbing.Extension)" />
<AdditionalContent Include="@(_FileSystemGlobbing)" PackagePath="tasks\$(SdkTargetFramework)" />
</ItemGroup>
<Copy SourceFiles="@(_FileSystemGlobbingContent)" DestinationFiles="@(_FileSystemGlobbingContent->'$(PackageLayoutOutputPath)%(TargetPath)')">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<Target Name="CopyCssParser" BeforeTargets="PrepareAdditionalFilesToLayout" AfterTargets="ResolveReferences" Condition="'$(TargetFramework)' == '$(SdkTargetFramework)'">
<ItemGroup>
<_CssParser Include="@(ReferencePath)" Condition="'%(ReferencePath.NuGetPackageId)' == 'Microsoft.Css.Parser'" />
<_CssParserContent Include ="@(_CssParser)" TargetPath="tasks\$(SdkTargetFramework)\%(_CssParser.Filename)%(_CssParser.Extension)" />
<AdditionalContent Include="@(_CssParser)" PackagePath="tasks\$(SdkTargetFramework)" />
</ItemGroup>
<Copy SourceFiles="@(_CssParserContent)" DestinationFiles="@(_CssParserContent->'$(PackageLayoutOutputPath)%(TargetPath)')">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<Target Name="PrepareAdditionalFilesToLayout" BeforeTargets="AssignTargetPaths">
<ItemGroup>
<LayoutFile Include="@(AdditionalContent)" Condition="'%(AdditionalContent.PackagePath)' != '' and '%(AdditionalContent.PackagePath)' != 'Icon.png'">
<TargetPath>%(AdditionalContent.PackagePath)\%(AdditionalContent.RecursiveDir)%(AdditionalContent.Filename)%(AdditionalContent.Extension)</TargetPath>
</LayoutFile>
</ItemGroup>
</Target>
<Target Name="CopyAdditionalFilesToLayout"
DependsOnTargets="PrepareAdditionalFilesToLayout"
AfterTargets="Build" Inputs="@(LayoutFile)"
Outputs="@(LayoutFile->'$(PackageLayoutOutputPath)%(TargetPath)')">
<Copy SourceFiles="@(LayoutFile)" DestinationFiles="@(LayoutFile->'$(PackageLayoutOutputPath)%(TargetPath)')">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<Target Name="PackLayout" DependsOnTargets="CopyAdditionalFilesToLayout" BeforeTargets="$(GenerateNuspecDependsOn)">
<Message Importance="high" Text="Packing assets at $(PackageLayoutOutputPath)" />
<ItemGroup>
<Content Include="$(PackageLayoutOutputPath)**\*" PackagePath="\" />
</ItemGroup>
</Target>
<!-- Global usings -->
<!-- See: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#using -->
<ItemGroup>
<!-- This causes conflicts with System.Threading.Tasks.Task. Giving it an alias to avoid the conflict. -->
<Using Include="Microsoft.Build.Utilities.Task" Alias="Task" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>