-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.proj
83 lines (75 loc) · 3.45 KB
/
build.proj
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
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="BuildAndPublish" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ToolsPath>$(MSBuildThisFileDirectory)\tools\</ToolsPath>
<XunitPath>$(ToolsPath)xunit\</XunitPath>
<BUILDTEMP Condition=" '$(BUILDTEMP)'=='' ">$(MSBuildThisFileDirectory)\publishOutput</BUILDTEMP>
<SOURCE Condition=" '$(SOURCE)'=='' ">$(MSBuildThisFileDirectory)\</SOURCE>
<SolutionDir>$(MSBuildThisFileDirectory)\</SolutionDir>
<OutputPath>$(MSBuildThisFileDirectory)\BuildOutput\</OutputPath>
<TestOutputPath>$(MSBuildThisFileDirectory)\TestBuildOutput\</TestOutputPath>
<TestResultsPath>$(MSBuildThisFileDirectory)\TestResultsOutput\</TestResultsPath>
<DeployTarget Condition=" '$(DeployTarget)'=='' ">$(MSBuildThisFileDirectory)\TargetOutput</DeployTarget>
</PropertyGroup>
<UsingTask AssemblyFile="$(XunitPath)xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit" />
<!-- TARGET: BuildAndPublish-->
<!-- property groups-->
<PropertyGroup>
<BuildAndPublishDependsOn>BuildProjects;ExecuteTests;Publish</BuildAndPublishDependsOn>
</PropertyGroup>
<!-- task definition-->
<Target Name="BuildAndPublish" DependsOnTargets="$(BuildAndPublishDependsOn)"/>
<!-- TARGET: Prepare for build-->
<Target Name="PrepareForBuild">
<MakeDir Directories="$(OutputPath)" />
<MakeDir Directories="$(TestOutputPath)" />
</Target>
<!-- TARGET: build projects-->
<!-- item groups-->
<ItemGroup>
<ProjectsToBuild Include="$(MSBuildThisFileDirectory)\MvcApp\MvcApp.csproj"/>
<TestProjects Include="$(MSBuildThisFileDirectory)\FunctionalTests\FunctionalTests.csproj"/>
</ItemGroup>
<!-- property groups-->
<PropertyGroup>
<BuildProjectDependsOn>PrepareForBuild</BuildProjectDependsOn>
</PropertyGroup>
<!-- target definition-->
<Target Name ="BuildProjects" DependsOnTargets="$(BuildProjectDependsOn)">
<MSBuild Projects="@(ProjectsToBuild)"
Targets="pipelinePreDeployCopyAllFilesToOneFolder"
Properties="OutDir=$(BUILDTEMP)\;SolutionDir=$(SOURCE)"
/>
<MSBuild Projects="@(TestProjects)"
Properties="OutDir=$(TestOutputPath);SolutionDir=$(SOURCE)" />
</Target>
<!-- TARGET: ExecuteTests-->
<!-- property groups-->
<PropertyGroup>
<ExecuteTestsDependsOn>BuildProjects</ExecuteTestsDependsOn>
</PropertyGroup>
<!-- target definition-->
<Target Name="ExecuteTests" DependsOnTargets="$(ExecuteTestsDependsOn)">
<ItemGroup>
<_AssembliesToTest Include="$(TestOutputPath)\\*.dll;$(TestOutputPath)\\*.exe;" />
</ItemGroup>
<Delete Files="$(TestResultsPath)\FunctionalTests.XunitResults.%(_AssembliesToTest.Filename).xml"></Delete>
<MakeDir Directories="$(TestResultsPath)\" />
<xunit Assembly="@(_AssembliesToTest)"
Xml="$(TestResultsPath)\FunctionalTests.XunitResults.%(_AssembliesToTest.Filename).xml"
Verbose="true" />
</Target>
<!-- TARGET: Publish-->
<!-- property groups-->
<PropertyGroup>
<PublishDependsOn>ExecuteTests</PublishDependsOn>
</PropertyGroup>
<!-- target definition-->
<Target Name="Publish" DependsOnTargets="$(PublishDependsOn)">
<ItemGroup>
<FilesToCopy Include="$(BUILDTEMP)\_PublishedWebsites\MvcApp\**\*.*"/>
</ItemGroup>
<Copy SourceFiles="@(FilesToCopy)"
DestinationFiles="@(FilesToCopy->'$(DeployTarget)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
</Project>