Added options to disable launcher/plugin auto updates
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 4m4s
Build / Build Nuget package (NuGet) (push) Successful in 4m7s
Build / Build Nuget package (SharedCringe) (push) Successful in 4m5s
Build / Build Nuget package (CringePlugins) (push) Successful in 4m25s
Build / Build Launcher (push) Successful in 5m12s
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 4m4s
Build / Build Nuget package (NuGet) (push) Successful in 4m7s
Build / Build Nuget package (SharedCringe) (push) Successful in 4m5s
Build / Build Nuget package (CringePlugins) (push) Successful in 4m25s
Build / Build Launcher (push) Successful in 5m12s
Also ran cleanup
This commit is contained in:
@@ -10,7 +10,7 @@ public class FrameworkJsonConverter(FrameworkNameFormat format) : JsonConverter<
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.String)
|
||||
throw new JsonException("Invalid framework string");
|
||||
|
||||
|
||||
var s = reader.GetString()!;
|
||||
return format switch
|
||||
{
|
||||
|
@@ -10,7 +10,7 @@ public class ManifestPackageKeyJsonConverter : JsonConverter<ManifestPackageKey>
|
||||
{
|
||||
if (reader.TokenType is not (JsonTokenType.String or JsonTokenType.PropertyName))
|
||||
throw new JsonException("Invalid package key string");
|
||||
|
||||
|
||||
return ManifestPackageKey.Parse(reader.GetString()!);
|
||||
}
|
||||
|
||||
|
@@ -19,12 +19,12 @@ public class PackageAuthorsJsonConverter : JsonConverter<PackageAuthors>
|
||||
case JsonTokenType.StartArray:
|
||||
{
|
||||
var builder = ImmutableArray.CreateBuilder<string>();
|
||||
|
||||
|
||||
while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
|
||||
{
|
||||
builder.Add(reader.GetString()!);
|
||||
}
|
||||
|
||||
|
||||
return new PackageAuthors(string.Join(", ", builder), builder.ToImmutable());
|
||||
}
|
||||
case JsonTokenType.Null:
|
||||
@@ -41,14 +41,14 @@ public class PackageAuthorsJsonConverter : JsonConverter<PackageAuthors>
|
||||
writer.WriteStringValue(value.Author);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
writer.WriteStartArray();
|
||||
|
||||
|
||||
foreach (var author in value.Authors)
|
||||
{
|
||||
writer.WriteStringValue(author);
|
||||
}
|
||||
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
}
|
@@ -10,7 +10,7 @@ public class ResourceTypeJsonConverter : JsonConverter<ResourceType>
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.String)
|
||||
throw new JsonException("Invalid resource type");
|
||||
|
||||
|
||||
return ResourceType.Parse(reader.GetString()!);
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@ public class RuntimeFrameworkJsonConverter : JsonConverter<NuGetRuntimeFramework
|
||||
{
|
||||
if (reader.TokenType is not (JsonTokenType.String or JsonTokenType.PropertyName))
|
||||
throw new JsonException("Invalid runtime framework string");
|
||||
|
||||
|
||||
return NuGetRuntimeFramework.Parse(reader.GetString()!);
|
||||
}
|
||||
|
||||
|
@@ -15,12 +15,12 @@ public class StringOrStringArrayConverter : JsonConverter<ImmutableArray<string>
|
||||
case JsonTokenType.StartArray:
|
||||
{
|
||||
var builder = ImmutableArray.CreateBuilder<string>();
|
||||
|
||||
|
||||
while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
|
||||
{
|
||||
builder.Add(reader.GetString()!);
|
||||
}
|
||||
|
||||
|
||||
return builder.ToImmutable();
|
||||
}
|
||||
default:
|
||||
@@ -35,14 +35,14 @@ public class StringOrStringArrayConverter : JsonConverter<ImmutableArray<string>
|
||||
writer.WriteStringValue(value[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
writer.WriteStartArray();
|
||||
|
||||
|
||||
foreach (var author in value)
|
||||
{
|
||||
writer.WriteStringValue(author);
|
||||
}
|
||||
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
}
|
@@ -10,7 +10,7 @@ public class VersionJsonConverter : JsonConverter<NuGetVersion>
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.String)
|
||||
throw new JsonException("Invalid version string");
|
||||
|
||||
|
||||
return NuGetVersion.Parse(reader.GetString()!);
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@ public class VersionRangeJsonConverter : JsonConverter<VersionRange>
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.String)
|
||||
throw new JsonException("Invalid version range");
|
||||
|
||||
|
||||
return VersionRange.Parse(reader.GetString()!);
|
||||
}
|
||||
|
||||
|
@@ -52,10 +52,10 @@ public record ManifestPackageKey(string Id, NuGetVersion Version)
|
||||
var index = str.IndexOf('/');
|
||||
if (index < 0)
|
||||
throw new FormatException("Invalid package key: " + str);
|
||||
|
||||
|
||||
return new ManifestPackageKey(str[..index], NuGetVersion.Parse(str[(index + 1)..]));
|
||||
}
|
||||
|
||||
|
||||
public override string ToString() => $"{Id}/{Version}";
|
||||
}
|
||||
|
||||
@@ -71,9 +71,9 @@ public static class DependencyManifestSerializer
|
||||
new VersionJsonConverter()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static Task SerializeAsync(Stream stream, DependenciesManifest manifest) => JsonSerializer.SerializeAsync(stream, manifest, SerializerOptions);
|
||||
|
||||
|
||||
public static ValueTask<DependenciesManifest> DeserializeAsync(Stream stream) => JsonSerializer.DeserializeAsync<DependenciesManifest>(stream, SerializerOptions)!;
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ public class DependencyManifestBuilder(DirectoryInfo cacheDirectory, PackageSour
|
||||
var targets = ImmutableDictionary<ManifestPackageKey, DependencyTarget>.Empty.ToBuilder();
|
||||
|
||||
await MapCatalogEntryAsync(catalogEntry, targetFramework, targets);
|
||||
|
||||
|
||||
var manifest = new DependenciesManifest(runtimeTarget, ImmutableDictionary<NuGetRuntimeFramework, string>.Empty,
|
||||
ImmutableDictionary<NuGetRuntimeFramework, ImmutableDictionary<ManifestPackageKey, DependencyTarget>>.Empty
|
||||
.Add(targetFramework, targets.ToImmutable()),
|
||||
.Add(targetFramework, targets.ToImmutable()),
|
||||
ImmutableDictionary<ManifestPackageKey, DependencyLibrary>.Empty);
|
||||
|
||||
|
||||
await DependencyManifestSerializer.SerializeAsync(stream, manifest);
|
||||
}
|
||||
|
||||
@@ -100,14 +100,14 @@ public class DependencyManifestBuilder(DirectoryInfo cacheDirectory, PackageSour
|
||||
{
|
||||
if (targets.ContainsKey(new(catalogEntry.Id, catalogEntry.Version)) || !catalogEntry.DependencyGroups.HasValue)
|
||||
return;
|
||||
|
||||
|
||||
// TODO take into account the target framework runtime identifier
|
||||
var nearest = NuGetFrameworkUtility.GetNearest(catalogEntry.DependencyGroups.Value, targetFramework.Framework,
|
||||
group => group.TargetFramework);
|
||||
|
||||
if (nearest is null)
|
||||
return;
|
||||
|
||||
|
||||
targets.Add(new(catalogEntry.Id, catalogEntry.Version),
|
||||
await MapEntryAsync(catalogEntry, nearest));
|
||||
|
||||
@@ -115,7 +115,7 @@ public class DependencyManifestBuilder(DirectoryInfo cacheDirectory, PackageSour
|
||||
{
|
||||
if (entry is null)
|
||||
continue;
|
||||
|
||||
|
||||
await MapCatalogEntryAsync(entry, targetFramework, targets);
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class DependencyManifestBuilder(DirectoryInfo cacheDirectory, PackageSour
|
||||
|
||||
{
|
||||
await using var stream = await client.GetPackageContentStreamAsync(entry.Id, entry.Version);
|
||||
using var memStream = new MemoryStream();
|
||||
await using var memStream = new MemoryStream();
|
||||
await stream.CopyToAsync(memStream);
|
||||
memStream.Position = 0;
|
||||
using var archive = new ZipArchive(memStream, ZipArchiveMode.Read);
|
||||
|
@@ -5,5 +5,5 @@ namespace NuGet.Models;
|
||||
|
||||
public record CatalogEntry(string Id, NuGetVersion Version, ImmutableArray<DependencyGroup>? DependencyGroups, ImmutableArray<string>? PackageTypes,
|
||||
ImmutableArray<CatalogPackageEntry>? PackageEntries);
|
||||
|
||||
|
||||
public record CatalogPackageEntry(string Name, string FullName, long CompressedLength, long Length);
|
@@ -13,10 +13,10 @@ public record NuGetRuntimeFramework(NuGetFramework Framework, string? RuntimeIde
|
||||
public static NuGetRuntimeFramework Parse(string str)
|
||||
{
|
||||
var index = str.IndexOf('/');
|
||||
|
||||
|
||||
if (index < 0)
|
||||
return new NuGetRuntimeFramework(NuGetFramework.Parse(str), null);
|
||||
|
||||
|
||||
return new NuGetRuntimeFramework(NuGetFramework.Parse(str[..index]), str[(index + 1)..]);
|
||||
}
|
||||
|
||||
|
@@ -2,5 +2,5 @@
|
||||
|
||||
namespace NuGet.Models;
|
||||
|
||||
public record Registration([property: JsonPropertyName("catalogEntry")] string CatalogEntryUrl,
|
||||
public record Registration([property: JsonPropertyName("catalogEntry")] string CatalogEntryUrl,
|
||||
[property: JsonPropertyName("sleet:catalogEntry")] CatalogEntry? SleetEntry);
|
@@ -10,10 +10,10 @@ public record ResourceType(string Id, NuGetVersion? Version)
|
||||
public static ResourceType Parse(string typeString)
|
||||
{
|
||||
var slash = typeString.IndexOf('/');
|
||||
|
||||
|
||||
if (slash < 0)
|
||||
return new ResourceType(typeString, null);
|
||||
|
||||
|
||||
var id = typeString[..slash];
|
||||
var versionStr = typeString[(slash + 1)..];
|
||||
|
||||
|
@@ -7,7 +7,7 @@ using NuGet.Versioning;
|
||||
|
||||
namespace NuGet;
|
||||
|
||||
public class NuGetClient
|
||||
public sealed class NuGetClient
|
||||
{
|
||||
private readonly Uri _index;
|
||||
private readonly HttpClient _client;
|
||||
@@ -69,7 +69,7 @@ public class NuGetClient
|
||||
bool? includePrerelease = null, NuGetVersion? minVersion = null, string? packageType = null)
|
||||
{
|
||||
var queryParameters = HttpUtility.ParseQueryString(string.Empty);
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(query))
|
||||
queryParameters.Add("q", query);
|
||||
|
||||
@@ -78,13 +78,13 @@ public class NuGetClient
|
||||
|
||||
if (take.HasValue)
|
||||
queryParameters.Add("take", take.Value.ToString());
|
||||
|
||||
|
||||
if (includePrerelease.HasValue)
|
||||
queryParameters.Add("prerelease", includePrerelease.Value.ToString());
|
||||
|
||||
if (minVersion is not null)
|
||||
queryParameters.Add("semVerLevel", minVersion.ToString());
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(packageType))
|
||||
queryParameters.Add("packageType", packageType);
|
||||
|
||||
|
Reference in New Issue
Block a user