Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devdiv.visualstudio URL to the regex used for SourceLink translation #7304

Merged
1 commit merged into from
Apr 28, 2021

Conversation

MattGal
Copy link
Member

@MattGal MattGal commented Apr 28, 2021

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 requested a review from mmitche April 28, 2021 00:34
@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.

This pull request was closed.
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