forked from dotnet/SqlClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
204 lines (174 loc) · 16.2 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
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="Current" DefaultTargets="BuildAllConfigurations" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="src/Directory.Build.props" />
<Import Project="$(ToolsDir)targets\GenerateNugetPackage.targets" />
<Import Project="$(ToolsDir)targets\add-ons\GenerateAKVProviderNugetPackage.targets" />
<PropertyGroup>
<RestoreConfigFile>src\NuGet.config</RestoreConfigFile>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<!-- Flag to control whether or not to build Microsoft.DotNet.GenAPI project in tools -->
<BuildTools Condition="'$(BuildTools)' == ''">true</BuildTools>
<!-- Flag to control if Windows drivers should be built or not -->
<IsEnabledWindows Condition="'$(IsEnabledWindows)' == '' AND '$(TargetsWindows)' == 'true'">true</IsEnabledWindows>
<IsEnabledWindows Condition="'$(TargetsUnix)' == 'true'">false</IsEnabledWindows>
<TestOS Condition="'$(TestTargetOS)' == '' AND '$(TargetsWindows)' == 'true'">Windows</TestOS>
<TestOS Condition="'$(TestTargetOS)' == '' AND '$(TargetsUnix)' == 'true'">Unix</TestOS>
<TF Condition="$(TF) == ''">netcoreapp3.1</TF> <!-- Default Target Framework -->
<TFGroup Condition="$(TF.StartsWith('net4'))">netfx</TFGroup>
<TFGroup Condition="$(TFGroup) == ''">netcore</TFGroup>
<TargetGroup Condition="$(TF.StartsWith('net4'))">netfx</TargetGroup>
<TargetGroup Condition="$(TargetGroup) == ''">netcoreapp</TargetGroup>
<TargetNetCoreVersion Condition="$(TargetGroup) == 'netcoreapp' AND $(TargetNetCoreVersion) == ''">$(TF)</TargetNetCoreVersion>
<TargetNetFxVersion Condition="$(TargetGroup) == 'netfx' AND $(TargetNetFxVersion) == ''">$(TF)</TargetNetFxVersion>
<GenerateNuget Condition="'$(GenerateNuget)' == ''">true</GenerateNuget>
<SqlServerLibProperties>Configuration=$(Configuration);AssemblyVersion=$(SqlServerAssemblyVersion);AssemblyFileVersion=$(SqlServerAssemblyFileVersion);Version=$(SqlServerPackageVersion);</SqlServerLibProperties>
<ProjectProperties>Configuration=$(Configuration);AssemblyFileVersion=$(AssemblyFileVersion);TargetsWindows=$(TargetsWindows);TargetsUnix=$(TargetsUnix);</ProjectProperties>
<TestProjectProperties>BuildProjectReferences=false;$(ProjectProperties);BuildForRelease=false;TargetNetCoreVersion=$(TargetNetCoreVersion);TargetNetFxVersion=$(TargetNetFxVersion)</TestProjectProperties>
<ResultsDirectory Condition="$(ResultsDirectory) == ''">TestResults</ResultsDirectory>
</PropertyGroup>
<!-- Release Build properties must be turned on for Release purposes, and turned off for Code Coverage calculations -->
<PropertyGroup>
<BuildForRelease Condition="$(BuildForRelease) == ''">true</BuildForRelease>
<CI>ContinuousIntegrationBuild=$(BuildForRelease);EmbedUntrackedSources=$(BuildForRelease)</CI>
</PropertyGroup>
<!-- Populate all managed projects -->
<ItemGroup>
<SqlServerLib Include="**/Microsoft.SqlServer.Server.csproj" />
<NetFxDriver Include="**/netfx/**/Microsoft.Data.SqlClient*.csproj" Condition="'$(IsEnabledWindows)' == 'true'" />
<NetCoreDriver Include="**/netcore/**/Microsoft.Data.SqlClient*.csproj" />
<AKVProvider Include="**/add-ons/**/AzureKeyVaultProvider/*.csproj" />
<FunctionalTests Condition="$(ReferenceType.Contains('NetStandard'))" Include="**/NSLibrary/Microsoft.Data.SqlClient.NSLibrary.csproj" />
<FunctionalTests Include="**/tools/TDS/TDS/TDS.csproj" />
<FunctionalTests Include="**/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj" />
<FunctionalTests Include="**/tools/TDS/TDS.Servers/TDS.Servers.csproj" />
<FunctionalTests Include="**/tools/Microsoft.DotNet.XUnitExtensions/Microsoft.DotNet.XUnitExtensions.csproj" />
<FunctionalTests Include="**/tools/CoreFx.Private.TestUtilities/CoreFx.Private.TestUtilities.csproj" />
<FunctionalTests Include="**/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />
<FunctionalTests Include="**/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" />
<FunctionalTestsProj Include="**/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" />
<ManualTests Condition="$(ReferenceType.Contains('NetStandard'))" Include="**/NSLibrary/Microsoft.Data.SqlClient.NSLibrary.csproj" />
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj" />
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj" />
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj" />
<ManualTests Include="**/tools/Microsoft.DotNet.XUnitExtensions/Microsoft.DotNet.XUnitExtensions.csproj" />
<ManualTests Include="**/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj"/>
<ManualTests Include="**/tools/CoreFx.Private.TestUtilities/CoreFx.Private.TestUtilities.csproj" />
<ManualTests Include="**/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj" />
<ManualTests Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" />
<ManualTestsProj Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" />
</ItemGroup>
<!-- Top Level Build targets -->
<Target Name="Restore" DependsOnTargets="RestoreSqlServerLib;RestoreNetCore;RestoreNetFx" />
<Target Name="BuildAll" DependsOnTargets="BuildSqlServerLib;BuildNetFx;BuildNetCore" />
<Target Name="BuildAllConfigurations" DependsOnTargets="Restore;BuildTools;BuildSqlServerLib;BuildNetFx;BuildNetCoreAllOS;GenerateNugetPackage" />
<Target Name="BuildSqlServerPackage" DependsOnTargets="BuildSqlServerLibAnyOS;GenerateSqlServerPackage"/>
<Target Name="BuildTestsNetCore" DependsOnTargets="RestoreTestsNetCore;BuildAKVNetCore;BuildFunctionalTestsNetCore;BuildManualTestsNetCore"/>
<Target Name="BuildTestsNetFx" DependsOnTargets="BuildSqlServerLib;RestoreTestsNetFx;BuildAKVNetFx;BuildFunctionalTestsNetFx;BuildManualTestsNetFx" Condition="$(IsEnabledWindows) == 'true'"/>
<Target Name="BuildTests" DependsOnTargets="BuildTestsNetCore;BuildTestsNetFx"/>
<Target Name="RestoreSqlServerLib">
<MSBuild Projects="@(SqlServerLib)" Targets="restore" />
</Target>
<Target Name="RestoreNetCore">
<MSBuild Projects="@(NetCoreDriver)" Targets="restore" />
</Target>
<Target Name="RestoreTestsNetCore">
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)"/>
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="$(TestProjectProperties)"/>
</Target>
<Target Name="RestoreNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(NetFxDriver)" Targets="restore" />
</Target>
<Target Name="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)"/>
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="$(TestProjectProperties)"/>
</Target>
<Target Name="BuildTools" Condition="'$(BuildTools)' == 'true'">
<PropertyGroup>
<DotnetBuildCmd>$(DotNetCmd) dotnet build -c Release -p:ReferenceType=$(ReferenceType)"</DotnetBuildCmd>
</PropertyGroup>
<Exec Command="$(DotnetBuildCmd)" WorkingDirectory="$(GenAPISrcDir)Microsoft.DotNet.GenAPI\" />
</Target>
<Target Name="BuildNetFx" DependsOnTargets="RestoreNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(NetFxDriver)" Properties="$(CI);Platform=AnyCPU;$(ProjectProperties)" />
</Target>
<Target Name="BuildSqlServerLibAnyOS" DependsOnTargets="RestoreSqlServerLib">
<MSBuild Projects="@(SqlServerLib)" Properties="$(CI);$(SqlServerLibProperties);Platform=AnyCPU;OSGroup=AnyOS" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<Target Name="BuildSqlServerLib" DependsOnTargets="RestoreSqlServerLib">
<MSBuild Projects="@(SqlServerLib)" Properties="$(CI);$(SqlServerLibProperties);Platform=AnyCPU;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<Target Name="BuildNetCore" DependsOnTargets="RestoreNetCore">
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);Platform=AnyCPU;$(ProjectProperties)" />
</Target>
<Target Name="BuildNetCoreAllOS" DependsOnTargets="RestoreNetCore">
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;" RemoveProperties="TargetsWindows;TargetsUnix;" />
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT;" RemoveProperties="TargetsWindows;TargetsUnix;" Condition="'$(IsEnabledWindows)' == 'true'" />
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<Target Name="BuildFunctionalTestsNetCore" DependsOnTargets="RestoreTestsNetCore">
<!-- Only build platform specific builds for Package reference types -->
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))"/>
</Target>
<Target Name="BuildManualTestsNetCore" DependsOnTargets="RestoreTestsNetCore">
<!-- Only build platform specific builds for Package reference types -->
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))"/>
</Target>
<Target Name="BuildFunctionalTestsNetFx" DependsOnTargets="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=$(Platform);" />
</Target>
<Target Name="BuildManualTestsNetFx" DependsOnTargets="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=$(Platform);" />
</Target>
<!-- Tests -->
<Target Name="RunTests" DependsOnTargets="RunFunctionalTests;RunManualTests"/>
<Target Name="RunFunctionalTests">
<!-- Windows -->
<Exec ConsoleToMsBuild="true" Command="dotnet test "@(FunctionalTestsProj)" -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) --no-build -v n --collect "Code coverage" -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter "category!=non$(TargetGroup)tests&category!=failing&category!=nonwindowstests" "--logger:trx;LogFileName=Functional.trx"" Condition="'$(IsEnabledWindows)' == 'true'"/>
<!-- Unix -->
<Exec ConsoleToMsBuild="true" Command="dotnet test "@(FunctionalTestsProj)" -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) --no-build -v n -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests" "--logger:trx;LogFileName=Functional.trx"" Condition="'$(IsEnabledWindows)' != 'true'"/>
</Target>
<Target Name="RunManualTests">
<!-- Windows -->
<Exec ConsoleToMsBuild="true" Command="dotnet test "@(ManualTestsProj)" -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) --no-build -v n --collect "Code coverage" -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter "category!=non$(TargetGroup)tests&category!=failing&category!=nonwindowstests" "--logger:trx;LogFileName=Manual.trx"" Condition="'$(IsEnabledWindows)' == 'true'"/>
<!-- Unix -->
<Exec ConsoleToMsBuild="true" Command="dotnet test "@(ManualTestsProj)" -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) --no-build -v n -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests" "--logger:trx;LogFileName=Manual.trx"" Condition="'$(IsEnabledWindows)' != 'true'"/>
</Target>
<Target Name="Clean">
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","artifacts", SearchOption.AllDirectories))' />
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","bin", SearchOption.AllDirectories))' />
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","obj", SearchOption.AllDirectories))' />
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","packages", SearchOption.AllDirectories))' />
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".",".nuget", SearchOption.AllDirectories))' />
</Target>
<Target Name="BuildAKVNetFx" Condition="'$(IsEnabledWindows)' == 'true' AND !$(ReferenceType.Contains('NetStandard'))">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="TestTargetOS=$(TestOS)netfx" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netfx;Platform=$(Platform);$(TestProjectProperties)" />
</Target>
<Target Name="BuildAKVNetCore">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="TestTargetOS=$(TestOS)netcoreapp" />
<!-- Only build platform specific builds for Package reference types -->
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))"/>
</Target>
<Target Name="BuildAKVNetSt">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="TestTargetOS=$(TestOS)netstandard" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netstandard;$(ProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netstandard;$(ProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))"/>
</Target>
<Target Name="BuildAKVNetCoreAllOS">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="TestTargetOS=$(TestOS)netcoreapp" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;" RemoveProperties="TargetsWindows;TargetsUnix;" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT;" RemoveProperties="TargetsWindows;TargetsUnix;" Condition="'$(IsEnabledWindows)' == 'true'" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<Target Name="BuildAKVNetStAllOS" >
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="TestTargetOS=$(TestOS)netstandard" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netstandard;$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;" RemoveProperties="TargetsWindows;TargetsUnix;" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netstandard;$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT;" RemoveProperties="TargetsWindows;TargetsUnix;" Condition="'$(IsEnabledWindows)' == 'true'" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netstandard;$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
</Project>