From a36e5f8a17eed6730cf5b142d630d3ff5a503880 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Thu, 20 Jun 2024 08:33:10 -0500 Subject: [PATCH] fix: ignore the private feed for dev package versions except SDK private (cherry picked from commit 6933e5b120376ae3513a800a27f5a3c4993d8f2c) --- tools/Uno.Sdk.Updater/Program.cs | 14 ++++++++------ tools/Uno.Sdk.Updater/Services/NuGetClient.cs | 10 ++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/Uno.Sdk.Updater/Program.cs b/tools/Uno.Sdk.Updater/Program.cs index 3058d58d..93127ad7 100644 --- a/tools/Uno.Sdk.Updater/Program.cs +++ b/tools/Uno.Sdk.Updater/Program.cs @@ -1,4 +1,4 @@ -using System.IO.Compression; +using System.IO.Compression; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; @@ -38,6 +38,7 @@ } var unoVersion = versions.OrderByDescending(x => x).First(); +client.UnoVersion = unoVersion; Console.WriteLine($"Found Uno Version: {unoVersion}"); Console.WriteLine($"Downloading {UnoSdkPackageId}"); @@ -268,11 +269,12 @@ static async Task UpdateGroup(ManifestGroup group, NuGetVersion u var preview = unoVersion.IsPreview; string[] stableOnlyGroups = [ - "CoreLogging", - "OSLogging", - "UniversalImageLoading", - "WasmBootstrap" -]; + "CoreLogging", + "OSLogging", + "UniversalImageLoading", + "WasmBootstrap" + ]; + if (stableOnlyGroups.Any(x => x == group.Group)) { preview = false; diff --git a/tools/Uno.Sdk.Updater/Services/NuGetClient.cs b/tools/Uno.Sdk.Updater/Services/NuGetClient.cs index 279e3980..08469c9b 100644 --- a/tools/Uno.Sdk.Updater/Services/NuGetClient.cs +++ b/tools/Uno.Sdk.Updater/Services/NuGetClient.cs @@ -15,6 +15,8 @@ internal class NuGetApiClient : IDisposable BaseAddress = new Uri("https://pkgs.dev.azure.com") }; + public NuGetVersion? UnoVersion { get; set; } + public async Task DownloadPackageAsync(string packageId, string version) { var downloadUrl = $"/uno-platform/1dd81cbd-cb35-41de-a570-b0df3571a196/_apis/packaging/feeds/e7ce08df-613a-41a3-8449-d42784dd45ce/nuget/packages/{packageId}/versions/{version}/content"; @@ -36,9 +38,13 @@ public async Task> GetPackageVersions(string packageId { var allVersions = new List(); var publicVersions = await GetPublicPackageVersions(packageId); - var privateVersions = await GetPrivatePackageVersions(packageId); allVersions.AddRange(publicVersions); - allVersions.AddRange(privateVersions); + + if (!UnoVersion.HasValue || !UnoVersion.Value.IsPreview) + { + var privateVersions = await GetPrivatePackageVersions(packageId); + allVersions.AddRange(privateVersions); + } var output = new List(); foreach (var version in allVersions.Distinct())