forked from devlooped/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
113 lines (91 loc) · 5.72 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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build;Test;Package" InitialTargets="Configure" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<IntermediateOutputPath>.nuget\</IntermediateOutputPath>
<PackagesPath>$(IntermediateOutputPath)packages</PackagesPath>
<Out Condition=" '$(Out)' == '' ">out</Out>
<CommonBuildProperties>WarningLevel=0;NoWarn=1591;RunCodeAnalysis=false;Configuration=$(Configuration)</CommonBuildProperties>
<GitInfoReportImportance>high</GitInfoReportImportance>
<GitIgnoreTagVersion>true</GitIgnoreTagVersion>
<GitIgnoreBranchVersion>true</GitIgnoreBranchVersion>
</PropertyGroup>
<ItemGroup>
<Solution Include="Moq.sln"/>
<NuSpec Include="Moq.nuspec" />
<TestProject Include="UnitTests\Moq.Tests.csproj" />
<Source Include="Source\Moq.csproj" />
</ItemGroup>
<Target Name="Clean">
<MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" Targets="Clean" />
<Exec Command="rmdir $(Out) /S /Q" ContinueOnError="true" />
<Exec Command="rmdir $(PackagesPath) /S /Q" ContinueOnError="true" />
<Exec Command="rmdir src\packages /S /Q" ContinueOnError="true" />
</Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Target Name="Build" DependsOnTargets="GitVersion">
<MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" />
<Exec Command="$(PackagesPath)\gitlink\lib\net45\GitLink.exe . -f "$([System.String]::new('%(Solution.FullPath)').Replace('$(MSBuildProjectDirectory)', '').TrimStart('\'))" -skipverify -u https://github.com/moq/moq4 -b $(GitBranch) -c $(Configuration)" />
</Target>
<Target Name="Test" DependsOnTargets="Build">
<MSBuild Projects="@(TestProject)" BuildInParallel="false" Targets="GetTargetPath" Properties="$(CommonBuildProperties)">
<Output TaskParameter="TargetOutputs" ItemName="_TestAssembly" />
</MSBuild>
<ItemGroup>
<TestAssembly Include="@(_TestAssembly)" Condition=" Exists('%(_TestAssembly.FullPath)') " />
</ItemGroup>
<PropertyGroup>
<XunitConsole>$(PackagesPath)\xunit.runner.console\tools\xunit.console.exe</XunitConsole>
<XunitOptions>$(XunitOptions) -html $(Out)\test.html -xml $(Out)\test.xml -parallel all -noshadow</XunitOptions>
<CoverageConsole>$(PackagesPath)\OpenCover\tools\OpenCover.Console.exe</CoverageConsole>
<CoverageOptions>$(CoverageOptions) -output:$(Out)\coverage.xml -returntargetcode -register:user -filter:"+[Moq.*]* -[xunit*]* -[*.Tests]* -[*]*ThisAssembly* -[*]*IFluentInterface*" -excludebyattribute:*ExcludeFromCodeCoverage*;*CompilerGenerated* -skipautoprops -showunvisited -mergebyhash -hideskipped:All</CoverageOptions>
</PropertyGroup>
<xunit Assemblies="@(TestAssembly)"
Html="$(Out)\test.html"
Xml="$(Out)\test.xml"
ParallelizeAssemblies="true"
ParallelizeTestCollections="true"
ContinueOnError="ErrorAndContinue" />
<!-- This isn't collecting any data right now, so make Coverage == '' by default so it won't run with this condition -->
<Exec Command="$(CoverageConsole) $(CoverageOptions) -target:$(XunitConsole) -targetargs:"@(TestAssembly, ' ') $(XunitOptions)""
Condition=" '$(Coverage)' == 'true' "
ConsoleToMSBuild="true"
ContinueOnError="ErrorAndContinue" />
</Target>
<Target Name="Package" DependsOnTargets="Build">
<MakeDir Directories="$(Out)" Condition=" !Exists('$(Out)') " />
<Exec Command='"$(NuGet)" Pack "%(NuSpec.Identity)" $(Args) -Version $(Version) -Properties Id=%(NuSpec.Filename);Configuration=$(Configuration);Version=$(Version) -OutputDirectory $(Out)' />
</Target>
<Target Name="Publish" DependsOnTargets="Package">
<Exec Command='$(NuGet) Push "$(Out)\%(NuSpec.Filename).$(Version).nupkg" $(NuGetPushArgs)'
StandardErrorImportance="high"
StandardOutputImportance="normal" />
<Message Text="Published new package: Id=%(NuSpec.Filename), Version=$(Version)"
Importance="high" />
</Target>
<!-- Configure and restore initial targets and packages -->
<Import Project="NuGet.Restore.targets" />
<PropertyGroup>
<GitInfoTargets>$(PackagesPath)\GitInfo\build\GitInfo.targets</GitInfoTargets>
<PendingRestore Condition=" !Exists('$(GitInfoTargets)') ">true</PendingRestore>
<XunitProps>$(PackagesPath)\xunit.runner.msbuild\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.props</XunitProps>
</PropertyGroup>
<Target Name="GitVersion" /><!-- Gets overriden by the $(GitInfoTargets) if it exists -->
<Import Project="$(GitInfoTargets)" Condition=" Exists('$(GitInfoTargets)') " />
<Import Project="$(XunitProps)" Condition=" Exists('$(XunitProps)') " />
<Target Name="Configure" DependsOnTargets="_GetNuGet;GitInfoReport">
<!-- We always run NuGet Install since it already checks for already-installed packages and skips them -->
<Exec Command='"$(NuGet)" Install "$(MSBuildThisFileDirectory)packages.config" -OutputDirectory "$(PackagesPath)" -ExcludeVersion' />
<!-- Errors if nuget packages were restored during the build -->
<Error Text="Required build-time NuGet packages were missing and were just restored. Please run the build again."
Condition=" '$(PendingRestore)' == 'true' And '$(target)' != 'configure' "/>
<PropertyGroup>
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</Version>
</PropertyGroup>
<!-- Update AppVeyor build # to match the actual one being used -->
<Exec Command="appveyor UpdateBuild -Version $(Version)" Condition=" '$(APPVEYOR)' == 'true' "
ConsoleToMSBuild="true"
ContinueOnError="WarnAndContinue" />
<MakeDir Directories="$(Out)" Condition=" !Exists('$(Out)') " />
</Target>
</Project>