|
18 | 18 | <Compile Remove="**/*.cs" /> |
19 | 19 | </ItemGroup> |
20 | 20 |
|
| 21 | + <!-- Specify runtime identifier--> |
21 | 22 | <PropertyGroup Condition="'$(RuntimeIdentifier)' == ''"> |
22 | 23 | <RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(PlatformTarget)' != 'x86'">win-x64</RuntimeIdentifier> |
23 | 24 | <RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(PlatformTarget)' == 'x86'">win-x86</RuntimeIdentifier> |
24 | 25 | <RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx</RuntimeIdentifier> |
25 | 26 | <RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux-x64</RuntimeIdentifier> |
26 | 27 | </PropertyGroup> |
27 | 28 |
|
| 29 | + <PropertyGroup> |
| 30 | + <InstallYetAnotherHttpHandler Condition="'$(InstallYetAnotherHttpHandler)' == ''">true</InstallYetAnotherHttpHandler> |
| 31 | + </PropertyGroup> |
| 32 | + |
| 33 | + <!-- Specify what version (commit tag) of YetAnotherHttpHandler to install--> |
| 34 | + <PropertyGroup Condition="'$(YetAnotherHttpHandlerVersion)' == ''"> |
| 35 | + <YetAnotherHttpHandlerVersion>1.10.0</YetAnotherHttpHandlerVersion> |
| 36 | + </PropertyGroup> |
| 37 | + |
28 | 38 | <!-- Specify NuGet dependencies --> |
29 | 39 | <ItemGroup> |
30 | 40 | <PackageReference Include="Grpc.Tools" Version="2.69.0 "> |
|
42 | 52 | <Protobuf Include="Runtime/GrpcInterface/*.proto" OutputDir="$(ProjectDir)" GrpcServices="Client" /> |
43 | 53 | </ItemGroup> |
44 | 54 |
|
45 | | - <!-- Copy binaries to 'Dependencies' and delete everything else after build--> |
46 | | - <Target Name="CopyDependencies" AfterTargets="AfterBuild"> |
| 55 | + <!-- Copy NuGet binaries to 'Dependencies/NuGetDependencies'--> |
| 56 | + <Target Name="CopyNuGetDependencies" AfterTargets="AfterBuild"> |
47 | 57 | <ItemGroup> |
48 | | - <OutputFiles Include="$(OutDir)\*.*"/> |
| 58 | + <OutputFiles Include="$(OutDir)/*.*"/> |
49 | 59 | </ItemGroup> |
| 60 | + <Copy SourceFiles="@(OutputFiles)" DestinationFolder="./Dependencies/NuGetDependencies/$(RuntimeIdentifier)" SkipUnchangedFiles="true"/> |
| 61 | + </Target> |
| 62 | + |
| 63 | + <!-- Delete build artifacts--> |
| 64 | + <Target Name="DeleteBuildArtifacts" AfterTargets="AfterBuild" DependsOnTargets="CopyNuGetDependencies"> |
50 | 65 | <ItemGroup> |
51 | | - <BuildArtifacts Include=".\obj\"/> |
52 | | - <BuildArtifacts Include=".\bin\"/> |
| 66 | + <BuildArtifacts Include="./obj/"/> |
| 67 | + <BuildArtifacts Include="./bin/"/> |
53 | 68 | </ItemGroup> |
54 | | - |
55 | | - <Copy SourceFiles="@(OutputFiles)" DestinationFolder=".\Dependencies\$(RuntimeIdentifier)" SkipUnchangedFiles="true"/> |
56 | 69 | <RemoveDir Directories="@(BuildArtifacts)"/> |
57 | 70 | </Target> |
| 71 | + |
| 72 | + <!-- Download YetAnotherHttpHandler from GitHub and copy into Dependencies directory--> |
| 73 | + <Target Name="InstallYetAnotherHttpHandler" AfterTargets="AfterBuild" Condition="'$(InstallYetAnotherHttpHandler)' == 'true'"> |
| 74 | + <Exec Command="git clone --no-checkout --depth=1 --filter=tree:0 https://github.com/Cysharp/YetAnotherHttpHandler tmp" ConsoleToMSBuild="true" WorkingDirectory="Dependencies"/> |
| 75 | + <Exec Command="git sparse-checkout set --no-cone /src/YetAnotherHttpHandler" ConsoleToMSBuild="true" WorkingDirectory="Dependencies/tmp"/> |
| 76 | + <Exec Command="git checkout $(YetAnotherHttpHandlerVersion)" ConsoleToMSBuild="true" WorkingDirectory="Dependencies/tmp"/> |
| 77 | + <ItemGroup> |
| 78 | + <PackageFiles Include="Dependencies/tmp/src/YetAnotherHttpHandler/**/*.*"/> |
| 79 | + </ItemGroup> |
| 80 | + <Copy SourceFiles="@(PackageFiles)" DestinationFolder="Dependencies/YetAnotherHttpHandler/%(RecursiveDir)"/> |
| 81 | + <RemoveDir Directories="Dependencies/tmp"/> |
| 82 | + </Target> |
58 | 83 | </Project> |
0 commit comments