Skip to content

Conversation

@MattGal
Copy link
Member

@MattGal MattGal commented Apr 28, 2021

(Same change as #7304, but for release/5.0)

To double check:

#7255

There aren't any automated validations set up here, but pasting this (exactly what I changed) into a local project file and running it shows it does what i want:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
  <Target Name="Build">

    <PropertyGroup>
      <ScmRepositoryUrl>https://devdiv.visualstudio.com/DevDiv/_git/DotNet-msbuild-Trusted</ScmRepositoryUrl>
      <_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>

    <Message Importance="High" Text="Untranslated URL : $(ScmRepositoryUrl)" />

    <PropertyGroup>
      <ScmRepositoryUrl Condition="$(ScmRepositoryUrl.Contains(`devdiv.visualstudio`))">$(ScmRepositoryUrl.ToLower().Replace(`-trusted`,``))</ScmRepositoryUrl>
      <ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
    </PropertyGroup>

    <Message Importance="High" Text="Translated URL : $(ScmRepositoryUrl)" />

  </Target>
</Project>

Output:

Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 4/27/2021 5:28:25 PM.
Project "...fun.proj" on node 1 (default targets).
Build:
  Untranslated URL : https://devdiv.visualstudio.com/DevDiv/_git/DotNet-msbuild-Trusted
  Translated URL : https://github.com/dotnet/msbuild
Done Building Project "...fun.proj" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.06

@MattGal MattGal changed the title Add devdiv.visualstudio URL to the regex used for SourceLink translat… Add devdiv.visualstudio URL to the regex used for SourceLink translation Apr 28, 2021
@MattGal MattGal requested a review from mmitche April 28, 2021 15:21
@MattGal MattGal added the auto-merge Automatically merge PR once CI passes. label Apr 28, 2021
@ghost
Copy link

ghost commented Apr 28, 2021

Hello @MattGal!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 12 minutes, a condition that will be fulfilled in about 5 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@MattGal MattGal merged commit 41faaec into dotnet:release/5.0 Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Automatically merge PR once CI passes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants