Skip to content

Commit

Permalink
Enhance project and target files to generate debugging symbol package…
Browse files Browse the repository at this point in the history
… files (#2137)
  • Loading branch information
arellegue committed Jan 24, 2024
1 parent c8b70f1 commit 7fd34df
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 21 deletions.
10 changes: 7 additions & 3 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
The provided path should be ended to a `\` character without white spaces: Ex. C:\x86\
-->
<DotnetPath></DotnetPath>
<!-- Using these properties to compile and pack netfx dll fixes nuget package explorer error "Compiler flags: missing" -->
<NugetPackProperties>DebugType=portable;DebugSymbols=true;IncludeSymbols=true;SymbolPackageFormat=snupkg;PublishRepositoryUrl=true;RepositoryUrl=https://github.com/dotnet/sqlclient;RepositoryType=git;EmbedUnTrackedSources=true;Deterministic=true;</NugetPackProperties>
<!-- TF_BUILD is enabled only within AzureDevOps pipeline to support continuous integation build. -->
<NugetPackProperties Condition="'$(TF_BUILD)' == 'true'">$(NugetPackProperties);ContinuousIntegrationBuild=true;</NugetPackProperties>
</PropertyGroup>

<!-- Release Build properties must be turned on for Release purposes, and turned off for Code Coverage calculations -->
Expand Down Expand Up @@ -109,7 +113,7 @@
</Target>

<Target Name="BuildNetFx" DependsOnTargets="RestoreNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(NetFxDriver)" Properties="$(CI);Platform=AnyCPU;$(ProjectProperties)" />
<MSBuild Projects="@(NetFxDriver)" Properties="$(CI);Platform=AnyCPU;$(ProjectProperties);$(NugetPackProperties);" />
</Target>

<Target Name="BuildSqlServerLibAnyOS" DependsOnTargets="RestoreSqlServerLib">
Expand Down Expand Up @@ -198,11 +202,11 @@
<Target Name="BuildAKVNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="TestTargetOS=$(TestOS)netfx" />
<Message Text=">>> Building AKVNetFx [$(CI);TestTargetOS=$(TestOS)netfx;Platform=AnyCPU;$(TestProjectProperties)] ..." Condition="!$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netfx;Platform=AnyCPU;$(TestProjectProperties)" Condition="!$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netfx;Platform=AnyCPU;$(TestProjectProperties);$(NugetPackProperties);" Condition="!$(ReferenceType.Contains('Package'))"/>

<!-- Only build platform specific builds for Package reference types -->
<Message Text=">>> Building AKVNetFx [$(CI);TestTargetOS=$(TestOS)netfx;Platform=$(Platform);$(TestProjectProperties)] ..." Condition="$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netfx;Platform=$(Platform);$(TestProjectProperties);" Condition="$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netfx;Platform=$(Platform);$(TestProjectProperties);$(NugetPackProperties);" Condition="$(ReferenceType.Contains('Package'))"/>
</Target>

<Target Name="BuildAKVNetCore">
Expand Down
17 changes: 17 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@
<DefineConstants>$(DefineConstants);ENCLAVE_SIMULATOR</DefineConstants>
</PropertyGroup>

<!-- Packaging for source link-->
<PropertyGroup>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUnTrackedSources>true</EmbedUnTrackedSources>
</PropertyGroup>
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All">
</PackageReference>
</ItemGroup>


<!-- Provides Version properties -->
<Import Project="$(ToolsDir)props\Versions.props" />
<Import Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))" Project="$(ToolsDir)props\VersionsNet8OrLater.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(GeneratedSourceFileName)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
<EmbeddedFiles Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Condition="'$(TargetGroup)'=='netcoreapp' AND !$(ReferenceType.Contains('Package'))" Include="$(NetCoreSource)src\Microsoft.Data.SqlClient.csproj" />
<ProjectReference Condition="'$(TargetGroup)'=='netfx' AND !$(ReferenceType.Contains('Package'))" Include="$(NetFxSource)src\Microsoft.Data.SqlClient.csproj" />
<PackageReference Condition="$(ReferenceType.Contains('Package'))" Include="Microsoft.Data.SqlClient" Version="$(TestMicrosoftDataSqlClientVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Condition="$(BuildForRelease) == 'true'" Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
<PackageReference Include="Azure.Core" Version="$(AzureCoreVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebVersion)" />
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="$(AzureSecurityKeyVaultKeysVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
<NoWarn>$(NoWarn);IL2026;IL2057;IL2072;IL2075</NoWarn>
</PropertyGroup>
<PropertyGroup>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
<EmbeddedFiles Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
</ItemGroup>
<!-- Contains common items shared between NetFx and NetCore -->
<ItemGroup Condition="'$(OSGroup)' != 'AnyOS'">
<Compile Include="..\..\src\Microsoft\Data\Common\ActivityCorrelator.cs">
Expand Down Expand Up @@ -1011,7 +1014,6 @@
<PackageReference Include="Microsoft.Identity.Client" Version="$(MicrosoftIdentityClientVersion)" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectVersion)" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(MicrosoftIdentityModelJsonWebTokensVersion)" />
<PackageReference Condition="$(BuildForRelease) == 'true'" Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
</ItemGroup>
<Import Project="$(ToolsDir)targets\GenerateThisAssemblyCs.targets" />
<Import Project="$(ToolsDir)targets\ResolveContract.targets" Condition="'$(OSGroup)' == 'AnyOS'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@
<ResolveComReferenceSilent>True</ResolveComReferenceSilent>
<DefineConstants>$(DefineConstants);NETFRAMEWORK;</DefineConstants>
</PropertyGroup>
<!-- Override debugtype=portable in Directory.Build.props for netfx -->
<PropertyGroup>
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(GeneratedSourceFileName)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
<EmbeddedFiles Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
</ItemGroup>
<PropertyGroup>
<!-- CSC Compiler Options -->
<NoConfig>True</NoConfig>
Expand Down Expand Up @@ -714,7 +722,6 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<PackageReference Condition="$(BuildForRelease) == 'true'" Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
<PackageReference Include="System.Text.Encodings.Web">
<Version>$(SystemTextEncodingsWebVersion)</Version>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
</ItemGroup>

<Import Project="$(ToolsDir)targets\GenerateThisAssemblyCs.targets" />
</Project>
2 changes: 1 addition & 1 deletion tools/props/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<MicrosoftIdentityModelJsonWebTokensVersion>6.35.0</MicrosoftIdentityModelJsonWebTokensVersion>
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
<SystemTextEncodingsWebVersion>6.0.0</SystemTextEncodingsWebVersion>
<MicrosoftSourceLinkGitHubVersion>1.1.0</MicrosoftSourceLinkGitHubVersion>
<MicrosoftSourceLinkGitHubVersion>8.0.0</MicrosoftSourceLinkGitHubVersion>
</PropertyGroup>
<!-- NetCore project dependencies -->
<PropertyGroup>
Expand Down
7 changes: 1 addition & 6 deletions tools/specs/Microsoft.Data.SqlClient.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<license type="expression">MIT</license>
<projectUrl>https://aka.ms/sqlclientproject</projectUrl>
<icon>dotnet.png</icon>
<repository type="git" url="https://github.com/dotnet/sqlclient" />
<repository type="git" url="https://github.com/dotnet/sqlclient" commit="$COMMITID$"/>
<description>The current data provider for SQL Server and Azure SQL databases. This has replaced System.Data.SqlClient. These classes provide access to SQL and encapsulate database-specific protocols, including tabular data stream (TDS).

Commonly Used Types:
Expand Down Expand Up @@ -102,27 +102,22 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<references>
<group targetFramework="net462">
<reference file="Microsoft.Data.SqlClient.dll" />
<reference file="Microsoft.Data.SqlClient.pdb" />
<reference file="Microsoft.Data.SqlClient.xml" />
</group>
<group targetFramework="net8.0">
<reference file="Microsoft.Data.SqlClient.dll" />
<reference file="Microsoft.Data.SqlClient.pdb" />
<reference file="Microsoft.Data.SqlClient.xml" />
</group>
<group targetFramework="net6.0">
<reference file="Microsoft.Data.SqlClient.dll" />
<reference file="Microsoft.Data.SqlClient.pdb" />
<reference file="Microsoft.Data.SqlClient.xml" />
</group>
<group targetFramework="netstandard2.0">
<reference file="Microsoft.Data.SqlClient.dll" />
<reference file="Microsoft.Data.SqlClient.pdb" />
<reference file="Microsoft.Data.SqlClient.xml" />
</group>
<group targetFramework="netstandard2.1">
<reference file="Microsoft.Data.SqlClient.dll" />
<reference file="Microsoft.Data.SqlClient.pdb" />
<reference file="Microsoft.Data.SqlClient.xml" />
</group>
</references>
Expand Down
14 changes: 12 additions & 2 deletions tools/targets/GenerateNugetPackage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,27 @@
<NugetPackageVersion Condition="'$(Configuration)' == 'Debug'">$(NugetPackageVersion)-debug</NugetPackageVersion>
</PropertyGroup>
<Message Text="Setting NugetPackageVersion to $(NugetPackageVersion)" />
<!-- Get the current commit id and store it in CommitId property to be used in nuget pack command -->
<Exec Command="git rev-parse HEAD" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="CommitId" />
</Exec>
<Message Text="Commit Id = $(CommitId)" />
<Exec Command="powershell.exe -NonInteractive -executionpolicy Unrestricted ^
-command &quot;&amp;$(ToolsDir)scripts\downloadLatestNuget.ps1 -nugetDestPath '$(NuGetRoot)'&quot;" />
<Exec Command="$(NuGetCmd) pack $(ToolsDir)specs\Microsoft.Data.SqlClient.nuspec -Version $(NugetPackageVersion) -OutputDirectory $(PackagesDir) -properties Configuration=$(Configuration)" />
<Exec Command="$(NuGetCmd) pack -Symbols -SymbolPackageFormat snupkg $(ToolsDir)specs\Microsoft.Data.SqlClient.nuspec -Version $(NugetPackageVersion) -OutputDirectory $(PackagesDir) -properties &quot;COMMITID=$(CommitId);Configuration=$(Configuration)&quot;" />
</Target>
<Target Name="GenerateSqlServerPackage" Condition="'$(GenerateNuget)' == 'true'">
<PropertyGroup>
<SqlServerPackageVersion Condition="'$(Configuration)' == 'Debug'">$(SqlServerPackageVersion)-debug</SqlServerPackageVersion>
</PropertyGroup>
<Message Text="Setting SqlServerPackageVersion to $(SqlServerPackageVersion)" />
<!-- Get the current commit id and store it in CommitId property to be used in nuget pack command -->
<Exec Command="git rev-parse HEAD" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="CommitId" />
</Exec>
<Message Text="Commit Id = $(CommitId)" />
<Exec Command="powershell.exe -NonInteractive -executionpolicy Unrestricted ^
-command &quot;&amp;$(ToolsDir)scripts\downloadLatestNuget.ps1 -nugetDestPath '$(NuGetRoot)'&quot;" />
<Exec Command="$(NuGetCmd) pack $(ToolsDir)specs\Microsoft.SqlServer.Server.nuspec -Version $(SqlServerPackageVersion) -OutputDirectory $(PackagesDir) -properties Configuration=$(Configuration)" />
<Exec Command="$(NuGetCmd) pack -Symbols -SymbolPackageFormat snupkg $(ToolsDir)specs\Microsoft.SqlServer.Server.nuspec -Version $(SqlServerPackageVersion) -OutputDirectory $(PackagesDir) -properties &quot;COMMITID=$(CommitId);Configuration=$(Configuration)&quot;" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<Message Text="Setting NugetPackageVersion to $(NugetPackageVersion)" />
<Exec Command="powershell.exe -NonInteractive -executionpolicy Unrestricted ^
-command &quot;&amp;$(ToolsDir)scripts\downloadLatestNuget.ps1 -nugetDestPath '$(NuGetRoot)'&quot;" />
<Exec Command="$(NuGetCmd) pack $(ToolsDir)specs\add-ons\Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec -Version $(NugetPackageVersion) -OutputDirectory $(PackagesDir) -properties Configuration=$(Configuration)" />
<Exec Command="$(NuGetCmd) pack $(ToolsDir)specs\add-ons\Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec -Version $(NugetPackageVersion) -Symbols -SymbolPackageFormat snupkg -OutputDirectory $(PackagesDir) -properties Configuration=$(Configuration);" />
</Target>
</Project>

0 comments on commit 7fd34df

Please sign in to comment.