-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathBuild.proj
219 lines (200 loc) · 16.1 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
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Go" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildProjectDirectory)\Build.tasks" />
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<NuGetRoot>$(MSBuildProjectDirectory)\..</NuGetRoot>
<NuGetTestRoot>$(NuGetRoot)\test</NuGetTestRoot>
<NuGetSrcRoot>$(NuGetRoot)\src</NuGetSrcRoot>
<DropDirectory>$(NuGetRoot)\bin</DropDirectory>
<ArtifactDropDirectory>$(DropDirectory)\artifacts</ArtifactDropDirectory>
<NuGetDropDirectory>$(DropDirectory)\NuGet</NuGetDropDirectory>
<ExeBuildDirectory>$(NuGetSrcRoot)\CommandLine\bin\$(Configuration)</ExeBuildDirectory>
<ExeDropDirectory>$(NuGetDropDirectory)\Console</ExeDropDirectory>
<BootStrapperBuildDirectory>$(NuGetSrcRoot)\Bootstrapper\bin\$(Configuration)</BootStrapperBuildDirectory>
<BootStrapperDropDirectory>$(NuGetDropDirectory)\Bootstrapper</BootStrapperDropDirectory>
<PackageExplorerBuildDirectory>$(NuGetRoot)\Tools\NuGet\NuGetPackageExplorer\PackageExplorer\bin\$(Configuration)</PackageExplorerBuildDirectory>
<PackageExplorerDropDirectory>$(NuGetDropDirectory)\PackageExplorer</PackageExplorerDropDirectory>
<VisualStudioAddInBuildDirectory>$(NuGetSrcRoot)\VsExtension\bin\$(Configuration)</VisualStudioAddInBuildDirectory>
<VisualStudioAddInDropDirectory>$(NuGetDropDirectory)\VisualStudioAddIn</VisualStudioAddInDropDirectory>
<ServerBuildDirectory>$(NuGetSrcRoot)\Server</ServerBuildDirectory>
<ServerDropDirectory>$(NuGetDropDirectory)\Server</ServerDropDirectory>
<NuGetCoreBuildDirectory>$(NuGetSrcRoot)\Core</NuGetCoreBuildDirectory>
<NuGetCoreDropDirectory>$(NuGetDropDirectory)\Core</NuGetCoreDropDirectory>
<ZipExe>$(NuGetRoot)\Tools\7za920\7za.exe</ZipExe>
<ILMergeExe>$(NuGetRoot)\Tools\ILMerge\ILMerge.exe</ILMergeExe>
<ILMergeArtifactDirectory>$(ArtifactDropDirectory)\ILMerge</ILMergeArtifactDirectory>
<ILMergeFileFinalName>NuGet.exe</ILMergeFileFinalName>
<ILMergeInternalizeIgnoreFile>$(NuGetRoot)\Build\ilmerge.internalize.ignore.txt</ILMergeInternalizeIgnoreFile>
<MergeDirectory>$(ExeDropDirectory)</MergeDirectory>
<MSBuildBuildDirectory>$(NuGetSrcRoot)\MSBuild\bin\$(Configuration)</MSBuildBuildDirectory>
<MSBuildDropDirectory>$(NuGetDropDirectory)\MSBuild</MSBuildDropDirectory>
<MSBuildILMergeFileFinalName>NuGet.MSBuild.dll</MSBuildILMergeFileFinalName>
</PropertyGroup>
<PropertyGroup>
<MajorVersion>1</MajorVersion>
<MinorVersion>4</MinorVersion>
<!-- Ensure that we come up with a new version every 65535 years -->
<VersionStartYear>2010</VersionStartYear>
<!-- Build number is of the format (CurrentYear - VersionStartYear + 1)(2 digit month)(2 digit day) -->
<Build>$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</Build>
<Revision>$(BUILD_NUMBER)</Revision>
<Version>$(MajorVersion).$(MinorVersion).$(Build).$(Revision)</Version>
</PropertyGroup>
<ItemGroup>
<RegexTransform Include="$(NuGetSrcRoot)\VsExtension\source.extension.vsixmanifest">
<Find><![CDATA[<Version>\d+\.\d+\.\d+\.\d+</Version>]]></Find>
<ReplaceWith><![CDATA[<Version>$(Version)</Version>]]></ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(NuGetRoot)\Common\CommonAssemblyInfo.cs">
<Find>\d+\.\d+\.\d+\.\d+</Find>
<ReplaceWith>$(Version)</ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(NuGetSrcRoot)\VsConsole\PowerShellHost\Scripts\nuget.psd1">
<Find><![CDATA[ModuleVersion = '\d+\.\d+\.\d+\.\d+']]></Find>
<ReplaceWith><![CDATA[ModuleVersion = '$(Version)']]></ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(NuGetSrcRoot)\VsExtension\NuGetPackage.cs">
<Find><![CDATA[ProductVersion = "\d+\.\d+\.\d+\.\d+"]]></Find>
<ReplaceWith><![CDATA[ProductVersion = "$(Version)"]]></ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(NuGetSrcRoot)\**\*.nuspec">
<Find><![CDATA[<version>\d+\.\d+\.\d+\.\d+</version>]]></Find>
<ReplaceWith><![CDATA[<version>$(Version)</version>]]></ReplaceWith>
</RegexTransform>
</ItemGroup>
<Target Name="Go" DependsOnTargets="CheckFxCop; UpdateVsixVersion; Build; ReportFxCopResults; RunTests; CreateDropDirectories; CopyExecutableOutputToDropDirectory; CopyBootStrapperOutputToDropDirectory; CopyVisualStudioAddInOutputToDropDirectory; CopyPackageExplorerOutputToDropDirectory; CopyServerOutputToDropDirectory; CopyMSBuildOutputToDropDirectory; CopyLicenseToAllDirectories; ILMergeTheExecutable; ILMergeMSBuild; BuildPackages; RunIntegrationTests">
</Target>
<Target Name="CheckFxCop">
<Error
Condition="!Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\CodeAnalysis\fxcoptask.dll') "
Text="FxCop not found at $(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\CodeAnalysis\fxcoptask.dll. Cannot proceed" />
</Target>
<Target Name="UpdateVsixVersion" Condition="'$(BUILD_NUMBER)' != ''">
<RegexTransform Items="@(RegexTransform)" />
</Target>
<Target Name="Build">
<MSBuild Projects="$(NuGetRoot)\NuGet.sln" Targets="Build" Properties="EnableCodeAnalysis=true" />
<MSBuild Projects="$(NuGetRoot)\Tools\NuGet\NuGetPackageExplorer\NuGetPackageExplorer.sln" Targets="Build" Properties="EnableCodeAnalysis=true" />
</Target>
<Target Name="RunTests">
<MSBuild Projects="$(NuGetTestRoot)\Dialog.Test\Dialog.Test.csproj" Targets="RunTests" />
<MSBuild Projects="$(NuGetTestRoot)\Core.Test\Core.Test.csproj" Targets="RunTests" />
<MSBuild Projects="$(NuGetTestRoot)\VisualStudio.Test\VisualStudio.Test.csproj" Targets="RunTests" />
<MSBuild Projects="$(NuGetTestRoot)\PowerShellCmdlets.Test\PowerShellCmdlets.Test.csproj" Targets="RunTests" />
<MSBuild Projects="$(NuGetTestRoot)\PowerShellHost.Test\PowerShellHost.Test.csproj" Targets="RunTests" />
<MSBuild Projects="$(NuGetTestRoot)\MSBuild.Test\MSBuild.Test.csproj" Targets="RunTests" />
</Target>
<Target Name="ReportFxCopResults">
<ItemGroup>
<FxCopOutputItems Include="$(NuGetRoot)\**\*.dll.CodeAnalysisLog.xml" />
</ItemGroup>
<Message Text="##teamcity[importData type='FxCop' path='%(FxCopOutputItems.Identity)']" />
</Target>
<Target Name="CreateDropDirectories">
<Message Text="Making the output directories for the compiled output at '$(DropDirectory)'." />
<RemoveDir Directories="$(DropDirectory)" Condition="Exists('$(DropDirectory)')" ContinueOnError="True" />
<MakeDir Directories="$(DropDirectory)" Condition="!Exists('$(DropDirectory)')" />
<MakeDir Directories="$(ArtifactDropDirectory)" Condition="!Exists('$(ArtifactDropDirectory)')" />
<MakeDir Directories="$(NuGetDropDirectory)" Condition="!Exists('$(NuGetDropDirectory)')" />
<MakeDir Directories="$(ExeDropDirectory)" Condition="!Exists('$(ExeDropDirectory)')" />
<MakeDir Directories="$(BootStrapperDropDirectory)" Condition="!Exists('$(BootStrapperDropDirectory)')" />
<MakeDir Directories="$(VisualStudioAddInDropDirectory)" Condition="!Exists('$(VisualStudioAddInDropDirectory)')" />
<MakeDir Directories="$(ServerDropDirectory)" Condition="!Exists('$(ServerDropDirectory)')" />
<MakeDir Directories="$(MSBuildDropDirectory)" Condition="!Exists('$(MSBuildDropDirectory)')" />
<MakeDir Directories="$(PackageExplorerDropDirectory)" Condition="!Exists('$(PackageExplorerDropDirectory)')" />
<MakeDir Directories="$(NuGetCoreDropDirectory)" Condition="!Exists('$(NuGetCoreDropDirectory)')" />
</Target>
<Target Name="CopyExecutableOutputToDropDirectory">
<ItemGroup>
<ExeOutputItems Exclude="$(ExeBuildDirectory)\**\*.pdb" Include="$(ExeBuildDirectory)\**\*.*;$(NuGetSrcRoot)\CommandLine\Properties\*.nuspec" />
</ItemGroup>
<Message Text="Copying the NuGet Console output to $(ExeDropDirectory)" />
<Copy ContinueOnError="false" SourceFiles="@(ExeOutputItems)" DestinationFiles="@(ExeOutputItems ->'$(ExeDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="CopyBootStrapperOutputToDropDirectory">
<ItemGroup>
<BootStrapperOutputItems Exclude="$(BootStrapperBuildDirectory)\**\*.pdb" Include="$(BootStrapperBuildDirectory)\**\*.*" />
</ItemGroup>
<Message Text="Copying the NuGet BootStrapper output to $(BootStrapperDropDirectory)" />
<Copy ContinueOnError="false" SourceFiles="@(BootStrapperOutputItems)" DestinationFiles="@(BootStrapperOutputItems ->'$(BootStrapperDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="CopyVisualStudioAddInOutputToDropDirectory">
<ItemGroup>
<VisualStudioAddInOutputItems Include="$(VisualStudioAddInBuildDirectory)\**\*.vsix" />
</ItemGroup>
<Message Text="Copying the NuGet Visual Studio Add-In output to $(VisualStudioAddInDropDirectory)" />
<Copy ContinueOnError="false" SourceFiles="@(VisualStudioAddInOutputItems)" DestinationFiles="@(VisualStudioAddInOutputItems ->'$(VisualStudioAddInDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="CopyServerOutputToDropDirectory">
<ItemGroup>
<ServerOutputItems Include="$(ServerBuildDirectory)\**\*.*" Exclude="$(ServerBuildDirectory)\**\*.cs;$(ServerBuildDirectory)\**\*.csp*;$(ServerBuildDirectory)\obj\**\*.*;$(ServerBuildDirectory)\Packages\**\*.*;$(ServerBuildDirectory)\App_Data\**"/>
</ItemGroup>
<Message Text="Copying the NuGet Server output to $(ServerDropDirectory)" />
<Copy ContinueOnError="false" SourceFiles="@(ServerOutputItems)" DestinationFiles="@(ServerOutputItems ->'$(ServerDropDirectory)\www\%(RecursiveDir)%(Filename)%(Extension)')" />
<Exec Command=""$(ZipExe)" a ..\server.zip" WorkingDirectory="$(ServerDropDirectory)\www" />
<RemoveDir Directories="$(ServerDropDirectory)\www" />
</Target>
<Target Name="CopyPackageExplorerOutputToDropDirectory">
<ItemGroup>
<PackageExplorerOutputItems Exclude="$(PackageExplorerBuildDirectory)\**\*.pdb;
$(PackageExplorerBuildDirectory)\**\*.vshost.*;
$(PackageExplorerBuildDirectory)\**\*.manifest;
$(PackageExplorerBuildDirectory)\**\*.application"
Include="$(PackageExplorerBuildDirectory)\**\*.*" />
</ItemGroup>
<Message Text="Copying the PackageExplorer output to $(PackageExplorerDropDirectory)" />
<Copy ContinueOnError="false" SourceFiles="@(PackageExplorerOutputItems)" DestinationFiles="@(PackageExplorerOutputItems ->'$(PackageExplorerDropDirectory)\app\%(RecursiveDir)%(Filename)%(Extension)')" />
<Exec Command=""$(ZipExe)" a ..\PackageExplorer.zip" WorkingDirectory="$(PackageExplorerDropDirectory)\app" />
<RemoveDir Directories="$(PackageExplorerDropDirectory)\app" />
</Target>
<Target Name="CopyMSBuildOutputToDropDirectory">
<ItemGroup>
<MSBuildOutputItems Exclude="$(MSBuildBuildDirectory)\**\*.pdb" Include="$(MSBuildBuildDirectory)\**\*.*" />
</ItemGroup>
<Message Text="Copying NuGet.MSBuild.dll output to $(MSBuildDropDirectory)" />
<Copy ContinueOnError="false" SourceFiles="@(MSBuildOutputItems)" DestinationFiles="@(MSBuildOutputItems ->'$(MSBuildDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="CopyLicenseToAllDirectories">
<ItemGroup>
<LicenseFileItems Include="$(MSBuildProjectDirectory)\..\LICENSE.txt" />
</ItemGroup>
<Message Text="Copying the License to all drop directories" />
<Copy ContinueOnError="false" SourceFiles="@(LicenseFileItems)" DestinationFiles="@(LicenseFileItems ->'$(ExeDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy ContinueOnError="false" SourceFiles="@(LicenseFileItems)" DestinationFiles="@(LicenseFileItems ->'$(VisualStudioAddInDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy ContinueOnError="false" SourceFiles="@(LicenseFileItems)" DestinationFiles="@(LicenseFileItems ->'$(ServerDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy ContinueOnError="false" SourceFiles="@(LicenseFileItems)" DestinationFiles="@(LicenseFileItems ->'$(PackageExplorerDropDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="ILMergeTheExecutable">
<Message Text="ILMerging the executable contents in $(ExeDropDirectory)" />
<ItemGroup>
<ILMergeItems Include="$(MergeDirectory)\*.dll" />
</ItemGroup>
<MakeDir Directories="$(ILMergeArtifactDirectory)" Condition="!Exists('$(ILMergeArtifactDirectory)')" />
<!-- ILMerge does not yet support .NET 4.0 http://nitoprograms.blogspot.com/2010/09/using-ilmerge-with-net-40-andor-rx.html /targetplatform:v4,"%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" -->
<Exec Command=""$(ILMergeExe)" /targetplatform:"v4, %ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:exe /out:$(ILMergeFileFinalName) /log:"$(ILMergeArtifactDirectory)\ilmerge.log" /ndebug /allowDup $(ILMergeFileFinalName) %(ILMergeItems.FileName)%(ILMergeItems.Extension)" WorkingDirectory="$(MergeDirectory)" />
<!-- For some reason ILMerge is not deleting files that are merged in - but they are merging in just fine -->
<Delete Files="@(ILMergeItems)" />
</Target>
<Target Name="ILMergeMSBuild">
<ItemGroup>
<MSBuildILMergeItems Include="$(MSBuildDropDirectory)\NuGet.Core.dll" />
</ItemGroup>
<MakeDir Directories="$(ILMergeArtifactDirectory)" Condition="!Exists('$(ILMergeArtifactDirectory)')" />
<!-- ILMerge does not yet support .NET 4.0 http://nitoprograms.blogspot.com/2010/09/using-ilmerge-with-net-40-andor-rx.html /targetplatform:v4,"%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" -->
<Exec Command=""$(ILMergeExe)" /targetplatform:"v4, %ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:dll /out:$(MSBuildILMergeFileFinalName) /log:"$(ILMergeArtifactDirectory)\ilmerge.msbuild.log" /ndebug /allowDup $(MSBuildILMergeFileFinalName) %(MSBuildILMergeItems.FileName)%(MSBuildILMergeItems.Extension)" WorkingDirectory="$(MSBuildDropDirectory)" />
<!-- For some reason ILMerge is not deleting files that are merged in - but they are merging in just fine -->
<Delete Files="@(MSBuildILMergeItems)" />
</Target>
<Target Name="BuildPackages">
<PropertyGroup>
<NuGetExe>$(ExeDropDirectory)\NuGet.exe</NuGetExe>
</PropertyGroup>
<Exec Command=""$(NuGetExe)" pack" WorkingDirectory="$(ExeDropDirectory)" />
<Exec Command=""$(NuGetExe)" pack -o $(ServerDropDirectory) -exclude **\NuGet.Core.*" WorkingDirectory="$(ServerBuildDirectory)" />
<Exec Command=""$(NuGetExe)" pack -o $(NuGetCoreDropDirectory)" WorkingDirectory="$(NuGetCoreBuildDirectory)" />
</Target>
<Target Name="RunIntegrationTests">
<MSBuild Projects="$(NuGetTestRoot)\Test.Integration\Test.Integration.csproj" Targets="RunIntegrationTests" />
</Target>
</Project>