forked from NuGet/NuGet.Build.Packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.proj
168 lines (141 loc) · 9.48 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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="All" InitialTargets="Configure" TreatAsLocalProperty="RootSuffix" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="build.props" />
<PropertyGroup Condition="'$(IsCIBuild)' != 'true'">
<!-- Local build defaults -->
<Configuration Condition=" '$(Configuration)' == ''">Debug</Configuration>
</PropertyGroup>
<PropertyGroup Condition="'$(IsCIBuild)' == 'true'">
<Configuration Condition=" '$(Configuration)' == ''">Release</Configuration>
</PropertyGroup>
<PropertyGroup>
<NuGetUrl Condition=" '$(NuGetUrl)' == '' ">https://dist.nuget.org/win-x86-commandline/latest/nuget.exe</NuGetUrl>
<RestorePackages>false</RestorePackages>
<RunCodeAnalysis Condition=" '$(RunCodeAnalysis)' == ''">false</RunCodeAnalysis>
<IntermediateOutputPath>.nuget\</IntermediateOutputPath>
<PackagesPath>$(IntermediateOutputPath)packages</PackagesPath>
<CommonBuildProperties>WarningLevel=0;NoWarn=1591;Out=$(Out);Configuration=$(Configuration);RunCodeAnalysis=$(RunCodeAnalysis);PackageOutputPath=$(Out)</CommonBuildProperties>
<DefaultImportance Condition=" '$(DefaultImportance)' == '' ">high</DefaultImportance>
<PS>%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PS>
</PropertyGroup>
<ItemGroup>
<Solution Include="external\ApiIntersect\ApiIntersect.sln" />
<Solution Include="src\Build\NuGet.Build.Packaging.sln" />
<Solution Include="src\VisualStudio\NuGet.Packaging.VisualStudio.15\NuGet.Packaging.VisualStudio.15.csproj" />
<TestProject Include="src\Build\**\*Tests.csproj" />
</ItemGroup>
<Target Name="All" DependsOnTargets="Build;Test;Package" />
<Target Name="Clean">
<MSBuild Projects="@(Solution)" BuildInParallel="true" Properties="$(CommonBuildProperties)" Targets="Clean" />
<Exec Command="rmdir .vs /S /Q" ContinueOnError="true" />
<Exec Command="rmdir $(Out) /S /Q" Condition=" Exists('$(Out)') " ContinueOnError="true" />
<Exec Command="rmdir $(PackagesPath) /S /Q" Condition=" Exists('$(PackagesPath)') " ContinueOnError="true" />
</Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Target Name="Build">
<Exec Command="rmdir $(Out) /S /Q" Condition=" Exists('$(Out)') " ContinueOnError="true" StandardOutputImportance="low" />
<MakeDir Directories="$(Out)" Condition="!Exists('$(Out)')" />
<Message Text="Build properties: $(CommonBuildProperties)." Importance="high" />
<MSBuild Projects="@(Solution)" BuildInParallel="false" Properties="$(CommonBuildProperties);CreateVsixContainer=false;DeployExtension=false" />
</Target>
<Target Name="Package">
<MakeDir Directories="$(Out)" Condition="!Exists('$(Out)')" />
<MSBuild Projects="src\Build\NuGet.Build.Packaging.Tasks\NuGet.Build.Packaging.Tasks.csproj" Targets="Pack" Properties="$(CommonBuildProperties);PackOnBuild=true;NuGetBuildTasksPackTargets=NO-SDK-PACK" />
<MSBuild Projects="src\VisualStudio\NuGet.Packaging.VisualStudio.15\NuGet.Packaging.VisualStudio.15.csproj" Properties="$(CommonBuildProperties);PackOnBuild=true" />
<ItemGroup>
<OutputFile Include="$(Out)\*.nupkg" />
<OutputFile Include="$(Out)\*.vsix" />
</ItemGroup>
<Copy SourceFiles="@(OutputFile)" DestinationFolder="$(MSBuildThisFileDirectory)" Condition="'$(APPVEYOR)' == 'true'"/>
</Target>
<Target Name="Test" DependsOnTargets="Build">
<MSBuild Projects="@(TestProject)" BuildInParallel="true" Targets="GetTargetPath" Properties="$(CommonBuildProperties)">
<Output TaskParameter="TargetOutputs" ItemName="_TestAssembly" />
</MSBuild>
<ItemGroup>
<TestAssembly Include="@(_TestAssembly)" Condition="Exists('%(FullPath)')" />
</ItemGroup>
<MakeDir Directories="$(Out)" Condition="!Exists('$(Out)')" />
<PropertyGroup>
<XunitConsole>"$(PackagesPath)\xunit.runner.console\tools\xunit.console.exe"</XunitConsole>
<XunitOptions>$(XunitOptions) -html $(Out)\test.html -xml $(Out)\test.xml -parallel all -noshadow</XunitOptions>
</PropertyGroup>
<Exec Command="$(XunitConsole) @(TestAssembly, ' ') $(XunitOptions)" ConsoleToMSBuild="true" />
</Target>
<Target Name="Restore">
<ItemGroup>
<RestoreProject Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_non_nugetized_reference\b.sln" />
<RestoreProject Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_multi_platform_solution\forms.sln" />
<RestoreProject Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_json_dependencies\a.csproj" />
<RestoreProject Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_packaging_project_with_netstandard\a.nuproj" />
<RestoreProject Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_private_assets_reference\a.csproj" />
</ItemGroup>
<MSBuild Projects="@(Solution);@(TestProject);@(RestoreProject)" Targets="Restore" Properties="$(CommonBuildProperties)" />
</Target>
<Target Name="Coverage" DependsOnTargets="Build">
<!-- Run tests but using code coverage -->
<MSBuild Projects="@(TestProject)" BuildInParallel="true" Targets="GetTargetPath" Properties="$(CommonBuildProperties)">
<Output TaskParameter="TargetOutputs" ItemName="_TestAssembly" />
</MSBuild>
<ItemGroup>
<TestAssembly Include="@(_TestAssembly)" Condition="Exists('%(FullPath)')" />
</ItemGroup>
<MakeDir Directories="$(Out)" Condition="!Exists('$(Out)')" />
<PropertyGroup>
<XunitOptions>$(XunitOptions) -html $(Out)\test.html -xml $(Out)\test.xml -parallel none -noshadow </XunitOptions>
<CoverageConsole>$(PackagesPath)\OpenCover\tools\OpenCover.Console.exe</CoverageConsole>
<CoverageOptions>$(CoverageOptions) -output:$(Out)\coverage.xml -returntargetcode -register:user -filter:"+[NuGet.Build.Packaging*]* -[NuGet.Packaging.Core*]* -[NuGet.Packaging.VisualStudio*]* -[Clide*]* -[xunit*]* -[*Tests]* -[*]*ThisAssembly*" -excludebyattribute:*ExcludeFromCodeCoverage*;*CompilerGenerated* -skipautoprops -showunvisited -mergebyhash</CoverageOptions>
<CoverageCommand>$(CoverageConsole) $(CoverageOptions) -target:$(XunitConsole) -targetargs:"@(TestAssembly, ' ') $(XunitOptions)"</CoverageCommand>
<ReportConsole>$(PackagesPath)\ReportGenerator\tools\ReportGenerator.exe</ReportConsole>
<ReportOptions>-reports:$(Out)\coverage.xml -targetdir:$(Out)\coverage -reporttypes:Html;Xml;Badges</ReportOptions>
</PropertyGroup>
<Message Importance="high" Text="Executing: $(CoverageCommand)" />
<Exec Command="$(CoverageCommand)"
ConsoleToMSBuild="true"
StandardErrorImportance="high"
StandardOutputImportance="normal" />
<MakeDir Directories="$(Out)\coverage" Condition="!Exists('$(Out)\coverage')" />
<Exec Command="$(ReportConsole) $(ReportOptions)"
ConsoleToMSBuild="true"
StandardErrorImportance="high"
StandardOutputImportance="normal" />
<Exec Command="start $(Out)\coverage\index.htm" />
</Target>
<!-- Configure and restore initial targets and packages -->
<Import Project="src\NuGet.Restore.targets" />
<PropertyGroup>
<GitInfoTargets>$(PackagesPath)\GitInfo\build\GitInfo.targets</GitInfoTargets>
<XunitConsole>$(PackagesPath)\xunit.runner.console\tools\xunit.console.x86.exe</XunitConsole>
<XunitBuildDir>$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', '.nuget', 'packages', 'xunit.runner.msbuild', 'build'))</XunitBuildDir>
<XunitProps>$([System.IO.Path]::Combine($(XunitBuildDir), 'xunit.runner.msbuild.props'))</XunitProps>
<PendingRestore Condition=" !Exists('$(GitInfoTargets)') Or !Exists('$(XunitConsole)') Or !Exists('$(XunitProps)') ">true</PendingRestore>
</PropertyGroup>
<Import Project="$(XunitProps)" Condition="Exists('$(XunitProps)')"/>
<Target Name="GitVersion">
<PropertyGroup>
<GitSemVerMajor>1</GitSemVerMajor>
<GitSemVerMinor>0</GitSemVerMinor>
<GitSemVerPatch>0</GitSemVerPatch>
</PropertyGroup>
</Target>
<Import Project="$(GitInfoTargets)" Condition="Exists('$(GitInfoTargets)')"/>
<Import Project="src\PackageVersion.targets" />
<Target Name="Configure" DependsOnTargets="DownloadNuGet;GetPackageVersion">
<Message Importance="high" Text="*********************************************************************************************************************" />
<Message Importance="high" Text="$([System.Environment]::CommandLine)" />
<Message Importance="high" Text="*********************************************************************************************************************" />
<Exec Command='"$(NuGet)" Install "$(MSBuildThisFileDirectory)packages.config" -OutputDirectory "$(PackagesPath)" -ExcludeVersion -Verbosity quiet'
StandardOutputImportance="low"
Condition=" '$(PendingRestore)' == 'true' " />
<!-- Invoke GitVersion just like the project-level targets do -->
<MSBuild Projects="$(GitInfoTargets)" Targets="GitVersion;GitInfoReport" Properties="GitInfoReportImportance=high">
<Output TaskParameter="TargetOutputs" ItemName="GitInfo" />
</MSBuild>
<!-- For now this is an informative version #, used to update CI -->
<Message Text="Building version $(PackageVersion)" Importance="high" />
<!-- Update AppVeyor build # to match the actual one being used -->
<Exec Command="appveyor UpdateBuild -Version $(PackageVersion)" Condition=" '$(APPVEYOR)' == 'true' "
ConsoleToMSBuild="true"
ContinueOnError="WarnAndContinue" />
</Target>
</Project>