forked from cdrnet/lokad-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lokad.Cloud.build
192 lines (157 loc) · 8.32 KB
/
Lokad.Cloud.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" DefaultTargets="integrate" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Resource\Build\MSBuild.Community.Tasks.targets" />
<Import Project="Resource\Build\NCoverExplorer.MSBuildTasks.targets"/>
<PropertyGroup>
<Version Condition="$(Version)==''">0.0.0.0</Version>
<BuildPath Condition="$(BuildPath)==''">$(MSBuildProjectDirectory)\Build</BuildPath>
<Configuration Condition="$(Configuration)==''">Release</Configuration>
<ArtifactDirectory Condition="$(ArtifactDirectory)==''">$(BuildPath)\Artifact</ArtifactDirectory>
<PackageDirectory Condition="$(PackageDirectory)==''">$(BuildPath)\_Package\$(Version)</PackageDirectory>
<PublicationRoot Condition="$(PublicationRoot)==''">$(BuildPath)\_Package</PublicationRoot>
<!--Derived-->
<ProjectName>$(MSBuildProjectName)</ProjectName>
<CloudReadyPath>$(BuildPath)\CloudReady</CloudReadyPath>
<CloudSource>Source\Lokad.Cloud\bin\$(Configuration)\Publish</CloudSource>
<CloudTargets>$(MSBuildProjectDirectory)\Resource\Build\</CloudTargets>
<CloudApiPath>$(BuildPath)\Cloud.Dev</CloudApiPath>
<CloudApiSource>Source\Lokad.Cloud.Framework\bin\$(Configuration)</CloudApiSource>
<ResourcePath>Resource\Library</ResourcePath>
<TestPath>$(BuildPath)\Test</TestPath>
<ProjectName>$(MSBuildProjectName)</ProjectName>
<SampleSource>Sample</SampleSource>
<TempPath>$(BuildPath)\Temp</TempPath>
<SourceExclusions>**\.svn\**\*.*;**\_svn\**\*.*;**\*.user;**\*.suo;**\*.db;**\bin\**\*.*;**\obj\**\*.*;**\*.resharper;**\_ReSharper*\**\*.*;</SourceExclusions>
</PropertyGroup>
<ItemGroup>
<Tokens Include="CloudPackage">
<ReplacementValue>$(ProjectName)-Deploy-$(Version).zip</ReplacementValue>
</Tokens>
<Tokens Include="SourcePackage">
<ReplacementValue>$(ProjectName)-Source-$(Version).zip</ReplacementValue>
</Tokens>
<Tokens Include="Version">
<ReplacementValue>$(Version)</ReplacementValue>
</Tokens>
<Tokens Include="BuildTime">
<ReplacementValue>$(BuildTime)</ReplacementValue>
</Tokens>
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="$(ProjectName).sln"
Targets="Build"
Properties="Configuration=$(Configuration);ConfigProfile=$(ConfigProfile);CloudExtensionsDir=$(CloudTargets)"/>
<MSBuild Projects="$(ProjectName).sln"
Targets="publish"
Properties="Configuration=$(Configuration);ApplicationVersion=$(Version);ConfigProfile=$(ConfigProfile);CloudExtensionsDir=$(CloudTargets)" />
</Target>
<Target Name="Clean">
<MSBuild Projects="$(ProjectName).sln" Targets="Clean" Properties="Configuration=$(Configuration)"/>
<CreateItem Include="**/Debug/**/*.*;**/Release/**/*.*">
<Output ItemName="_binaryFiles" TaskParameter="Include"/>
</CreateItem>
<Delete Files="@(_binaryFiles)" TreatErrorsAsWarnings="true"/>
<RemoveDir Directories="$(BuildPath)" ContinueOnError="true"/>
</Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build;" />
<Target Name="Integrate" DependsOnTargets="Clean;Test;Report" />
<Target Name="Test" DependsOnTargets="Build;Copy">
<MakeDir Directories="$(ArtifactDirectory)" />
<CreateItem Include="$(TestPath)\*.Test.dll">
<Output ItemName="testAssemblies" TaskParameter="Include"/>
</CreateItem>
<CreateItem Include="$(TestPath)\Lokad.Cloud*dll" Exclude="$(TestPath)\*.Test.dll">
<Output ItemName="coverageAssemblies" TaskParameter="Include"/>
</CreateItem>
<Exec WorkingDirectory="Resource\Tool\NUnit" Command="nunit-console.exe @(testAssemblies->'"%(FullPath)"', ' ') /nologo /noshadow /xml="$(ArtifactDirectory)\$(ProjectName).Tests-result.xml"" />
<!--@(_testFiles->'"%(FullPath)"', ' ')-->
<!--
HACK: [vermorel] NCover not working under .NET 4.0.
Important: if this code breaks down and you are running 64 bit machine,
then you have to force NUnit-console and NCover to 32 bit mode
with CorFlags.exe from .NET SDK 2.0 (included in NCover and NUnit folders)
<NCover ToolPath="Resource\Tool\NCover"
CommandLineExe="Resource/Tool/NUnit/nunit-console-x86.exe"
CommandLineArgs="@(testAssemblies->'"%(FullPath)"', ' ') /nologo /noshadow /xml="$(ArtifactDirectory)\$(ProjectName).Tests-result.xml""
AssemblyList="@(coverageAssemblies)"
CoverageFile="$(ArtifactDirectory)\$(ProjectName)-coverage.xml"
LogFile="$(ArtifactDirectory)\$(ProjectName)-coverage.log"
ExcludeAttributes="System.Runtime.CompilerServices.CompilerGeneratedAttribute;System.CodeDom.Compiler.GeneratedCodeAttribute"
ContinueOnError="false"
/>
<NCoverExplorer
ToolPath="Resource\Tool\NCoverExplorer"
ProjectName="$(MSBuildProjectName)"
ReportType="ModuleClassSummary"
XmlReportName="$(ArtifactDirectory)\$(ProjectName).fCoverage-result.xml"
HtmlReportName="$(ArtifactDirectory)\$(ProjectName).fCoverage-summary.html"
ShowExcluded="True"
SatisfactoryCoverage="75"
MinimumCoverage="75"
Sort="FunctionCoverageAscending"
CoverageFiles="$(ArtifactDirectory)\$(ProjectName)-coverage.xml"
Exclusions="Namespace=Microsoft.Samples.ServiceHosting.*"
/> -->
</Target>
<Target Name="Report">
<!-- placeholder for now
<FxCop ToolPath="Resource/Tool/FxCop" ProjectFile="$(ProjectName).FxCop" AnalysisReportFileName="$(ArtifactDirectory)/$(ProjectName).fxcop-result.xml"/> -->
</Target>
<Target Name="Copy" DependsOnTargets="Build" >
<MakeDir Directories="$(BuildPath)"/>
<!--All Tests-->
<CreateItem Include="Test\**\bin\$(Configuration)\*.*" Exclude="Test\**\bin\$(Configuration)\*.xml;Test\**\bin\$(Configuration)\*.pdb;">
<Output ItemName="testSources" TaskParameter="Include"/>
</CreateItem>
<Copy SourceFiles="@(testSources)" DestinationFolder="$(TestPath)" />
<CreateItem Include="$(CloudSource)\*.*;ReadMe.txt;$(CloudApiSource)\Lokad.Cloud.Framework.*;$(CloudApiSource)\Lokad.Cloud.Storage.*;$(ResourcePath)\Autofac.dll">
<Output ItemName="cloudSources" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="@(cloudSources)" DestinationFolder="$(CloudReadyPath)" />
<CreateItem Include="$(CloudApiSource)\*.*">
<Output ItemName="apiSources" TaskParameter="Include"/>
</CreateItem>
<Copy SourceFiles="@(apiSources)" DestinationFolder="$(CloudApiPath)" />
</Target>
<Target Name="GenerateHelp" DependsOnTargets="Build;Copy">
<!-- [vermorel] Commenting out sandcastle along with the .NET 4.0 upgrade.
<Exec Command="Resource\Tool\SHFB\SandcastleBuilderConsole.exe $(MSBuildProjectName).shfb" /> -->
</Target>
<Target Name="Distrib" DependsOnTargets="Clean;Build;Copy;GenerateHelp">
<!-- Cloud package -->
<MakeDir Directories="$(PackageDirectory)" />
<CreateItem Include="$(CloudReadyPath)\*.*">
<Output ItemName="cloudReadyFiles" TaskParameter="Include" />
</CreateItem>
<Zip Files="@(cloudReadyFiles)" ZipFileName="$(PackageDirectory)\$(ProjectName)-Deploy-$(Version).zip" Flatten="true" />
<!--Source.zip-->
<CreateItem Include="**\*.*" Exclude="Resource\Tool\**\*.*;Build\**\*.*;$(SourceExclusions)">
<Output ItemName="sourceFiles" TaskParameter="Include" />
</CreateItem>
<Zip Files="@(sourceFiles)" ZipFileName="$(PackageDirectory)\$(ProjectName)-Source-$(Version).zip" Flatten="false" />
<!--Index-->
<Copy SourceFiles="Resource\Template\index.template.htm" DestinationFolder="$(TempPath)" />
<TemplateFile Template="$(TempPath)\index.template.htm" OutputFile="index" Tokens="@(Tokens)" />
<Copy SourceFiles="$(TempPath)\index.template.out" DestinationFiles="$(PublicationRoot)\index.htm" />
</Target>
<!--For Continuous integration and automated releases-->
<Target Name="Release" DependsOnTargets="Clean;_Version;Build;Test;Distrib" />
<Target Name="_Version">
<CreateItem Include="**\GlobalAssemblyInfo.cs">
<Output ItemName="_VersionPaths" TaskParameter="Include"/>
</CreateItem>
<CreateItem Include="@(_VersionPaths->'%(SubFolder)%(RecursiveDir)VersionAssemblyInfo.cs')">
<Output ItemName="_VersionFiles" TaskParameter="Include"/>
</CreateItem>
<Time Format="yyyy-MM-dd HH:mm">
<Output TaskParameter="FormattedTime" PropertyName="BuildTime" />
</Time>
<AssemblyInfo OutputFile="%(_VersionFiles.FullPath)" CodeLanguage="CS"
AssemblyVersion="$(Version)"
AssemblyFileVersion="$(Version)"
AssemblyConfiguration="$(Configuration) built on $(BuildTime)" />
</Target>
<Target Name="WipeResources">
<!-- placeholder for now -->
</Target>
</Project>