This repository has been archived by the owner on May 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
xunit.extensions.proj
137 lines (117 loc) · 6.4 KB
/
xunit.extensions.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
<Project DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<UsingTask
AssemblyFile="packages\xunit.buildtasks\tools\CodePlex.MSBuildTasks.dll"
TaskName="CodePlex.MSBuildTasks.RegexReplace"/>
<UsingTask
AssemblyFile="packages\xunit.buildtasks\tools\CodePlex.MSBuildTasks.dll"
TaskName="CodePlex.MSBuildTasks.Zip"/>
<!-- Settings -->
<PropertyGroup>
<SolutionName Condition="'$(SolutionName)' == ''">xUnit.Extensions.sln</SolutionName>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
<ParallelizeTests Condition="'$(ParallelizeTests)' == ''">true</ParallelizeTests>
<MaxParallelThreads Condition="'$(MaxParallelThreads)' == ''">0</MaxParallelThreads>
<TrackFileAccess>false</TrackFileAccess>
<SolutionDir Condition="'$(SolutionDir)' == '' Or '$(SolutionDir)' == '*Undefined*'">$(MSBuildProjectDirectory)</SolutionDir>
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(SolutionDir)\.nuget\nuget.exe</NuGetExePath>
<RequestedVerbosity Condition=" '$(RequestedVerbosity)' == '' ">normal</RequestedVerbosity>
</PropertyGroup>
<ItemGroup>
<NuspecFiles Include="**\*.nuspec" />
<NuGetNuspecTargets Include="src\*.nuspec" />
</ItemGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://www.myget.org/F/xunit-xamarin/" />
<PackageSource Include="https://www.myget.org/F/xunit/" />
<PackageSource Include="https://www.myget.org/F/b4ff5f68eccf4f6bbfed74f055f88d8f/" />
</ItemGroup>
<!-- Build server targets -->
<!-- Note GitVersion is not here intentionally. It's called via its own build step first -->
<Target Name="TeamCity" DependsOnTargets="PackageRestore;Test;GitLink;Packages;ZipArtifacts;PushMyGet" />
<!-- Individiual targets -->
<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)" install gitlink -SolutionDir "$(SolutionDir)" -Verbosity quiet -ExcludeVersion -pre" Condition="!Exists('$(SolutionDir)\packages\gitlink\')" />
<Exec Command=""$(NuGetExePath)" install gitversion.commandline -SolutionDir "$(SolutionDir)" -Verbosity quiet -ExcludeVersion -pre" Condition="!Exists('$(SolutionDir)\packages\gitversion.commandline\')" />
<Exec Command=""$(NuGetExePath)" restore "$(SolutionDir)\$(SolutionName)" -NonInteractive -Source @(PackageSource) -Verbosity quiet" />
</Target>
<Target Name="GitVersion" DependsOnTargets="PackageRestore">
<Exec Command="packages\gitversion.commandline\tools\GitVersion.exe /output buildserver /updateassemblyinfo true" />
</Target>
<Target Name="Build" DependsOnTargets="PackageRestore">
<MSBuild
Projects="xunit.extensions.sln"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=$(Platform);TrackFileAccess=$(TrackFileAccess)"/>
</Target>
<Target Name="Test" DependsOnTargets="Build">
<!-- TODO: add unit tests here, if desired -->
</Target>
<Target Name='GitLink'>
<Warning Condition=" '$(CommitHash)' == '' "
Text="Skipping GitLink because CommitHash was not specified." />
<Exec Condition=" '$(CommitHash)' != '' "
Command='packages\gitlink\lib\net45\GitLink.exe $(MSBuildThisFileDirectory) -f $(SolutionName) -u https://github.com/xunit/extensions.xunit -s $(CommitHash)' IgnoreExitCode='true' />
</Target>
<Target Name='Packages'>
<!-- If build metadata is empty, we're in Continuous Deploy mode so we'll always get incrementing versions -->
<PropertyGroup Condition="'$(GitVersion_BuildMetaData)' != ''">
<NuGetPackageVersion>$(GitVersion_LegacySemVer)-build$(GitVersion_BuildMetaDataPadded)</NuGetPackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(NuGetPackageVersion)' == ''">
<NuGetPackageVersion>$(GitVersion_NuGetVersion)</NuGetPackageVersion>
</PropertyGroup>
<Exec Command='.nuget\NuGet.exe pack %(NuGetNuspecTargets.Identity) -version $(NuGetPackageVersion) -NoPackageAnalysis -NonInteractive' />
</Target>
<Target Name='ZipArtifacts'>
<ItemGroup>
<TestResults Include="TestResults*.*" />
<Binaries Include="*.nupkg" />
</ItemGroup>
<Delete Files="test-results.zip" />
<Zip Files="@(TestResults)" ZipFileName="test-results.zip" />
<Delete Files="binaries.zip" />
<Zip Files="@(Binaries)" ZipFileName="binaries.zip" StripPath="true" />
</Target>
<Target Name="PushMyGet">
<ItemGroup>
<NupkgFiles Include="*.nupkg" />
</ItemGroup>
<Exec Command=".nuget\NuGet.exe push %(NupkgFiles.Identity) -NonInteractive -Source https://www.myget.org/F/xunit/api/v2/package" />
</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("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>