forked from microsoft/xunit-performance
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxunit.performance.msbuild
135 lines (116 loc) · 6.14 KB
/
xunit.performance.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
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
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<UsingTask
AssemblyFile="packages\xunit.buildtasks\tools\CodePlex.MSBuildTasks.dll"
TaskName="CodePlex.MSBuildTasks.RegexReplace"/>
<!-- Settings -->
<PropertyGroup>
<SolutionName Condition="'$(SolutionName)' == ''">xunit.performance.sln</SolutionName>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<TrackFileAccess>false</TrackFileAccess>
<SolutionDir Condition="'$(SolutionDir)' == '' Or '$(SolutionDir)' == '*Undefined*'">$(MSBuildProjectDirectory)</SolutionDir>
<NuGetExePath Condition="'$(NuGetExePath)' == ''">$(SolutionDir)\.nuget\nuget.exe</NuGetExePath>
<RequestedVerbosity Condition=" '$(RequestedVerbosity)' == '' ">normal</RequestedVerbosity>
<NugetPackageOutputDirectory Condition="'$(NugetPackageOutputDirectory)' == ''">LocalPackages</NugetPackageOutputDirectory>
</PropertyGroup>
<ItemGroup>
<NuspecFiles Include="src\*.nuspec" />
<ProjectJsonFiles Include="src\*\project.json" />
<ProjectJsonFiles Include="dnx\*\*\project.json" />
</ItemGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="http://www.myget.org/F/b4ff5f68eccf4f6bbfed74f055f88d8f/" />
</ItemGroup>
<!-- Build server targets -->
<Target Name="CI" DependsOnTargets="Clean;PackageRestore;Build;Test;Packages" />
<Target Name="Nightly" DependsOnTargets="Clean;PackageRestore;SetVersionNumber;Build;Test;Packages" />
<Target Name="DevBuild" DependsOnTargets="Clean;PackageRestore;Build;Packages" />
<!-- Individual targets -->
<Target Name="Test">
<ItemGroup>
<!-- For now this is the only unit test assembly we have. If/when we add more, we should
come up with convention so that they can be discovered automatically without editing
this file. -->
<TestAssemblies Include="Samples\SimplePerfTests\bin\$(Configuration)\SimplePerfTests.dll" />
</ItemGroup>
<Exec Command="packages\xunit.runner.console.2.1.0\tools\xunit.console.exe @(TestAssemblies, ' ')" />
</Target>
<Target Name="Clean">
<ItemGroup>
<CleanFileList Include="*.html;*.xml;.nuget\NuGet.exe"/>
</ItemGroup>
<MSBuild
Projects="$(SolutionName)"
Targets="Clean"
Properties="Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess)"/>
<Delete Files="@(CleanFileList)"/>
<RemoveDir Directories="@(CleanFolderList)" ContinueOnError="true"/>
<RemoveDir Directories="$(NugetPackageOutputDirectory)" ContinueOnError="true"/>
</Target>
<Target Name="PackageRestore" DependsOnTargets="_DownloadNuGet">
<Message Text="Restoring NuGet packages..." Importance="High" />
<Exec Command=""$(NuGetExePath)" install xunit.buildtasks -Source @(PackageSource) -SolutionDir "$(SolutionDir)" -Verbosity quiet -ExcludeVersion" Condition="!Exists('$(SolutionDir)\packages\xunit.buildtasks\')" />
<Exec Command=""$(NuGetExePath)" restore "$(SolutionDir)\$(SolutionName)" -NonInteractive -Source @(PackageSource) -Verbosity quiet" />
</Target>
<Target Name="Build" DependsOnTargets="PackageRestore">
<MSBuild
Projects="$(SolutionName)"
Targets="Build"
Properties="Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess)"/>
</Target>
<Target Name="SetVersionNumber">
<RegexReplace
Pattern='AssemblyVersion\("99\.99\.99\.0"\)'
Replacement='AssemblyVersion("$(BuildAssemblyVersion)")'
Files='src\common\GlobalAssemblyInfo.cs'
Condition=" '$(BuildAssemblyVersion)' != '' "/>
<RegexReplace
Pattern='AssemblyInformationalVersion\("99\.99\.99-dev"\)'
Replacement='AssemblyInformationalVersion("$(BuildSemanticVersion)")'
Files='src\common\GlobalAssemblyInfo.cs'
Condition=" '$(BuildSemanticVersion)' != '' "/>
<RegexReplace
Pattern='"99\.99\.99-dev"'
Replacement='"$(BuildSemanticVersion)"'
Files='@(ProjectJsonFiles)'
Condition=" '$(BuildSemanticVersion)' != '' "/>
</Target>
<Target Name='Packages'>
<Message Text="Creating NuGet packages..." Importance="High" />
<MakeDir Directories="$(NugetPackageOutputDirectory)" />
<Exec Condition="'$(BuildSemanticVersion)' == ''" Command='"$(NuGetExePath)" pack %(NuspecFiles.Identity) -OutputDirectory $(NugetPackageOutputDirectory) -NoPackageAnalysis -NonInteractive -Verbosity quiet -Properties Configuration=$(Configuration)' />
<Exec Condition="'$(BuildSemanticVersion)' != ''" Command='"$(NuGetExePath)" pack %(NuspecFiles.Identity) -OutputDirectory $(NugetPackageOutputDirectory) -Version $(BuildSemanticVersion) -NoPackageAnalysis -NonInteractive -Verbosity quiet -Properties Configuration=$(Configuration)' />
</Target>
<Target Name="_DownloadNuGet">
<MakeDir Directories="$(SolutionDir)\.nuget" />
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition="!Exists('$(NuGetExePath)')" />
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("http://dist.nuget.org/win-x86-commandline/v3.1.0-beta/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>