This repository was archived by the owner on Feb 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.msbuild
228 lines (182 loc) · 10.1 KB
/
Build.msbuild
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<Project DefaultTargets="Clean;Build;Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<!-- Configure the modules. -->
<PropertyGroup>
<RootDir>$(MSBuildProjectDirectory)</RootDir>
</PropertyGroup>
<ItemGroup>
<NestedModule Include="Build.module" />
</ItemGroup>
<Import Project="$(RootDir)\Module.targets" />
<!-- Configure other properties. -->
<PropertyGroup>
<Version Condition="'$(Version)'==''">0.0.0.0</Version>
<ShowReports Condition="'$(ShowReports)'==''">true</ShowReports>
<ReportTypes Condition="'$(ReportTypes)'==''">Html</ReportTypes>
<TargetFX1_1 Condition="'$(TargetFX1_1)'==''">true</TargetFX1_1>
<SandcastlePath>$(ProgramFiles)\Sandcastle</SandcastlePath>
<SandcastleHelpFileBuilderPath>$(SHFBROOT)</SandcastleHelpFileBuilderPath>
<HTMLHelpCompilerPath>$(ProgramFiles)\HTML Help Workshop\hhc.exe</HTMLHelpCompilerPath>
<NSISPath>$(ProgramFiles)\NSIS\makensis.exe</NSISPath>
<SourceServerIndexerPath>$(ProgramFiles)\Debugging Tools for Windows\sdk\srcsrv\ssindex.cmd</SourceServerIndexerPath>
<SourceServerIndexerPath Condition="! Exists('$(SourceServerIndexerPath)')">$(ProgramFiles)\Debugging Tools for Windows (x86)\srcsrv\ssindex.cmd</SourceServerIndexerPath>
<CSharpProperties>
Configuration=Release;
Version=$(Version);
TargetFX1_1=$(TargetFX1_1);
BaseFX1_1OutputPath=bin\;
OutputPath=bin\;
BaseIntermediateOutputPath=obj\;
CustomAfterMicrosoftCommonTargets=$(RootDir)\Build.Custom.Targets
</CSharpProperties>
</PropertyGroup>
<PropertyGroup>
<BuildDependsOnTargets>
RecursiveBeforeBuild;
BuildCSharpProjects;
RecursiveAfterBuild;
CopyFiles
</BuildDependsOnTargets>
<RebuildDependsOnTargets>
RecursiveBeforeBuild;
RebuildCSharpProjects;
RecursiveAfterBuild;
CopyFiles
</RebuildDependsOnTargets>
<CleanDependsOnTargets>
CleanCSharpProjects;
RemoveBuildDir;
</CleanDependsOnTargets>
</PropertyGroup>
<Target Name="Release"
DependsOnTargets="Clean;Build;Test;BuildSourceServerIndex;BuildDocs;BuildInstaller;BuildZip" />
<Target Name="Build"
DependsOnTargets="$(BuildDependsOnTargets)" />
<Target Name="Rebuild"
DependsOnTargets="$(RebuildDependsOnTargets)" />
<Target Name="Clean"
DependsOnTargets="$(CleanDependsOnTargets)">
</Target>
<Target Name="RemoveBuildDir">
<RemoveDir Directories="$(BuildDir)"
Condition="Exists('$(BuildDir)')" />
</Target>
<PropertyGroup>
<MbUnitConsArgs>/report-type:$(ReportTypes) /report-name-format:test-report /report-folder:"$(BuildReportsDir)" @(TestAssembly->'"%(Identity)"', ' ')</MbUnitConsArgs>
<MbUnitConsArgs Condition="$(ShowReports)">$(MbUnitConsArgs) /show-reports</MbUnitConsArgs>
</PropertyGroup>
<Target Name="Test">
<Exec Command=""$(TargetDir)\bin\MbUnit.cons.exe" $(MbUnitConsArgs)"
WorkingDirectory="$(BuildTempDir)"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="MbUnitExitCode" />
</Exec>
<Warning Text="Some tests failed!"
Condition="'$(MbUnitExitCode)'!='0'" />
</Target>
<Target Name="BuildCSharpProjects">
<MSBuild Projects="@(CSharpProject)"
Targets="Build"
Properties="$(CSharpProperties)" />
</Target>
<Target Name="RebuildCSharpProjects">
<MSBuild Projects="@(CSharpProject)"
Targets="Rebuild"
Properties="$(CSharpProperties)" />
</Target>
<Target Name="CleanCSharpProjects">
<MSBuild Projects="@(CSharpProject)"
Targets="Clean"
Properties="$(CSharpProperties)" />
</Target>
<Target Name="CopyFiles"
DependsOnTargets="CreateBuildDir">
<Message Text="Copying files to target folder..." Importance="High" />
<Copy SourceFiles="@(Binary)"
DestinationFolder="$(TargetBinDir)\%(Binary.Folder)\%(RecursiveDir)" />
<Copy SourceFiles="@(Document)"
DestinationFolder="$(TargetDocsDir)\%(Document.Folder)\%(RecursiveDir)" />
<Copy SourceFiles="@(Extra)"
DestinationFolder="$(TargetExtrasDir)\%(Extra.Folder)\%(RecursiveDir)" />
<Copy SourceFiles="@(File)"
DestinationFolder="$(TargetDir)\%(File.Folder)\%(RecursiveDir)" />
</Target>
<Target Name="BuildInstaller"
DependsOnTargets="CreateBuildDir">
<Warning Text="The NSIS tools must be installed to generate the installer. Look in tools for the NSIS installer."
Condition="! Exists('$(NSISPath)')" />
<Exec Command=""$(NSISPath)" /V2 /NOCONFIG /DVERSION=$(Version) /DROOTDIR="$(RootDir)" "$(SourceDir)\installer\MbUnit.nsi""
Condition="Exists('$(NSISPath)')" />
</Target>
<PropertyGroup>
<WebDocsParentDir>$(BuildReleaseDir)\APIDocs</WebDocsParentDir>
<WebDocsDir>$(WebDocsParentDir)\$(Version)</WebDocsDir>
<CHMDocsDir>$(TargetDir)\docs</CHMDocsDir>
<SandcastleTempDir>$(BuildTempDir)\docs</SandcastleTempDir>
<SandcastleProjectPath>docs\Docs.shfbproj</SandcastleProjectPath>
<SandcastlePatchedProjectPath>docs\Docs.patched.shfbproj</SandcastlePatchedProjectPath>
<SandcastleOutputPath>$(SandcastleTempDir)\output</SandcastleOutputPath>
<SandcastleIntellisensePath>$(SandcastleTempDir)\intellisense</SandcastleIntellisensePath>
</PropertyGroup>
<Target Name="BuildDocs"
DependsOnTargets="BuildDocs_Sandcastle;BuildDocs_NoSandcastle" />
<Target Name="BuildDocs_Sandcastle"
Condition="'$(NoSandcastle)'!='true'">
<Message Text="Building Docs..."
Importance="High" />
<Error Text="Sandcastle and Sandcastle Help File Builder must be installed to generate documentation. To only generate Xml Intellisense docs without Sandcastle, build with 'BuildNoSandcastle.bat'. Be sure to also install the Sandcastle Styles patches. Look in tools for the Sandcastle installers and patches."
Condition="! Exists('$(SandcastlePath)') or ! Exists('$(SandcastleHelpFileBuilderPath)')" />
<Error Text="Microsoft HTML Help Workshop must be installed so that Compiled HTML help (CHM) documentation can be generated. Download the Microsoft HTML Help Workshop installer from Microsoft."
Condition="! Exists('$(HTMLHelpCompilerPath)')" />
<CreateProperty Value="@(DocumentedAssembly->'<DocumentationSource sourceFile="%(FullPath)" /><DocumentationSource sourceFile="%(RootDir)%(Directory)%(Filename).xml" />', '')">
<Output TaskParameter="Value" PropertyName="SandcastleDocumentationSources" />
</CreateProperty>
<Delete Files="$(CHMDocsDir)\MbUnit.chm"
Condition="Exists('$(CHMDocsDir)\MbUnit.chm')" />
<RemoveDir Directories="$(WebDocsDir);$(SandcastleTempDir)" />
<MakeDir Directories="$(WebDocsParentDir);$(CHMDocsDir);$(SandcastleTempDir)" />
<!-- Should be able to just override DocumentationSources but
we get an error.
SHFB : warning BHT0001: Unable to get executing project: Unable to obtain internal reference. The specified project will be loaded but command line property overrides will be ignored. [C:\Source\MbUnit\v3\docs\Docs.shfbproj]
So instead we generate a patched project file with the changes inline. -->
<Copy SourceFiles="$(SandcastleProjectPath)"
DestinationFiles="$(SandcastlePatchedProjectPath)" />
<FileUpdate Files="$(SandcastlePatchedProjectPath)"
SingleLine="true"
Regex="<DocumentationSources>.*</DocumentationSources>"
ReplacementText="<DocumentationSources>$(SandcastleDocumentationSources)</DocumentationSources>" />
<MSBuild Projects="$(SandcastlePatchedProjectPath)"
Properties="Version=$(Version);BuildDir=$(BuildDir);TempDir=$(BuildTempDir);ReportDir=$(BuildReportsDir);CustomBeforeSHFBTargets=$(SandcastleProjectOverridesPath)" />
<Copy SourceFiles="$(SandcastleOutputPath)\MbUnit.chm"
DestinationFolder="$(CHMDocsDir)" />
<!-- Note: We leave the CHM file in the docs folder for downloads from web. -->
<Exec Command="move /y "$(SandcastleOutputPath)" "$(WebDocsDir)"" />
<Delete Files="@(DocumentedAssembly->'$(TargetDir)\bin\%(Folder)\%(Filename).xml')" />
<Move SourceFiles="@(DocumentedAssembly->'$(SandcastleIntellisensePath)\%(Filename).xml')"
DestinationFiles="@(DocumentedAssembly->'$(TargetDir)\bin\%(Folder)\%(Filename).xml')" />
</Target>
<Target Name="BuildDocs_NoSandcastle"
Condition="'$(NoSandcastle)'=='true'">
<Copy SourceFiles="@(DocumentedAssembly->'%(RootDir)%(Directory)%(Filename).xml')"
DestinationFolder="$(TargetDir)\bin\%(DocumentedAssembly.Folder)" />
</Target>
<Target Name="BuildZip"
DependsOnTargets="CreateBuildDir">
<CreateItem Include="$(TargetDir)\**\*.*">
<Output TaskParameter="Include" ItemName="ZipFiles" />
</CreateItem>
<Zip Files="@(ZipFiles)"
WorkingDirectory="$(TargetDir)"
ZipFileName="$(BuildReleaseDir)\MbUnit-$(Version).zip"
ZipLevel="9" />
</Target>
<Target Name="BuildSourceServerIndex"
DependsOnTargets="CreateBuildDir">
<Warning Text="The Debugging Tools for Windows must be installed along with the Source Source SDK in order to embed Source Server indexing information in the PDBs."
Condition="! Exists('$(SourceServerIndexerPath)')" />
<Exec Command=""$(SourceServerIndexerPath)" -System=svn -Ini="$(SourceDir)\srcsrv.ini" -Source="$(SourceDir)" -Symbols="$(TargetBinDir)""
Condition="Exists('$(SourceServerIndexerPath)')" />
</Target>
<Target Name="CreateBuildDir">
<MakeDir Directories="$(BuildDir);$(TargetDir);$(TargetBinDir);$(TargetDocsDir);$(TargetExtrasDir);$(BuildReportsDir);$(BuildReleaseDir);$(BuildTempDir)" />
</Target>
</Project>