Retry source requests
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (SharedCringe) (push) Successful in 1m4s
Build / Build Nuget package (NuGet) (push) Successful in 1m6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 1m10s
Build / Build Nuget package (CringePlugins) (push) Successful in 1m18s
Build / Build Launcher (push) Successful in 1m54s

Handle missing sources
Minor Optimizations
Move thread pool improvement to debug while we fix it
This commit is contained in:
2025-06-01 11:11:50 -04:00
parent 2f492d9ed1
commit b12f1cc2f1
11 changed files with 72 additions and 54 deletions

View File

@@ -43,7 +43,7 @@ public class PluginsLifetime(string gameFolder) : ILoadingStage
var configPath = Path.Join(_dir.FullName, "packages.json");
if (File.Exists(configPath))
await using (var stream = File.OpenRead(configPath))
packagesConfig = JsonSerializer.Deserialize<PackagesConfig>(stream, NuGetClient.SerializerOptions)!;
packagesConfig = await JsonSerializer.DeserializeAsync<PackagesConfig>(stream, NuGetClient.SerializerOptions)!;
if (packagesConfig == null)
{
@@ -114,7 +114,15 @@ public class PluginsLifetime(string gameFolder) : ILoadingStage
foreach (var package in packages)
{
if (builtInPackages.ContainsKey(package.Package.Id)) continue;
var client = await sourceMapping.GetClientAsync(package.Package.Id);
if (client == null)
{
Log.Warn("Client not found for {Package}", package.Package.Id);
continue;
}
var dir = Path.Join(package.Directory.FullName, "lib", package.ResolvedFramework.GetShortFolderName());
var path = Path.Join(dir, $"{package.Package.Id}.deps.json");
@@ -123,6 +131,8 @@ public class PluginsLifetime(string gameFolder) : ILoadingStage
try
{
await using var stream = File.Create(path);
//client should not be null for calls to this
await manifestBuilder.WriteDependencyManifestAsync(stream, package.Entry, _runtimeFramework);
}
catch (Exception ex)
@@ -132,8 +142,7 @@ public class PluginsLifetime(string gameFolder) : ILoadingStage
throw;
}
}
var client = await sourceMapping.GetClientAsync(package.Package.Id);
var sourceName = packagesConfig.Sources.First(b => b.Url == client.ToString()).Name;
LoadComponent(plugins, Path.Join(dir, $"{package.Package.Id}.dll"),
new(package.Package.Id, package.Package.Version, sourceName));