Skip to content

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