|
69 | 69 | --> |
70 | 70 | <DotnetPath Condition="'$(DotnetPath)' == ''" /> |
71 | 71 |
|
72 | | - <!-- |
73 | | - NugetPath |
74 | | - Applies to: PackSqlClient |
75 | | - Description: Path to NuGet executable. Override if `nuget` is not included in the PATH |
76 | | - variable. |
77 | | - Default value: nuget |
78 | | - Example: C:\nuget\nuget.exe |
79 | | - --> |
80 | | - <NugetPath Condition="'$(NugetPath)' == ''">nuget</NugetPath> |
81 | | - |
82 | 72 | <!-- |
83 | 73 | PackBuild |
84 | 74 | Applies to: Pack* |
|
97 | 87 | --no-build |
98 | 88 | </PackBuildArgument> |
99 | 89 | <!-- |
100 | | - @TODO: This is kinda hacky, ideally we can pack via dotnet pack, which will handle building, |
101 | | - and can thus be switched off by passing -no-build. However, we're not there because we need |
102 | | - to build multiple projects before packaging, and thus need to use nuget. So, until then we |
103 | | - will switch off dependency building dynamically building the target dependencies |
| 90 | + SqlClient packaging uses dotnet pack and keeps this dependency gate so signed-binary workflows |
| 91 | + can still set PackBuild=false and package pre-built artifacts. |
104 | 92 | --> |
105 | 93 | <PackSqlClientDependsOn Condition="'$(PackBuild.ToLower())' == 'true'">BuildSqlClient</PackSqlClientDependsOn> |
106 | 94 |
|
|
394 | 382 | <SqlClientUnitTestProjectPath>$(SqlClientSrcRoot)tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj</SqlClientUnitTestProjectPath> |
395 | 383 |
|
396 | 384 | <!-- Tools/Specs Paths --> |
397 | | - <SqlClientNuspecPath>$(RepoRoot)tools/specs/Microsoft.Data.SqlClient.nuspec</SqlClientNuspecPath> |
398 | 385 | <GenApiPath>$(RepoRoot)tools/GenAPI/Microsoft.DotNet.GenAPI/</GenApiPath> |
399 | 386 | <GenApiProjectPath>$(GenApiPath)Microsoft.DotNet.GenAPI.csproj</GenApiProjectPath> |
400 | 387 | </PropertyGroup> |
|
531 | 518 |
|
532 | 519 | <!-- Pack SqlClient Target ===================================================== --> |
533 | 520 | <!-- |
534 | | - PackSqlClient: Packages SqlClient binaries into a NuGet package. |
535 | | - Because the SqlClient package depends on the "not supported" and ref projects, we can't use dotnet to |
536 | | - automatically build before packaging. Instead, we rely on target dependency to handle building |
537 | | - the same binaries that will be packaged. |
| 521 | + PackSqlClient: Packages SqlClient binaries with dotnet pack. |
| 522 | + The package layout is defined by a nuspec file because we package the artifacts from multiple |
| 523 | + projects into a single .nupkg file. |
538 | 524 | --> |
539 | 525 | <Target Name="PackSqlClient" DependsOnTargets="$(PackSqlClientDependsOn)"> |
540 | 526 | <PropertyGroup> |
|
549 | 535 | <Output TaskParameter="ConsoleOutput" PropertyName="CommitId" /> |
550 | 536 | </Exec> |
551 | 537 |
|
552 | | - <!-- This is a bit hacky, and can be (@TODO:) removed once packaging is done w/o a nuspec from dotnet --> |
| 538 | + <!-- Evaluate package version used to stamp the nuspec-driven pack output. --> |
553 | 539 | <PropertyGroup> |
554 | 540 | <GetSqlClientPackageVersionCommand> |
555 | | - "$(DotnetPath)dotnet" msbuild "$(SqlClientProjectPath)" |
| 541 | + "$(DotnetPath)dotnet" build "$(SqlClientProjectPath)" |
556 | 542 | -nologo |
557 | 543 | -verbosity:quiet |
558 | 544 | -getProperty:SqlClientPackageVersion |
|
571 | 557 | </Exec> |
572 | 558 | <Error Text="Failed to evaluate SqlClientPackageVersion for PackSqlClient." |
573 | 559 | Condition="'$(_EvaluatedSqlClientPackageVersion)' == ''" /> |
| 560 | + <Error Text="PackSqlClient requires PackageVersionAbstractions. Specify -p:PackageVersionAbstractions=<version>." |
| 561 | + Condition="'$(PackageVersionAbstractions)' == ''" /> |
| 562 | + <Error Text="PackSqlClient requires PackageVersionLogging. Specify -p:PackageVersionLogging=<version>." |
| 563 | + Condition="'$(PackageVersionLogging)' == ''" /> |
574 | 564 |
|
575 | 565 | <PropertyGroup> |
576 | 566 | <_EvaluatedSqlClientPackageVersion>$([System.Text.RegularExpressions.Regex]::Replace($(_EvaluatedSqlClientPackageVersion), "\s", ""))</_EvaluatedSqlClientPackageVersion> |
577 | 567 | <CommitId>$([System.Text.RegularExpressions.Regex]::Replace($(CommitId), "\s", ""))</CommitId> |
578 | | - <NuGetCommand> |
579 | | - "$(NugetPath)" pack "$(SqlClientNuspecPath)" |
580 | | - -Symbols |
581 | | - -SymbolPackageFormat snupkg |
582 | | - -Version "$(_EvaluatedSqlClientPackageVersion)" |
583 | | - -OutputDirectory "$(SqlClientArtifactRoot)/$(ReferenceType)-$(Configuration)" |
584 | | - -properties "COMMITID=$(CommitId);Configuration=$(Configuration);ReferenceType=$(ReferenceType);AbstractionsPackageVersion=$(PackageVersionAbstractions);LoggingPackageVersion=$(PackageVersionLogging)" |
585 | | - </NuGetCommand> |
| 568 | + <DotnetCommand> |
| 569 | + "$(DotnetPath)dotnet" pack "$(SqlClientProjectPath)" |
| 570 | + -p:Configuration=$(Configuration) |
| 571 | + $(PackBuildArgument) |
| 572 | + $(SigningKeyPathArgument) |
| 573 | + |
| 574 | + <!-- Versioning arguments --> |
| 575 | + $(BuildNumberArgument) |
| 576 | + $(BuildSuffixArgument) |
| 577 | + $(PackageVersionSqlClientArgument) |
| 578 | + |
| 579 | + <!-- Reference Type Arguments --> |
| 580 | + $(ReferenceTypeArgument) |
| 581 | + $(PackageVersionAbstractionsArgument) |
| 582 | + $(PackageVersionLoggingArgument) |
| 583 | + |
| 584 | + <!-- Pack settings are defined in Microsoft.Data.SqlClient.csproj --> |
| 585 | + -p:CommitId="$(CommitId)" |
| 586 | + -p:NuspecVersion="$(_EvaluatedSqlClientPackageVersion)" |
| 587 | + -p:PackageOutputPath="$(SqlClientArtifactRoot)/$(ReferenceType)-$(Configuration)" |
| 588 | + </DotnetCommand> |
586 | 589 | <!-- Convert more than one whitespace character into one space --> |
587 | | - <NuGetCommand>$([System.Text.RegularExpressions.Regex]::Replace($(NuGetCommand), "\s+", " "))</NuGetCommand> |
| 590 | + <DotnetCommand>$([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " "))</DotnetCommand> |
588 | 591 | </PropertyGroup> |
589 | | - <Message Text=">>> Packing SqlClient nuget via command: $(NuGetCommand)" /> |
590 | | - <Exec ConsoleToMsBuild="true" Command="$(NuGetCommand)" /> |
| 592 | + <Message Text=">>> Packing SqlClient via command: $(DotnetCommand)" /> |
| 593 | + <Exec ConsoleToMsBuild="true" Command="$(DotnetCommand)" /> |
591 | 594 | </Target> |
592 | 595 |
|
593 | 596 | <!-- Test SqlClient Targets ==================================================== --> |
|
0 commit comments