-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathSwashbuckle.AspNetCore.ReDoc.csproj
More file actions
97 lines (88 loc) · 4.56 KB
/
Swashbuckle.AspNetCore.ReDoc.csproj
File metadata and controls
97 lines (88 loc) · 4.56 KB
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
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyOriginatorKeyFile>Swashbuckle.AspNetCore.ReDoc.snk</AssemblyOriginatorKeyFile>
<Description>Middleware to expose an embedded version of Redoc from an ASP.NET Core application</Description>
<EnableAotAnalyzer>true</EnableAotAnalyzer>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsAotCompatible>true</IsAotCompatible>
<IsPackable>true</IsPackable>
<NoWarn>$(NoWarn);1591</NoWarn>
<PackageTags>swagger;openapi;documentation;discovery;help;webapi;aspnet;aspnetcore;redoc</PackageTags>
<SignAssembly>true</SignAssembly>
<TargetFrameworks>$(DefaultTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<None Remove="index.css" />
<None Remove="index.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="index.css" />
<EmbeddedResource Include="index.html" />
<EmbeddedResource Include="index.js" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="All" />
<AdditionalFiles Include="PublicAPI\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\PublicAPI.Unshipped.txt" />
</ItemGroup>
<PropertyGroup>
<_TargetFrameworkIdentifier>$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)'))</_TargetFrameworkIdentifier>
</PropertyGroup>
<ItemGroup Condition="Exists('PublicAPI\$(_TargetFrameworkIdentifier)')">
<AdditionalFiles Include="PublicAPI\$(_TargetFrameworkIdentifier)\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\$(_TargetFrameworkIdentifier)\PublicAPI.Unshipped.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Shared\EmbeddedResourceProvider.cs" Link="EmbeddedResourceProvider.cs" />
</ItemGroup>
<Target Name="NpmInstall" BeforeTargets="DispatchToInnerBuilds" Condition=" ('$(CI)' != '' OR !Exists('$(MSBuildThisFileDirectory)\node_modules')) AND '$(IsDependabotJob)' != 'true' ">
<Exec Command="npm ci" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js/npm is required to build this project." />
</Target>
<!-- Embed the ReDoc version into the [AssemblyMetadata] attributes -->
<UsingTask TaskName="GetReDocVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<PackageJsonPath ParameterType="System.String" Required="true" />
<ReDocVersion ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs"><![CDATA[
var packageJson = System.IO.File.ReadAllText(PackageJsonPath);
var pattern = @"""redoc"":\s*""([^""]+)""";
var match = System.Text.RegularExpressions.Regex.Match(packageJson, pattern);
ReDocVersion = match.Groups[1].Value;
]]></Code>
</Task>
</UsingTask>
<Target Name="AddCustomAssemblyMetadata" BeforeTargets="GetAssemblyAttributes">
<GetReDocVersion PackageJsonPath="$(MSBuildThisFileDirectory)\package.json">
<Output TaskParameter="ReDocVersion" PropertyName="ReDocVersion" />
</GetReDocVersion>
<ItemGroup>
<AssemblyMetadata Include="ReDocVersion" Value="$(ReDocVersion)" />
</ItemGroup>
</Target>
<!-- Embed compressed file using SDK task-->
<PropertyGroup>
<_SdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">net11.0</_SdkTasksTFM>
<_SdkTasksTFM Condition=" '$(MSBuildRuntimeType)' != 'Core'">net472</_SdkTasksTFM>
</PropertyGroup>
<UsingTask TaskName="Microsoft.NET.Sdk.BlazorWebAssembly.GzipCompress" AssemblyFile="$(MicrosoftNETBuildTasksDirectoryRoot)../../Microsoft.NET.Sdk.BlazorWebAssembly/tools/$(_SdkTasksTFM)/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.dll" />
<ItemGroup>
<CompressFiles Include="node_modules/redoc/bundles/redoc.standalone.js" />
</ItemGroup>
<Target Name="_CompressAssets" BeforeTargets="CheckForDuplicateItems" Condition=" '$(IsDependabotJob)' != 'true' ">
<GZipCompress FilesToCompress="@(CompressFiles)" OutputDirectory="$(IntermediateOutputPath)CompressedAssets">
<Output TaskParameter="CompressedFiles" ItemName="_CompressedAssetsFile" />
</GZipCompress>
<ItemGroup>
<EmbeddedResource Include="@(_CompressedAssetsFile)" />
<EmbeddedResource Condition=" '%(EmbeddedResource.OriginalItemSpec)' != '' " Link="%(EmbeddedResource.OriginalItemSpec)" />
</ItemGroup>
</Target>
</Project>