Skip to content

Commit 1544e3c

Browse files
committed
Task 41737: Merge feat/azure-split to main: Step 3 - Tie everything together
- Addressed PR comments/suggestions.
1 parent eac8d45 commit 1544e3c

18 files changed

Lines changed: 110 additions & 121 deletions

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,10 @@ PublishScripts/
193193
*.nupkg
194194
# NuGet Symbol Packages
195195
*.snupkg
196-
# The packages folder can be ignored because of Package Restore
196+
# Most of the packages folder can be ignored.
197197
**/[Pp]ackages/*
198-
# except build/, which is used as an MSBuild target.
199-
!**/[Pp]ackages/build/
200-
# Uncomment if necessary however generally it will be regenerated when needed
201-
#!**/[Pp]ackages/repositories.config
198+
!**/[Pp]ackages/.gitkeep
199+
202200
# NuGet v3's project.json files produces more ignorable files
203201
*.nuget.props
204202
*.nuget.targets

BUILDGUIDE.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -211,27 +211,13 @@ dependencies.
211211
Alternatively, the `ReferenceType` build property may be specified with a value
212212
of `Package`. This will change inter-component dependencies to use
213213
`<PackageReference>` dependencies, and require that dependent components be
214-
built and packaged before building the depending component. In this scenario,
215-
the root `NuGet.config` file must be updated to include the following entry
216-
under the `<packageSources>` element:
217-
218-
```xml
219-
<configuration>
220-
<packageSources>
221-
...
222-
<add key="local" value="packages/" />
223-
</packageSources>
224-
</configuration>
225-
```
226-
227-
As a convenience, a `NuGet.config.local` file is supplied with the above
228-
package source already present. You may simply copy it over `NuGet.config`
229-
when using `Package` references.
214+
built and packaged before building the depending component. This will generate NuGet
215+
packages in the root packages/ directory, and will be automatically searched by NuGet
216+
(see our root `NuGet.config`).
230217

231218
Then, you can specify `Package` references be used, for example:
232219

233220
```bash
234-
cp NuGet.config.local NuGet.config
235221
dotnet build -t:BuildAbstractions
236222
dotnet build -t:BuildAzure -p:ReferenceType=Package
237223
dotnet build -t:BuildAll -p:ReferenceType=Package

NuGet.config

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
4+
55
<!-- Clear all inherited feeds. -->
66
<clear />
77

88
<!--
9-
We do not use the public nuget.org feed. Instead, we use a governed
10-
feed maintained by our SqlClientDrivers ADO organization. Packages must
11-
be individually vetted and added to this feed manually before they will
12-
be available for consumption by our builds.
9+
We do not use the public nuget.org feed. Instead, we use a governed feed maintained by our
10+
SqlClientDrivers ADO organization. Packages must be individually vetted and added to this
11+
feed manually before they will be available for consumption by our builds.
1312
1413
https://sqlclientdrivers.visualstudio.com/public/_artifacts/feed/sqlclient
1514
-->
1615
<add key="governed" value="https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/sqlclient/nuget/v3/index.json" />
16+
17+
<!--
18+
This package source is used by developers and our pipelines builds when we need to reference
19+
packages that are not available on the public nuget.org feed, for example to test MDS that
20+
depends on a version of Abstractions that was just built in the workspace.
21+
-->
22+
<add key="local" value="packages/" />
23+
1724
</packageSources>
1825
</configuration>

NuGet.config.local

Lines changed: 0 additions & 16 deletions
This file was deleted.

build.proj

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,14 @@
285285
<!-- Run all unit tests applicable to Windows. -->
286286
<Target Name="RunUnitTestsWindows" Condition="'$(IsEnabledWindows)' == 'true' AND $(ReferenceType.Contains('Project'))">
287287
<PropertyGroup>
288+
<!--
289+
The UnitTests project exclusively uses Project references, which is the default applied by
290+
src/Directory.Build.props, so no need to specify the ReferenceType property here.
291+
-->
288292
<TestCommand>
289293
$(DotnetPath)dotnet test "@(UnitTestsProj)"
290294
-f $(TF)
291295
-p:Configuration=$(Configuration)
292-
-p:ReferenceType=Project
293296
$(CollectStatement)
294297
--results-directory $(ResultsDirectory)
295298
--filter "$(FilterStatement)"
@@ -312,7 +315,6 @@
312315
$(DotnetPath)dotnet test "@(UnitTestsProj)"
313316
-f $(TF)
314317
-p:Configuration=$(Configuration)
315-
-p:ReferenceType=Project
316318
$(CollectStatement)
317319
--results-directory $(ResultsDirectory)
318320
--filter "$(FilterStatement)"
@@ -446,7 +448,12 @@
446448
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "bin", SearchOption.AllDirectories))' />
447449
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", ".nuget", SearchOption.AllDirectories))' />
448450
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "obj", SearchOption.AllDirectories))' />
449-
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","packages", SearchOption.AllDirectories))' />
451+
<!-- We keep packages/ but remove all of the generated files. -->
452+
<ItemGroup>
453+
<PackagesToDelete Include="$(RepoRoot)/packages/*.nupkg" />
454+
<PackagesToDelete Include="$(RepoRoot)/packages/*.snupkg" />
455+
</ItemGroup>
456+
<Delete Files="@(PackagesToDelete)" />
450457
</Target>
451458

452459
<!-- AKV Targets ========================================================= -->

eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,8 @@ jobs:
7575
# configuration
7676
- ${{ parameters.prebuildSteps }}
7777

78-
# If we're testing in Package mode, we have a few additional steps.
78+
# If we're testing in Package mode, then we must download the Abstractions package artifacts.
7979
- ${{ if eq(parameters.referenceType, 'Package') }}:
80-
81-
# Create the packages/ directory.
82-
- pwsh: New-Item -Path "$(Build.SourcesDirectory)/packages" -ItemType Directory -Force
83-
displayName: Create packages/ directory
84-
85-
# Setup the top-level NuGet.config to look in packages/ for local NuGet
86-
# dependencies.
87-
- pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force
88-
displayName: Use local NuGet packages
89-
90-
# Download the Abstractions package artifacts.
9180
- task: DownloadPipelineArtifact@2
9281
displayName: Download Abstractions Package Artifacts
9382
inputs:
@@ -127,8 +116,8 @@ jobs:
127116
nuspecPath: 'tools/specs/Microsoft.Data.SqlClient.nuspec'
128117
outputDirectory: $(packagePath)
129118
packageVersion: ${{ parameters.mdsPackageVersion }}
130-
referenceType: ${{ parameters.referenceType }}
131119
properties: 'AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }}'
120+
referenceType: ${{ parameters.referenceType }}
132121

133122
- template: /eng/pipelines/common/templates/steps/ci-project-build-step.yml@self
134123
parameters:
@@ -148,8 +137,8 @@ jobs:
148137
nuspecPath: 'tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec'
149138
outputDirectory: $(packagePath)
150139
packageVersion: $(akvPackageVersion)
151-
referenceType: ${{ parameters.referenceType }}
152140
properties: 'MdsPackageVersion=${{ parameters.mdsPackageVersion }}'
141+
referenceType: ${{ parameters.referenceType }}
153142

154143
- task: PublishPipelineArtifact@1
155144
displayName: 'Publish Pipeline Artifacts'

eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ jobs:
4444

4545
- ${{parameters.downloadPackageStep }}
4646

47-
- pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force
48-
displayName: Use local NuGet packages
49-
5047
- template: /eng/pipelines/common/templates/steps/update-config-file-step.yml
5148
parameters:
5249
TCPConnectionString: $(SQL_TCP_CONN_STRING)

eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ steps:
2828
# Install the .NET SDK.
2929
- template: /eng/pipelines/steps/install-dotnet.yml@self
3030

31-
# Configure NuGet to use the local packages/ directory where the Abstractions
32-
# package will be.
33-
- pwsh: New-Item -Path "$(packageFolderName)" -ItemType Directory -Force
34-
displayName: Create packages/ directory
35-
36-
- pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force
37-
displayName: Use local NuGet packages
38-
3931
- task: MSBuild@1
4032
displayName: 'BuildAllConfigurations using build.proj'
4133
inputs:

eng/pipelines/common/templates/steps/override-sni-version.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,36 @@ steps:
2222
# define file to update
2323
$NugetCfg = Join-Path -Path '.' -ChildPath 'NuGet.config'
2424
type $NugetCfg
25-
25+
2626
# load content of xml from file defined above
2727
$xml = New-Object XML
2828
$xml.Load($NugetCfg)
29-
29+
3030
# define namespace used to read a node
3131
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
3232
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
33-
33+
3434
# get the package sources node
3535
$packageSources = $xml.SelectSingleNode('//ns:packageSources', $nsm)
36-
36+
3737
# define new package source
3838
$newSource = $xml.CreateElement("add")
3939
$newSource.SetAttribute("key","SNIValidation")
4040
$newSource.SetAttribute("value","${{parameters.SNIValidationFeed}}")
41-
41+
4242
# add the new package source
4343
$packageSources.AppendChild($newSource)
44-
44+
4545
# save the xml file
4646
$xml.Save($NugetCfg)
4747
type $NugetCfg
4848
- task: PowerShell@2
4949
displayName: Update SNI Version in Versions.props
5050
inputs:
5151
targetType: inline
52+
# TODO(https://sqlclientdrivers.visualstudio.com/ADO.Net/_workitems/edit/42204):
53+
# Package dependency versions have moved to Directory.Packages.props, so the below script no
54+
# longer functions.
5255
script: |
5356
Write-Host "SNI Version to test = ${{parameters.SNIVersion}}"
5457
@@ -60,7 +63,7 @@ steps:
6063
$xml = New-Object XML
6164
$xml.Load($PropsPath)
6265
63-
# define namespace used to read a node
66+
# define namespace used to read a node
6467
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
6568
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
6669

eng/pipelines/dotnet-sqlclient-ci-core.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,6 @@ stages:
226226
- pwsh: 'Get-ChildItem env: | Sort-Object Name'
227227
displayName: '[Debug] List Environment Variables'
228228

229-
- ${{if eq(parameters.referenceType, 'Package')}}:
230-
- pwsh: New-Item -Path "$(Build.SourcesDirectory)/packages" -ItemType Directory -Force
231-
displayName: Create packages/ directory
232-
- pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force
233-
displayName: Use local NuGet packages
234-
235229
# Include the code coverage job if the build type is Project.
236230
${{ if eq(parameters.referenceType, 'Project') }}:
237231
# Jobs to run as part of the tests stage, after the tests are done.

0 commit comments

Comments
 (0)