forked from cloudfoundry-attic/cf-windows-extensions
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.proj
150 lines (120 loc) · 6.96 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Available Targets:
/t:Clean
Removes temporary build outputs.
/t:Build
Builds assemblies.
/t:UnitTest
Runs unit tests
/t:IntegrationTest
Runs integration tests
/t:RestoreNugetPackages
Restores nuget packages
-->
<PropertyGroup>
<ExtensionTasksPath Condition="'$(ExtensionTasksPath)' == ''">$(SolutionDir)\packages\MSBuild.Extension.Pack.1.5.0\tools\net40\</ExtensionTasksPath>
</PropertyGroup>
<PropertyGroup>
<LibraryRoot>$(MSBuildThisFileDirectory)</LibraryRoot>
<LibrarySourceFolder>$(LibraryRoot)\src</LibrarySourceFolder>
<WindowsExtensionsSolution>windows-extensions-installer.sln</WindowsExtensionsSolution>
<PackageOutputDir>$(BinariesFolder)\packages</PackageOutputDir>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
</PropertyGroup>
<PropertyGroup>
<major>1</major>
<minor>3</minor>
<revision>0</revision>
<build Condition="'$(BUILD_NUMBER)' == ''">0</build>
<build Condition="'$(BUILD_NUMBER)' != ''">$(BUILD_NUMBER)</build>
<commit Condition="'$(GIT_COMMIT)' == ''">?</commit>
<commit Condition="'$(GIT_COMMIT)' != ''">$(GIT_COMMIT)</commit>
<version>$(major).$(minor).$(revision).$(build)</version>
</PropertyGroup>
<PropertyGroup>
<NuGetCommand>"$(LibraryRoot)\.nuget\nuget.exe"</NuGetCommand>
<MSTestCommand>"$(VS120COMNTOOLS)\..\IDE\mstest.exe"</MSTestCommand>
<VSTestCommand>"$(VS120COMNTOOLS)\..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"</VSTestCommand>
<CoverageCommand>"$(VS120COMNTOOLS)\..\..\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe"</CoverageCommand>
<ExtensionTasksPath>$(LibraryRoot)\packages\MSBuild.Extension.Pack.1.5.0\tools\net40\</ExtensionTasksPath>
<ReportGeneratorCommand>$(LibraryRoot)\packages\ReportGenerator.2.1.3.0\ReportGenerator.exe</ReportGeneratorCommand>
<CoverageXml>$(LibraryRoot)\TestResults\cf-windows-extensions.coveragexml</CoverageXml>
<CoverageHtmlDir>$(LibraryRoot)\TestResults\coveragehtml</CoverageHtmlDir>
<TestFilter>TestCategory=Unit</TestFilter>
<IntegrationTestFilter>TestCategory=Integration</IntegrationTestFilter>
</PropertyGroup>
<!-- Import msbuild extensions -->
<Import Project="$(ExtensionTasksPath)MSBuild.ExtensionPack.tasks" Condition="exists('$(ExtensionTasksPath)')"/>
<!-- Build target -->
<Target Name="Build" DependsOnTargets="RestoreNugetPackages; Versioning">
<MSBuild Projects="$(WindowsExtensionsSolution)"
Properties="Configuration=$(Configuration);Platform=x64;"
Targets="Build" />
</Target>
<!-- Clean target -->
<Target Name="Clean" DependsOnTargets="RestoreNugetPackages">
<MSBuild Projects="$(WindowsExtensionsSolution)"
Properties="Configuration=$(Configuration);Platform=x64"
Targets="Clean" />
</Target>
<!-- Target for running integration tests-->
<Target Name="IntegrationTest">
<ItemGroup>
<TestDlls Include=".\bin\CloudFoundry.Test.Integration.dll"/>
<ConfigFile Include=".\bin\CloudFoundry.Test.Integration.dll.config"/>
</ItemGroup>
<Warning Text="The nats property not set, value from app.config will be used." Condition="'$(nats)' == ''" />
<Message Text="Updating config file at %(ConfigFile.Identity)" />
<XmlPoke Condition="'$(nats)' != ''" XmlInputPath="%(ConfigFile.Identity)" Query="/configuration/appSettings/add[@key='nats']/@value" Value="$(nats)"/>
<Exec Command="$(VSTestCommand) %(TestDlls.Identity) /inIsolation /TestCaseFilter:$(IntegrationTestFilter) /logger:trx /Platform:x64 /Framework:framework40 /Settings:CodeCoverage.runsettings" ConsoleToMSBuild="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfTestRun" />
</Exec>
</Target>
<!-- Target for running unit tests with code coverage-->
<Target Name="UnitTest">
<ItemGroup>
<TestDlls Include=".\bin\CloudFoundry.Test.dll"/>
</ItemGroup>
<Exec Command="$(VSTestCommand) %(TestDlls.Identity) /inIsolation /TestCaseFilter:$(TestFilter) /logger:trx /Platform:x64 /Framework:framework40 /Enablecodecoverage /Settings:CodeCoverage.runsettings" ConsoleToMSBuild="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfTestRun" />
</Exec>
<!-- Use the VSTest output to discover the Results & Coverage files respectively -->
<PropertyGroup>
<!-- Unencoded Regex: (?<=(Results file: )).*?(?=\;)|(?<=(Attachments:;)).*?(?=\;) -->
<ResultsFileRegexPattern>(?<=(Results File: )).*.trx</ResultsFileRegexPattern>
<CoverageFileRegexPattern>(?<=(Attachments:;)).*.coverage</CoverageFileRegexPattern>
<SourceResultsFile>$([System.Text.RegularExpressions.Regex]::Match($(OutputOfTestRun), $(ResultsFileRegexPattern)))</SourceResultsFile>
<SourceCoverageFile>$([System.Text.RegularExpressions.Regex]::Match($(OutputOfTestRun), $(CoverageFileRegexPattern)))</SourceCoverageFile>
</PropertyGroup>
<Delete Files="$(CoverageXml)" />
<Message Text="Analysing coverage file $(SourceCoverageFile)"/>
<Exec Command="$(CoverageCommand) analyze /output:"$(CoverageXml)" "$(SourceCoverageFile)"" />
<Message Text="Generating html coverage report"/>
<MakeDir Directories="$(CoverageHtmlDir)"/>
<Exec Command="$(ReportGeneratorCommand) -reports:"$(CoverageXml)" -targetdir:"$(CoverageHtmlDir)"" />
</Target>
<!-- Target for restoring nuget packages -->
<Target Name="RestoreNugetPackages">
<Exec Command="$(NuGetCommand) restore $(WindowsExtensionsSolution)"/>
</Target>
<!-- Target for automatically versioning the assemblies -->
<Target Name="Versioning">
<Message Text="Version: $(version)" />
<ItemGroup>
<AssemblyInfoFiles Include="$(LibraryRoot)\src\CloudFoundry.AspDotNetLogging\Properties\AssemblyInfo.cs"/>
<AssemblyInfoFiles Include="$(LibraryRoot)\src\CloudFoundry.Configuration\Properties\AssemblyInfo.cs"/>
<AssemblyInfoFiles Include="$(LibraryRoot)\src\CloudFoundry.NatsClient\Properties\AssemblyInfo.cs"/>
<AssemblyInfoFiles Include="$(LibraryRoot)\src\CloudFoundry.Utilities\Properties\AssemblyInfo.cs"/>
<AssemblyInfoFiles Include="$(LibraryRoot)\src\CloudFoundry.WinDEA\Properties\AssemblyInfo.cs"/>
<AssemblyInfoFiles Include="$(LibraryRoot)\src\CloudFoundry.WinDEA.DirectoryServer\Properties\AssemblyInfo.cs"/>
<AssemblyInfoFiles Include="$(LibraryRoot)\src\CloudFoundry.WinDEA.WindowsService\Properties\AssemblyInfo.cs"/>
</ItemGroup>
<MSBuild.ExtensionPack.Framework.AssemblyInfo AssemblyInfoFiles="@(AssemblyInfoFiles)"
AssemblyVersion="$(version)"
AssemblyFileVersion="$(version)" />
</Target>
</Project>