This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.proj
149 lines (125 loc) · 8.26 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
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="All" InitialTargets="Configure" TreatAsLocalProperty="RootSuffix" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="corebuild\corebuild.props" />
<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>
<GitInfoReportImportance>high</GitInfoReportImportance>
</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>
<ItemGroup>
<PackageReference Include="xunit.runner.console" Version="2.3.1" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="ReportGenerator" Version="2.4.5" />
</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" DependsOnTargets="GitInfoReport;SetVersion">
<!-- 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" />
<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>"$(XunitConsolePath)"</XunitConsole>
<XunitOptions>$(XunitOptions) -html $(Out)\test.html -xml $(Out)\test.xml -parallel none -noshadow</XunitOptions>
</PropertyGroup>
<Exec Command="$(XunitConsole) @(TestAssembly, ' ') $(XunitOptions)" ConsoleToMSBuild="true" />
</Target>
<Target Name="AfterRestore" AfterTargets="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>
<Target Name="Configure">
<Message Importance="high" Text="*********************************************************************************************************************" />
<Message Importance="high" Text="$([System.Environment]::CommandLine)" />
<Message Importance="high" Text="*********************************************************************************************************************" />
</Target>
<Import Project="src\Directory.Build.targets" />
<Import Project="corebuild\corebuild.targets" />
</Project>