-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add | Add SourceLink translation (#2552)
- Loading branch information
Showing
3 changed files
with
46 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this | ||
file to you under the MIT license. --> | ||
<Project> | ||
|
||
<!-- Opt-in switch to disable source link (i.e. for local builds). --> | ||
<PropertyGroup Condition="'$(DisableSourceLink)' == 'true'"> | ||
<EnableSourceLink>false</EnableSourceLink> | ||
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries> | ||
<DeterministicSourcePaths>false</DeterministicSourcePaths> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<SourceRoot Include="$(RepoRoot)" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<DisableSourceLinkUrlTranslation Condition="'$(DisableSourceLinkUrlTranslation)' == ''">true</DisableSourceLinkUrlTranslation> | ||
<_TranslateUrlPattern>https://[^/]+/ADO.Net/_git/([^/-]+)-(.+)</_TranslateUrlPattern> | ||
<_TranslateUrlReplacement>https://github.com/dotnet/SqlClient</_TranslateUrlReplacement> | ||
</PropertyGroup> | ||
|
||
<Target Name="_TranslateAzureDevOpsUrlToGitHubUrl" | ||
Condition="'$(DisableSourceLinkTranslation)' == 'false'" | ||
DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)" | ||
BeforeTargets="SourceControlManagerPublishTranslatedUrls"> | ||
|
||
<PropertyGroup> | ||
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<SourceRoot Update="@(SourceRoot)"> | ||
</SourceRoot> | ||
<SourceRoot Update="@(SourceRoot)"> | ||
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace(%(SourceRoot.ScmRepositoryUrl), | ||
$(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl> | ||
</SourceRoot> | ||
</ItemGroup> | ||
<Message Text="Final Translated ScmRepositoryUrl to $(ScmRepositoryUrl)" Importance="high" /> | ||
</Target> | ||
</Project> |