forked from dotnet/corefxlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
35 lines (31 loc) · 1.83 KB
/
Directory.Build.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<Project>
<!--
The convention for names of Azure DevOps repositories mirrored from GitHub is "{GitHub org name}-{GitHub repository name}"
-->
<PropertyGroup>
<!-- There are quite a few git repo forms:
https://[email protected]/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
[email protected]:v3/dnceng/internal/dotnet-arcade-services
[email protected]:v3/dnceng/internal/dotnet-arcade-services
-->
<_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>
<_TranslateUrlReplacement>https://github.com/$2/$3</_TranslateUrlReplacement>
</PropertyGroup>
<PropertyGroup>
<Version Condition="'$(IsStableRelease)' == 'true' and '$(IsShipping)' == 'true'">$(VersionPrefix)</Version>
</PropertyGroup>
<Target Name="_TranslateAzureDevOpsUrlToGitHubUrl"
DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)"
BeforeTargets="SourceControlManagerPublishTranslatedUrls">
<PropertyGroup>
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</PropertyGroup>
<ItemGroup>
<SourceRoot Update="@(SourceRoot)">
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace(%(SourceRoot.ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</SourceRoot>
</ItemGroup>
</Target>
</Project>