Skip to content

Commit

Permalink
Add Directory.Build.targets
Browse files Browse the repository at this point in the history
  • Loading branch information
vnbaaij committed Apr 11, 2024
1 parent 12bee9f commit 34081a9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project>

<PropertyGroup>
<!-- 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://dev\.azure\.com/dnceng/internal/_git)/([^/-]+)-(.+)</_TranslateUrlPattern>
<_TranslateUrlReplacement>https://github.com/$2/$3</_TranslateUrlReplacement>
</PropertyGroup>

<Target Name="_TranslateAzureDevOpsUrlToGitHubUrl" Condition="'$(DisableSourceLinkUrlTranslation)' == 'false'" DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)" BeforeTargets="SourceControlManagerPublishTranslatedUrls">
<ItemGroup>
<SourceRoot Update="@(SourceRoot)">
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace(%(SourceRoot.ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</SourceRoot>
</ItemGroup>
</Target>

</Project>

0 comments on commit 34081a9

Please sign in to comment.