File: C\hostedtoolcache\windows\dotnet\sdk\8.0.404\Sdks\Microsoft.SourceLink.AzureRepos.Git\build\Microsoft.SourceLink.AzureRepos.Git.targets
Project: ..\..\..\src\Package\DevDivPackage\DevDivPackage.csproj (MSBuildFiles)
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the License.txt file in the project root for more information. -->
<Project>
  <PropertyGroup>
    <_SourceLinkAzureReposGitAssemblyFile Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tools\net472\Microsoft.SourceLink.AzureRepos.Git.dll</_SourceLinkAzureReposGitAssemblyFile>
    <_SourceLinkAzureReposGitAssemblyFile Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tools\core\Microsoft.SourceLink.AzureRepos.Git.dll</_SourceLinkAzureReposGitAssemblyFile>
  </PropertyGroup>
 
  <UsingTask TaskName="Microsoft.SourceLink.AzureRepos.Git.GetSourceLinkUrl" AssemblyFile="$(_SourceLinkAzureReposGitAssemblyFile)"/>
  <UsingTask TaskName="Microsoft.SourceLink.AzureRepos.Git.TranslateRepositoryUrls" AssemblyFile="$(_SourceLinkAzureReposGitAssemblyFile)"/>
 
  <PropertyGroup>
    <SourceLinkUrlInitializerTargets>$(SourceLinkUrlInitializerTargets);_InitializeAzureReposGitSourceLinkUrl</SourceLinkUrlInitializerTargets>
    <SourceControlManagerUrlTranslationTargets>$(SourceControlManagerUrlTranslationTargets);TranslateAzureReposGitUrlsInSourceControlInformation</SourceControlManagerUrlTranslationTargets>
  </PropertyGroup>
  
  <Target Name="_InitializeAzureReposGitSourceLinkUrl" Outputs="%(SourceRoot.Identity)">
    <!--
      The task calculates SourceLink URL for a given SourceRoot.
 
      If the SourceRoot is associated with a git repository with a recognized domain the <see cref="SourceLinkUrl"/>
      output property is set to the content URL corresponding to the domain, otherwise it is set to string "N/A".
 
      Recognized domains are specified via Hosts (initialized from SourceLinkAzureReposGitHost item group).
      In addition, if SourceLinkHasSingleProvider is true an implicit host is parsed from RepositoryUrl.
 
      ContentUrl is optional. If not specified it defaults to "https://{domain}" or "http://{domain}", based on the scheme of SourceRoot.RepositoryUrl.
    -->
    <Microsoft.SourceLink.AzureRepos.Git.GetSourceLinkUrl RepositoryUrl="$(PrivateRepositoryUrl)" SourceRoot="@(SourceRoot)" Hosts="@(SourceLinkAzureReposGitHost)" IsSingleProvider="$(SourceLinkHasSingleProvider)">
      <Output TaskParameter="SourceLinkUrl" PropertyName="_SourceLinkUrlToUpdate"/>
    </Microsoft.SourceLink.AzureRepos.Git.GetSourceLinkUrl>
 
    <ItemGroup>
      <!-- Only update the SourceLinkUrl metadata if the SourceRoot belongs to this source control -->
      <SourceRoot Update="%(Identity)" SourceLinkUrl="$(_SourceLinkUrlToUpdate)" Condition="'$(_SourceLinkUrlToUpdate)' != 'N/A'"/>
    </ItemGroup>
  </Target>
 
  <!-- 
    We need to translate ssh URLs to https.
  -->
  <Target Name="TranslateAzureReposGitUrlsInSourceControlInformation">
 
    <ItemGroup>
      <_TranslatedSourceRoot Remove="@(_TranslatedSourceRoot)"/>
    </ItemGroup>
 
    <Microsoft.SourceLink.AzureRepos.Git.TranslateRepositoryUrls RepositoryUrl="$(ScmRepositoryUrl)" SourceRoots="@(SourceRoot)" Hosts="@(SourceLinkAzureReposGitHost)" IsSingleProvider="$(SourceLinkHasSingleProvider)">
      <Output TaskParameter="TranslatedRepositoryUrl" PropertyName="ScmRepositoryUrl"/>
      <Output TaskParameter="TranslatedSourceRoots" ItemName="_TranslatedSourceRoot"/>
    </Microsoft.SourceLink.AzureRepos.Git.TranslateRepositoryUrls>
 
    <ItemGroup>
      <SourceRoot Remove="@(SourceRoot)"/>
      <SourceRoot Include="@(_TranslatedSourceRoot)"/>
    </ItemGroup>
  </Target>
</Project>