forked from devlooped/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
121 lines (97 loc) · 5.8 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
<?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);SourceLinkCreate=true</CommonBuildProperties>
<GitInfoReportImportance>high</GitInfoReportImportance>
<GitIgnoreTagVersion>true</GitIgnoreTagVersion>
<GitIgnoreBranchVersion>true</GitIgnoreBranchVersion>
</PropertyGroup>
<ItemGroup>
<Solution Include="Moq.sln"/>
<NuSpec Include="Moq.nuspec" />
<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" />
</Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Target Name="Build" DependsOnTargets="GitVersion">
<MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" />
</Target>
<Target Name="Test" DependsOnTargets="Build">
<!-- See if dotnet CLI is available: -->
<Exec ContinueOnError="True" Command="dotnet --info">
<Output TaskParameter="ExitCode" PropertyName="DotNetErrorCode"/>
</Exec>
<Warning Condition="'$(DotNetErrorCode)' != '0'" Text="Error in executing dotnet." />
<!-- Test runner report files will be written to the `out\` directory,
so create it if it doesn't exist yet. -->
<MakeDir Directories="$(Out)" Condition=" !Exists('$(Out)') " />
<Exec Command="dotnet xunit -nobuild -configuration $(Configuration) -noshadow -appveyor -html ..\$(Out)\test.html -xml ..\$(Out)\test.xml"
WorkingDirectory="Moq.Tests"
ContinueOnError="false" />
<Exec Command="dotnet xunit -nobuild -configuration $(Configuration) -noshadow -appveyor -html ..\$(Out)\test-vb.html -xml ..\$(Out)\test-vb.xml"
WorkingDirectory="Moq.Tests.VisualBasic"
ContinueOnError="false" />
<PropertyGroup>
<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>
<!-- 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)' />
<!-- See if dotnet CLI is available: -->
<Exec ContinueOnError="True" Command="dotnet --info">
<Output TaskParameter="ExitCode" PropertyName="DotNetErrorCode"/>
</Exec>
<Warning Condition="'$(DotNetErrorCode)' != '0'" Text="Error in executing dotnet." />
<!-- Verify that created NuGet package is correctly source-linked to the GitHub repository -->
<!--
<Exec Command="dotnet sourcelink test ..\$(Out)\%(NuSpec.Filename).$(Version).nupkg"
WorkingDirectory="Source"
ContinueOnError="false" />
-->
</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>
</PropertyGroup>
<Target Name="GitVersion" /><!-- Gets overridden by the $(GitInfoTargets) if it exists -->
<Import Project="$(GitInfoTargets)" Condition=" Exists('$(GitInfoTargets)') " />
<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>