forked from MvcExtensions/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MvcExtensions.build
122 lines (104 loc) · 6.3 KB
/
MvcExtensions.build
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Full" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BUILD_NUMBER Condition="'$(BUILD_NUMBER)' == ''">2.5.0</BUILD_NUMBER>
<SemVer>$(BUILD_NUMBER)</SemVer>
<Version>$([System.Text.RegularExpressions.Regex]::Match($(BUILD_NUMBER), `\d+.\d+.\d+`)).0</Version>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<PartCoverTasksPath>$(MSBuildProjectDirectory)\Build\PartCover\</PartCoverTasksPath>
<xunit>$(MSBuildProjectDirectory)\Build\Xunit\xunit.console.clr4.x86.exe</xunit>
<nuget>$(MSBuildProjectDirectory)\Build\NuGet\nuget</nuget>
<artifactPath>$(MSBuildProjectDirectory)\Drops</artifactPath>
<referencePath>$(MSBuildProjectDirectory)\References</referencePath>
<solution>$(MSBuildProjectDirectory)\MvcExtensions.sln</solution>
<corePath>$(MSBuildProjectDirectory)\src\MvcExtensions</corePath>
<coreFile>MvcExtensions</coreFile>
</PropertyGroup>
<Import Project="$(MSBuildProjectDirectory)\Build\PartCover\PartCover.MSBuild.Targets"/>
<Import Project="$(MSBuildProjectDirectory)\Build\CommunityTasks\MSBuild.Community.Tasks.Targets"/>
<UsingTask AssemblyFile="$(MSBuildProjectDirectory)\Build\StyleCop\Microsoft.StyleCop.dll" TaskName="StyleCopTask"/>
<UsingTask AssemblyFile="$(MSBuildProjectDirectory)\Build\Xunit\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.CombineXunitXml"/>
<Target Name="Full" DependsOnTargets="Init;Clean;StyleCop;Simian;Build;FxCop;Tests;Deploy"/>
<Target Name="Init">
<MakeDir Directories="$(artifactPath)" Condition="!Exists('$(artifactPath)')"/>
</Target>
<Target Name="Clean">
<MSBuild Projects="$(solution)" Targets="Clean" Properties="Configuration=$(Configuration)"/>
</Target>
<Target Name="StyleCop">
<CreateItem Include="$(corePath)\**\*.cs">
<Output TaskParameter="Include" ItemName="styleCopFiles"/>
</CreateItem>
<CreateItem Include="$(corePath).Tests\**\*.cs">
<Output TaskParameter="Include" ItemName="styleCopFiles"/>
</CreateItem>
<StyleCopTask
ProjectFullPath="$(solution)"
SourceFiles="@(styleCopFiles)"
ForceFullAnalysis="true"
TreatErrorsAsWarnings="false"
CacheResults="false"
OutputFile="$(artifactPath)\StyleCop.xml"
MaxViolationCount="0"
/>
</Target>
<Target Name="Simian">
<Copy SourceFiles="$(MSBuildProjectDirectory)\Build\Simian\simian.xsl" DestinationFolder="$(artifactPath)"/>
<Exec
Command=""$(MSBuildProjectDirectory)\Build\Simian\simian-2.2.24.exe" -formatter=xml:"$(artifactPath)\Simian.xml" -reportDuplicateText+ -includes="$(corePath)/**/*.cs""
IgnoreExitCode="true"
WorkingDirectory="$(MSBuildProjectDirectory)"
/>
</Target>
<Target Name="Build">
<AssemblyInfo CodeLanguage="CS"
OutputFile="src\SharedFiles\CommonAssemblyInfo.cs"
AssemblyCompany="MvcExtensions"
AssemblyCopyright="Copyright © Kazi Manzur Rashid 2009-2012, hazzik 2011-2012"
ComVisible="false"
AssemblyVersion="$(Version)"
AssemblyFileVersion="$(Version)"
AssemblyInformationalVersion="$(SemVer)"/>
<MSBuild Projects="$(solution)" Targets="Build" Properties="Configuration=$(Configuration)"/>
</Target>
<Target Name="FxCop">
<PropertyGroup>
<fxCopOutput>$(artifactPath)\FxCop.xml</fxCopOutput>
<fxCopTotalErrors>0</fxCopTotalErrors>
</PropertyGroup>
<Copy SourceFiles="$(MSBuildProjectDirectory)\Build\FxCop\Xml\FxCopReport.xsl" DestinationFolder="$(artifactPath)"/>
<Exec
Command=""$(MSBuildProjectDirectory)\Build\FxCop\FxCopCmd.exe" /f:"$(corePath)\bin\$(Configuration)\$(coreFile).dll" /d:"$(referencePath)\AspNetMvc" /d:"$(referencePath)\Autofac" /d:"$(referencePath)\Castle" /d:"$(referencePath)\Ninject" /d:"$(referencePath)\PnP" /d:"$(referencePath)\StructureMap" /dic:"$(MSBuildProjectDirectory)\SharedFiles\CodeAnalysisDictionary.xml" /o:"$(fxCopOutput)" /oxsl:"FxCopReport.xsl" /to:0 /fo /gac /igc /q"
IgnoreExitCode="true"
/>
<XmlRead XmlFileName="$(fxCopOutput)" XPath="string(count(//Issue))" ContinueOnError="True">
<Output TaskParameter="Value" PropertyName="fxCopTotalErrors"/>
</XmlRead>
<Error Text="FxCop encountered $(fxCopTotalErrors) rule violations" Condition="$(fxCopTotalErrors) > 0"/>
</Target>
<Target Name="CodeCoverage">
<PartCover ToolPath="$(PartCoverTasksPath)"
Target="$(xunit)"
TargetArgs=""$(corePath).Tests\bin\$(Configuration)\$(coreFile).Tests.dll" /noshadow /xml "$(artifactPath)\$(coreFile).Tests.xunit.xml""
Output="$(artifactPath)\$(coreFile)-coverage.xml"
Include="[$(coreFile)]*"
Exclude="[*.Test]*"
/>
</Target>
<Target Name="Tests">
<Exec Command="$(xunit) "$(corePath).Tests\bin\$(Configuration)\$(coreFile).Tests.dll" /noshadow /xml "$(artifactPath)\$(coreFile).Tests.xunit.xml"" />
</Target>
<Target Name="Deploy">
<CreateItem Include="$(corePath)\bin\$(Configuration)\$(coreFile).*">
<Output TaskParameter="Include" ItemName="zipFiles"/>
</CreateItem>
<CreateItem Include="$(MSBuildProjectDirectory)\license.txt">
<Output TaskParameter="Include" ItemName="zipFiles"/>
</CreateItem>
<Zip Files="@(zipFiles)" ZipFileName="$(artifactPath)\$(coreFile).$(SemVer).zip" Flatten="true" ZipLevel="9"/>
<Exec Command="$(nuget).exe pack $(corePath)\$(coreFile).nuspec /basepath $(corePath)\bin\$(Configuration) /outputdirectory $(artifactPath) /version $(SemVer)" />
</Target>
<Target Name="Publish">
<Exec Command="$(nuget).cmd push $(artifactPath)\$(coreFile).$(SemVer).nupkg"/>
</Target>
</Project>