Merge in 'release/6.0.1xx' changes
This commit is contained in:
commit
66b270fe0e
2 changed files with 42 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
@ -21,6 +22,11 @@ namespace Microsoft.DotNet.SourceBuild.Tasks
|
|||
[Required]
|
||||
public string SourceBuildIntermediateNupkgPrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Convert any internal repo references to the public GitHub repos.
|
||||
/// </summary>
|
||||
public bool ConvertInternalRepos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The intermediate nupkg RID to use if any RID-specific intermediate nupkgs are required.
|
||||
/// If this parameter isn't specified, RID-specific intermediate nupkgs can't be used and
|
||||
|
@ -88,6 +94,11 @@ namespace Microsoft.DotNet.SourceBuild.Tasks
|
|||
string dependencyVersion = d.Attribute("Version")?.Value;
|
||||
|
||||
string uri = d.Element(CreateQualifiedName("Uri"))?.Value;
|
||||
if (ConvertInternalRepos)
|
||||
{
|
||||
uri = ConvertInternalRepo(uri);
|
||||
}
|
||||
|
||||
string sha = d.Element(CreateQualifiedName("Sha"))?.Value;
|
||||
string sourceBuildRepoName = sourceBuildElement.Attribute("RepoName")?.Value;
|
||||
|
||||
|
@ -137,5 +148,33 @@ namespace Microsoft.DotNet.SourceBuild.Tasks
|
|||
|
||||
return !Log.HasLoggedErrors;
|
||||
}
|
||||
|
||||
private string ConvertInternalRepo(string uri)
|
||||
{
|
||||
if (uri.StartsWith("https://dev.azure.com", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string[] repoParts = uri.Substring(uri.LastIndexOf('/')).Split('-', 2);
|
||||
|
||||
if (repoParts.Length != 2)
|
||||
{
|
||||
Log.LogError($"Repo '{uri}' does not end with the expected <GH organization>-<GH repo> format");
|
||||
return null;
|
||||
}
|
||||
|
||||
string org = repoParts[0];
|
||||
string repo = repoParts[1];
|
||||
|
||||
// The internal Nuget.Client repo has suffix which needs to be accounted for.
|
||||
const string trustedSuffix = "-Trusted";
|
||||
if (uri.EndsWith(trustedSuffix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
repo = repo.Substring(0, repo.Length - trustedSuffix.Length);
|
||||
}
|
||||
|
||||
uri = $"https://github.com/{org}/{repo}";
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<TarballSourceDir>$(TarballRootDir)src/</TarballSourceDir>
|
||||
<TarballGitInfoDir>$(TarballRootDir)git-info/</TarballGitInfoDir>
|
||||
<CloneVerbosity>quiet</CloneVerbosity> <!-- Support quiet and full -->
|
||||
<ConvertInternalRepos Condition="'$(ConvertInternalRepos)' == '' and '$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' == '' ">true</ConvertInternalRepos>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CreateSourceTarball"
|
||||
|
@ -203,7 +204,8 @@
|
|||
<Tarball_ReadSourceBuildIntermediateNupkgDependencies
|
||||
VersionDetailsXmlFile="$([MSBuild]::NormalizePath($(TarballVersionDetailsFile)))"
|
||||
SourceBuildIntermediateNupkgPrefix="$(SourceBuildIntermediateNupkgPrefix)"
|
||||
SourceBuildIntermediateNupkgRid="$(SourceBuildIntermediateNupkgRid)">
|
||||
SourceBuildIntermediateNupkgRid="$(SourceBuildIntermediateNupkgRid)"
|
||||
ConvertInternalRepos="$(ConvertInternalRepos)">
|
||||
<Output TaskParameter="Dependencies" ItemName="SourceBuildRepos" />
|
||||
</Tarball_ReadSourceBuildIntermediateNupkgDependencies>
|
||||
|
||||
|
|
Loading…
Reference in a new issue