110 lines
4.7 KiB
Diff
110 lines
4.7 KiB
Diff
From 586476f7e5407c893a116fd83c202f2ed9b0613e Mon Sep 17 00:00:00 2001
|
|
Patch-Source: https://github.com/dotnet/installer/pull/12852
|
|
From: Michael Simons <msimons@microsoft.com>
|
|
Date: Thu, 16 Dec 2021 18:45:17 -0600
|
|
Subject: [PATCH 1/1] Add logic to convert internal repo uris in
|
|
version.details.xml (#12852)
|
|
|
|
* Add logic to convert internal repo uris in version.details.xml
|
|
|
|
* code review updates
|
|
---
|
|
...ourceBuildIntermediateNupkgDependencies.cs | 39 +++++++++++++++++++
|
|
.../tools/SourceBuildArcadeTarball.targets | 4 +-
|
|
2 files changed, 42 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/SourceBuild/Arcade/src/Tarball_ReadSourceBuildIntermediateNupkgDependencies.cs b/src/SourceBuild/Arcade/src/Tarball_ReadSourceBuildIntermediateNupkgDependencies.cs
|
|
index 59f7eb499..9b6365dfc 100644
|
|
--- a/src/SourceBuild/Arcade/src/Tarball_ReadSourceBuildIntermediateNupkgDependencies.cs
|
|
+++ b/src/SourceBuild/Arcade/src/Tarball_ReadSourceBuildIntermediateNupkgDependencies.cs
|
|
@@ -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 @@ public class Tarball_ReadSourceBuildIntermediateNupkgDependencies : Task
|
|
[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 @@ XName CreateQualifiedName(string plainName)
|
|
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 @@ XName CreateQualifiedName(string plainName)
|
|
|
|
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;
|
|
+ }
|
|
}
|
|
}
|
|
diff --git a/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets b/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
|
|
index 1717371dc..9a49c3499 100644
|
|
--- a/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
|
|
+++ b/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
|
|
@@ -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>
|
|
|
|
--
|
|
2.34.1
|
|
|