Skip to content

Commit 08c72cd

Browse files
author
Javad Rahnama
authored
[5.1] Backport SourceLink translation (#2780)
1 parent ca8746f commit 08c72cd

File tree

7 files changed

+55
-7
lines changed

7 files changed

+55
-7
lines changed

src/Directory.Build.props

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,26 @@
6767
<DefineConstants>$(DefineConstants);ENCLAVE_SIMULATOR</DefineConstants>
6868
</PropertyGroup>
6969

70+
<!-- Packaging for source link-->
71+
<PropertyGroup>
72+
<DebugType>portable</DebugType>
73+
<DebugSymbols>true</DebugSymbols>
74+
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
75+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
76+
<EmbedUnTrackedSources>true</EmbedUnTrackedSources>
77+
<DisableSourceLinkTranslation Condition="'$(DisableSourceLinkTranslation)' == ''">false</DisableSourceLinkTranslation>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
80+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
81+
</PropertyGroup>
82+
7083
<!-- Provides Version properties -->
7184
<Import Project="$(ToolsDir)props\Versions.props" />
7285
<!-- Provides Tool properties -->
7386
<Import Project="$(ToolsDir)props\Tools.props" />
7487
<!-- Provides Build properties -->
7588
<Import Project="$(ToolsDir)props\AssemblyInfo.props" />
7689
<Import Project="$(ToolsDir)props\AssemblyRef.props" />
90+
<Import Project="$(ToolsDir)targets\RepositoryInfo.targets" />
91+
7792
</Project>

src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<PackageReference Condition="$(ReferenceType.Contains('Package'))" Include="Microsoft.Data.SqlClient" Version="$(TestMicrosoftDataSqlClientVersion)" />
2323
</ItemGroup>
2424
<ItemGroup>
25-
<PackageReference Condition="$(BuildForRelease) == 'true'" Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
2625
<PackageReference Include="Azure.Core" Version="$(AzureCoreVersion)" />
2726
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebVersion)" />
2827
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="$(AzureSecurityKeyVaultKeysVersion)" />

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,6 @@
981981
<PackageReference Include="System.Runtime.Caching" Version="$(SystemRuntimeCachingVersion)" />
982982
<PackageReference Condition="$(TargetGroup) == 'netstandard'" Include="System.Runtime.Loader" Version="$(SystemRuntimeLoaderVersion)" />
983983
<PackageReference Condition="$(TargetGroup) == 'netstandard'" Include="System.Security.Cryptography.Cng" Version="$(SystemSecurityCryptographyCngVersion)" />
984-
<PackageReference Condition="$(BuildForRelease) == 'true'" Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
985984
</ItemGroup>
986985
<Import Project="$(ToolsDir)targets\GenerateThisAssemblyCs.targets" />
987986
<Import Project="$(ToolsDir)targets\ResolveContract.targets" Condition="'$(OSGroup)' == 'AnyOS'" />

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,6 @@
717717
</COMReference>
718718
</ItemGroup>
719719
<ItemGroup>
720-
<PackageReference Condition="$(BuildForRelease) == 'true'" Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
721720
<PackageReference Include="System.Text.Encodings.Web">
722721
<Version>$(SystemTextEncodingsWebVersion)</Version>
723722
</PackageReference>

src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
4141
</EmbeddedResource>
4242
</ItemGroup>
43-
<ItemGroup>
44-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All" />
45-
</ItemGroup>
4643

4744
<Import Project="$(ToolsDir)targets\GenerateThisAssemblyCs.targets" />
4845
</Project>

tools/props/Versions.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
<MicrosoftIdentityModelJsonWebTokensVersion>6.35.0</MicrosoftIdentityModelJsonWebTokensVersion>
3434
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
3535
<SystemTextEncodingsWebVersion>6.0.0</SystemTextEncodingsWebVersion>
36-
<MicrosoftSourceLinkGitHubVersion>1.1.0</MicrosoftSourceLinkGitHubVersion>
3736
</PropertyGroup>
3837
<!-- NetCore project dependencies -->
3938
<PropertyGroup>

tools/targets/RepositoryInfo.targets

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this
2+
file to you under the MIT license. -->
3+
<Project>
4+
5+
<!-- Opt-in switch to disable source link (i.e. for local builds). -->
6+
<PropertyGroup Condition="'$(DisableSourceLink)' == 'true'">
7+
<EnableSourceLink>false</EnableSourceLink>
8+
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
9+
<DeterministicSourcePaths>false</DeterministicSourcePaths>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<SourceRoot Include="$(RepoRoot)" />
14+
</ItemGroup>
15+
16+
<PropertyGroup>
17+
<_TranslateUrlPattern>https://[^/]+/ADO.Net/_git/([^/-]+)-(.+)</_TranslateUrlPattern>
18+
<_TranslateUrlReplacement>https://github.com/dotnet/SqlClient</_TranslateUrlReplacement>
19+
</PropertyGroup>
20+
21+
<Target Name="_TranslateAzureDevOpsUrlToGitHubUrl"
22+
Condition="'$(DisableSourceLinkTranslation)' == 'false'"
23+
DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)"
24+
BeforeTargets="SourceControlManagerPublishTranslatedUrls">
25+
26+
<PropertyGroup>
27+
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
28+
</PropertyGroup>
29+
30+
<ItemGroup>
31+
<SourceRoot Update="@(SourceRoot)">
32+
</SourceRoot>
33+
<SourceRoot Update="@(SourceRoot)">
34+
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace(%(SourceRoot.ScmRepositoryUrl),
35+
$(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
36+
</SourceRoot>
37+
</ItemGroup>
38+
<Message Text="Final Translated ScmRepositoryUrl to $(ScmRepositoryUrl)" Importance="high" />
39+
</Target>
40+
</Project>

0 commit comments

Comments
 (0)