-
Notifications
You must be signed in to change notification settings - Fork 0
/
CI-build.msbuild
55 lines (46 loc) · 2.28 KB
/
CI-build.msbuild
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
<Project DefaultTargets="Deploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<RootDir>$(MSBuildProjectDirectory)</RootDir>
<TestBuildDir>$(RootDir)\LibGit2Sharp.Tests\bin\$(Configuration)</TestBuildDir>
<DeployFolder>$(RootDir)\Build</DeployFolder>
</PropertyGroup>
<UsingTask AssemblyFile="$(MSBuildProjectDirectory)/Lib/xUnit/xunit.runner.msbuild.dll"
TaskName="Xunit.Runner.MSBuild.xunit" />
<Target Name="Clean">
<Message Text="Commit SHA = $(CommitSha)" />
<WriteLinesToFile Condition="'$(CommitSha)' != ''"
File="$(RootDir)\LibGit2Sharp\libgit2sharp_hash.txt"
Lines="$(CommitSha)"
Overwrite="true" />
<!-- Workaround for xbuild -->
<Exec Condition=" ('$(OS)' != 'Windows_NT') " Command=" rm -r -f $(DeployFolder) " />
<Exec Condition=" ('$(OS)' != 'Windows_NT') " Command=" rm -r -f $(TestBuildDir) " />
<RemoveDir Directories="$(DeployFolder)" Condition="Exists('$(DeployFolder)')" />
<RemoveDir Directories="$(TestBuildDir)" Condition="Exists('$(TestBuildDir)')" />
</Target>
<Target Name="Init" DependsOnTargets="Clean">
<MakeDir Directories="$(DeployFolder)" />
</Target>
<Target Name="Build" DependsOnTargets="Init">
<MSBuild
Projects="LibGit2Sharp.sln"
Targets="Build"
Properties="Configuration=$(Configuration);TrackFileAccess=false" />
</Target>
<Target Name="Test" DependsOnTargets="Build">
<xunit Assembly="$(TestBuildDir)/LibGit2Sharp.Tests.dll" Xml="$(DeployFolder)/Test-result.xml" />
</Target>
<Target Name="Deploy" DependsOnTargets="Test">
<CreateItem Include="$(TestBuildDir)\LibGit2*.*">
<Output TaskParameter="Include" ItemName="OutputFiles" />
</CreateItem>
<Copy SourceFiles="@(OutputFiles)"
DestinationFiles="@(OutputFiles->'$(DeployFolder)\%(RecursiveDir)%(Filename)%(Extension)')" />
<CreateItem Include="$(TestBuildDir)\NativeBinaries\**\*.*">
<Output TaskParameter="Include" ItemName="NativeBinaries" />
</CreateItem>
<Copy SourceFiles="@(NativeBinaries)"
DestinationFiles="@(NativeBinaries->'$(DeployFolder)\NativeBinaries\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
</Target>
</Project>