Skip to content

Commit

Permalink
Add devdiv.visualstudio URL to the regex used for SourceLink translat…
Browse files Browse the repository at this point in the history
…ion (addresses #7255, msbuild needs release/5.0) (#7306)
  • Loading branch information
MattGal authored Apr 28, 2021
1 parent c58c5dd commit 41faaec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryInfo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@

<!--
The convention for names of Azure DevOps repositories mirrored from GitHub is "{GitHub org name}-{GitHub repository name}"
In the legacy devdiv.visualstudio instance, it is instead "{GitHub org name}-{GitHub repository name}-Trusted" with no guarantees for casing.
-->
<PropertyGroup>
<!-- There are quite a few git repo forms:
https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-arcade-services
https://dev.azure.com/dnceng/internal/_git/dotnet-arcade-services
https://dnceng.visualstudio.com/internal/_git/dotnet-arcade-services
https://devdiv.visualstudio.com/DevDiv/_git/DotNet-msbuild-Trusted
dnceng@vs-ssh.visualstudio.com:v3/dnceng/internal/dotnet-arcade-services
git@ssh.dev.azure.com:v3/dnceng/internal/dotnet-arcade-services
-->
<!-- Set DisableSourceLinkUrlTranslation to true when building a tool for internal use where sources only come from internal URIs -->
<DisableSourceLinkUrlTranslation Condition="'$(DisableSourceLinkUrlTranslation)' == ''">false</DisableSourceLinkUrlTranslation>
<_TranslateUrlPattern>(https://dnceng%40dev\.azure\.com/dnceng/internal/_git|https://dev\.azure\.com/dnceng/internal/_git|https://dnceng\.visualstudio\.com/internal/_git|dnceng%40vs-ssh\.visualstudio\.com:v3/dnceng/internal|git%40ssh\.dev\.azure\.com:v3/dnceng/internal)/([^/-]+)-(.+)</_TranslateUrlPattern>
<_TranslateUrlPattern>(https://dnceng%40dev\.azure\.com/dnceng/internal/_git|https://dev\.azure\.com/dnceng/internal/_git|https://dnceng\.visualstudio\.com/internal/_git|dnceng%40vs-ssh\.visualstudio\.com:v3/dnceng/internal|git%40ssh\.dev\.azure\.com:v3/dnceng/internal|https://devdiv\.visualstudio\.com/devdiv/_git)/([^/-]+)-(.+)</_TranslateUrlPattern>
<_TranslateUrlReplacement>https://github.com/$2/$3</_TranslateUrlReplacement>
</PropertyGroup>

Expand All @@ -56,6 +58,9 @@
BeforeTargets="SourceControlManagerPublishTranslatedUrls">

<PropertyGroup>
<!-- Repositories mirrored on devdiv.visualstudio will have '-Trusted' added to their name and this needs to be stripped off before translation
Eventually, all repos should move to dnceng/internal when possible. -->
<ScmRepositoryUrl Condition="$(ScmRepositoryUrl.Contains(`devdiv.visualstudio`))">$(ScmRepositoryUrl.ToLower().Replace(`-trusted`,``))</ScmRepositoryUrl>
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</PropertyGroup>

Expand Down

0 comments on commit 41faaec

Please sign in to comment.