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

Fix SourceLinkUrl calculation in another place #7870

Merged
merged 2 commits into from
Sep 9, 2021

Conversation

MattGal
Copy link
Member

@MattGal MattGal commented Sep 9, 2021

Fallout from #7850 again. I will actually wait until this clears validation to port to 6.0 .

To double check:

<Project>
  <ItemGroup>
    <SourceRoot Include="/__w/1/s/.packages/" /> <!-- don't fail on empty -->
    <SourceRoot Include="/__w/1/s/.packages2/">  <!-- correctly lowercase and de-trusted a devdiv  url, AND hit it with update-->
      <ScmRepositoryUrl>https://devdiv.visualstudio.com/MattGal/arcade-validation-trusted.git</ScmRepositoryUrl>
    </SourceRoot>
    <SourceRoot Include="/__w/1/s/.packages3/">  <!-- correctly do nothing to a non devdiv  url -->
      <ScmRepositoryUrl>https://www.github.com/MattGal/arcade-validation-trusted.git</ScmRepositoryUrl>
    </SourceRoot>

  </ItemGroup>
  <Target Name="Build">

    <ItemGroup>
      <SourceRoot> <!-- test the first piece -->
          <ScmRepositoryUrl Condition=" '$([MSBuild]::ValueOrDefault(`%(SourceRoot.ScmRepositoryUrl)`, ``).Contains(`devdiv.visualstudio`))' == 'true' ">$([MSBuild]::ValueOrDefault(`%(SourceRoot.ScmRepositoryUrl)`, ``).ToLower().Replace(`-trusted`,``))</ScmRepositoryUrl>
      </SourceRoot>
    </ItemGroup>

    <ItemGroup>
      <SourceRoot Update="@(SourceRoot)"> <!-- test the second piece -->
        <ScmRepositoryUrl Condition="$([MSBuild]::ValueOrDefault(`%(SourceRoot.ScmRepositoryUrl)`, ``).Contains(`devdiv.visualstudio`))">$([MSBuild]::ValueOrDefault(`%(SourceRoot.ScmRepositoryUrl)`, ``).ToLower().Replace(`mattgal`,`okthisworkedtoo`))</ScmRepositoryUrl>
      </SourceRoot>
    </ItemGroup>

    <Message Importance="High" Text="@(SourceRoot->'%(Identity):%(ScmRepositoryUrl)')" />
  </Target>
</Project>


Output:

Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  /__w/1/s/.packages/:;/__w/1/s/.packages2/:https://devdiv.visualstudio.com/okthisworkedtoo/arcade-validation.git;/__w/1/s/.packages3/:https://www.github.com/MattGal/arcade-validation-trusted.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants