diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9442ff7..200c128 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,8 +19,7 @@ on:
jobs:
build:
- # In Ubuntu, there are problems with disk space and resources in general
- runs-on: windows-latest
+ runs-on: ubuntu-latest
steps:
- name: Checkout
diff --git a/registry.json b/registry.json
index f49ea45..a142167 100644
--- a/registry.json
+++ b/registry.json
@@ -358,7 +358,7 @@
},
"CsvHelper": {
"listed": true,
- "version": "3.0.0"
+ "version": "32.0.0"
},
"Dapplo.Log": {
"listed": true,
@@ -552,7 +552,7 @@
},
"Google.Apis.Sheets.v4": {
"listed": true,
- "version": "1.35.1.1303"
+ "version": "1.70.0.3819"
},
"Google.Cloud.Firestore": {
"listed": true,
@@ -1234,7 +1234,7 @@
},
"MongoDB.Libmongocrypt": {
"listed": true,
- "version": "1.2.0"
+ "version": "1.12.0"
},
"Mono.Cecil": {
"listed": true,
@@ -1815,7 +1815,7 @@
},
"System.IO.Abstractions": {
"listed": true,
- "version": "2.1.0.201"
+ "version": "22.0.9"
},
"System.IO.FileSystem.AccessControl": {
"listed": true,
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 31a6dbd..63acadc 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -19,7 +19,7 @@
-
+
diff --git a/src/UnityNuGet.Server/RegistryCacheUpdater.cs b/src/UnityNuGet.Server/RegistryCacheUpdater.cs
index cedb201..f41455e 100644
--- a/src/UnityNuGet.Server/RegistryCacheUpdater.cs
+++ b/src/UnityNuGet.Server/RegistryCacheUpdater.cs
@@ -43,14 +43,14 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
Filter = _registryOptions.Filter,
// Update progress
- OnProgress = (current, total) =>
+ OnProgress = (_, e) =>
{
- _currentRegistryCache.ProgressTotalPackageCount = total;
- _currentRegistryCache.ProgressPackageIndex = current;
+ _currentRegistryCache.ProgressTotalPackageCount = e.Total;
+ _currentRegistryCache.ProgressPackageIndex = e.Current;
},
- OnInformation = _registryCacheReport.AddInformation,
- OnWarning = _registryCacheReport.AddWarning,
- OnError = _registryCacheReport.AddError
+ OnInformation = (_, e) => _registryCacheReport.AddInformation(e.Message),
+ OnWarning = (_, e) => _registryCacheReport.AddWarning(e.Message),
+ OnError = (_, e) => _registryCacheReport.AddError(e.Message)
};
await newRegistryCache.Build(stoppingToken);
diff --git a/src/UnityNuGet.Tests/NativeTests.cs b/src/UnityNuGet.Tests/NativeTests.cs
index f633ea1..1d4cbc6 100644
--- a/src/UnityNuGet.Tests/NativeTests.cs
+++ b/src/UnityNuGet.Tests/NativeTests.cs
@@ -54,7 +54,7 @@ public async Task TestBuild()
new NuGetConsoleTestLogger())
{
Filter = "rhino3dm",
- OnError = message =>
+ OnError = (_, _) =>
{
errorsTriggered = true;
}
diff --git a/src/UnityNuGet.Tests/NuGetHelperTests.cs b/src/UnityNuGet.Tests/NuGetHelperTests.cs
index 11c2e5b..5a482ce 100644
--- a/src/UnityNuGet.Tests/NuGetHelperTests.cs
+++ b/src/UnityNuGet.Tests/NuGetHelperTests.cs
@@ -23,7 +23,7 @@ public void GetCompatiblePackageDependencyGroups_SpecificSingleFramework()
IEnumerable compatibleDependencyGroups = NuGetHelper.GetCompatiblePackageDependencyGroups(packageDependencyGroups, targetFrameworks);
- Assert.That(compatibleDependencyGroups, Is.EqualTo(new PackageDependencyGroup[] { packageDependencyGroups[2] }).AsCollection);
+ Assert.That(compatibleDependencyGroups, Is.EqualTo([packageDependencyGroups[2]]).AsCollection);
}
[Test]
@@ -41,7 +41,7 @@ public void GetCompatiblePackageDependencyGroups_SpecificMultipleFrameworks()
IEnumerable compatibleDependencyGroups = NuGetHelper.GetCompatiblePackageDependencyGroups(packageDependencyGroups, targetFrameworks);
- Assert.That(compatibleDependencyGroups, Is.EqualTo(new PackageDependencyGroup[] { packageDependencyGroups[2], packageDependencyGroups[3] }).AsCollection);
+ Assert.That(compatibleDependencyGroups, Is.EqualTo([packageDependencyGroups[2], packageDependencyGroups[3]]).AsCollection);
}
[Test]
diff --git a/src/UnityNuGet.Tests/PlatformDefinitionTests.cs b/src/UnityNuGet.Tests/PlatformDefinitionTests.cs
index 8353f36..088d601 100644
--- a/src/UnityNuGet.Tests/PlatformDefinitionTests.cs
+++ b/src/UnityNuGet.Tests/PlatformDefinitionTests.cs
@@ -21,16 +21,16 @@ public void CanFindDefinitions()
// Look-up explicit configuration
PlatformDefinition? win64 = platformDefs.Find(UnityOs.Windows, UnityCpu.X64);
- Assert.Multiple(() =>
+ using (Assert.EnterMultipleScope())
{
Assert.That(win64, Is.Not.Null);
Assert.That(win.Os, Is.EqualTo(win64!.Os));
- });
- Assert.Multiple(() =>
+ }
+ using (Assert.EnterMultipleScope())
{
Assert.That(win64?.Cpu, Is.EqualTo(UnityCpu.X64));
Assert.That(win.Children, Does.Contain(win64));
- });
+ }
// Look-up invalid configuration
PlatformDefinition? and = platformDefs.Find(UnityOs.Android, UnityCpu.None);
@@ -48,11 +48,11 @@ public void RemainingPlatforms_NoneVisited()
HashSet remaining = platformDefs.GetRemainingPlatforms(visited);
Assert.That(remaining, Is.Not.Null);
- Assert.Multiple(() =>
+ using (Assert.EnterMultipleScope())
{
Assert.That(remaining, Has.Count.EqualTo(1));
Assert.That(platformDefs, Is.EqualTo(remaining.First()));
- });
+ }
}
[Test]
@@ -70,11 +70,11 @@ public void RemainingPlatforms_OneVisited()
foreach (PlatformDefinition r in remaining)
{
- Assert.Multiple(() =>
+ using (Assert.EnterMultipleScope())
{
Assert.That(child, Is.Not.EqualTo(r));
Assert.That(platformDefs.Children, Does.Contain(r));
- });
+ }
}
}
}
diff --git a/src/UnityNuGet.Tests/RegistryCacheTests.cs b/src/UnityNuGet.Tests/RegistryCacheTests.cs
index 8239b8a..02896e9 100644
--- a/src/UnityNuGet.Tests/RegistryCacheTests.cs
+++ b/src/UnityNuGet.Tests/RegistryCacheTests.cs
@@ -62,7 +62,7 @@ public async Task TestBuild()
],
new NuGetConsoleTestLogger())
{
- OnError = message =>
+ OnError = (_, _) =>
{
errorsTriggered = true;
}
diff --git a/src/UnityNuGet.Tests/RegistryTests.cs b/src/UnityNuGet.Tests/RegistryTests.cs
index 3d254f4..e500d85 100644
--- a/src/UnityNuGet.Tests/RegistryTests.cs
+++ b/src/UnityNuGet.Tests/RegistryTests.cs
@@ -41,11 +41,11 @@ public async Task Make_Sure_That_The_Registry_Is_Case_Insensitive(string package
await registry.StartAsync(CancellationToken.None);
- Assert.Multiple(() =>
+ using (Assert.EnterMultipleScope())
{
Assert.That(registry.TryGetValue(packageName, out RegistryEntry? result), Is.True);
Assert.That(result, Is.Not.Null);
- });
+ }
}
[Test]
@@ -168,6 +168,8 @@ static async Task AllRegistries()
@"ClosedXML",
// It has too many versions, the minimum version is lifted so as not to process so many versions
@"CSharpFunctionalExtensions",
+ // It has too many versions, the minimum version is lifted so as not to process so many versions
+ @"CsvHelper",
// Version < 1.0.26 depends on Microsoft.Windows.Compatibility, this one has tons of dependencies that don't target .netstandard2.0. And one of them is System.Speech that doesn't work in Unity.
@"Dapplo.Windows.Common",
@"Dapplo.Windows.Input",
@@ -177,6 +179,8 @@ static async Task AllRegistries()
@"Elasticsearch.Net",
// It has too many versions, the minimum version is lifted so as not to process so many versions
@"Google.Apis.AndroidPublisher.v3",
+ // It has too many versions, the minimum version is lifted so as not to process so many versions
+ @"Google.Apis.Sheets.v4",
// Version 3.1.8 has dependency on `Panic.StringUtils` which doesn't support .netstandard2.0 or 2.1. Rest of versions are fine.
@"GraphQL.Client.Serializer.Newtonsoft",
// Version 3.1.8 has dependency on `Panic.StringUtils` which doesn't support .netstandard2.0 or 2.1. Rest of versions are fine.
@@ -184,6 +188,8 @@ static async Task AllRegistries()
// Although 2.x targets .netstandard2.0 it has an abandoned dependency (Remotion.Linq) that does not target .netstandard2.0.
// 3.1.0 is set because 3.0.x only targets .netstandard2.1.
@"Microsoft.EntityFrameworkCore.*",
+ // It takes up a lot of space, the minimum version is lifted so as not to process so many versions
+ @"MongoDB.Libmongocrypt",
// Monomod Versions < 18.11.9.9 depend on System.Runtime.Loader which doesn't ship .netstandard2.0.
@"MonoMod.Utils",
@"MonoMod.RuntimeDetour",
@@ -195,6 +201,8 @@ static async Task AllRegistries()
@"SQLitePCLRaw.lib.e_sqlite3",
// Versions < 1.4.1 has dependencies on Microsoft.AspNetCore.*.
@"StrongInject.Extensions.DependencyInjection",
+ // It has too many versions, the minimum version is lifted so as not to process so many versions
+ @"System.IO.Abstractions",
// Versions < 4.6.0 in theory supports .netstandard2.0 but it doesn't have a lib folder with assemblies and it makes it fail.
@"System.Private.ServiceModel",
// Versions < 0.8.6 depend on LiteGuard, a deprecated dependency.
diff --git a/src/UnityNuGet.Tests/UnityMetaTests.cs b/src/UnityNuGet.Tests/UnityMetaTests.cs
index dc4d3b2..38eebfc 100644
--- a/src/UnityNuGet.Tests/UnityMetaTests.cs
+++ b/src/UnityNuGet.Tests/UnityMetaTests.cs
@@ -109,22 +109,22 @@ public void GetMetaForDll_NonEditor(UnityOs os, string platformName, string osNa
MatchCollection excludeMatches = excludeRegex.Matches(output);
Assert.That(excludeMatches, Is.Not.Null);
Assert.That(excludeMatches, Has.Count.EqualTo(1));
- Assert.Multiple(() =>
+ using (Assert.EnterMultipleScope())
{
Assert.That(excludeMatches.Single().Groups, Has.Count.EqualTo(2));
Assert.That(osName, Is.EqualTo(excludeMatches.Single().Groups[1].Value));
- });
+ }
// There should be a single 'enabled: 1' match
Regex enableRegex = new("enabled: 1");
MatchCollection enableMatches = enableRegex.Matches(output);
Assert.That(enableMatches, Is.Not.Null);
- Assert.Multiple(() =>
+ using (Assert.EnterMultipleScope())
{
Assert.That(enableMatches, Has.Count.EqualTo(1));
Assert.That(output, Does.Contain($"- first:\n {platformName}: {osName}\n second:\n enabled: 1\n"));
- });
+ }
}
[TestCase(UnityOs.Windows, new[] { "Win", "Win64" })]
@@ -155,11 +155,11 @@ public void GetMetaForDll_Editor(UnityOs os, string[] osNames)
Regex enableRegex = new ("enabled: 1");
MatchCollection enableMatches = enableRegex.Matches(output);
- Assert.Multiple(() =>
+ using (Assert.EnterMultipleScope())
{
Assert.That(enableMatches, Is.Not.Null);
Assert.That(excludeMatches, Has.Count.EqualTo(enableMatches.Count));
- });
+ }
foreach (string? osName in actualExcludes)
{
diff --git a/src/UnityNuGet.Tool/RegistryCacheUpdater.cs b/src/UnityNuGet.Tool/RegistryCacheUpdater.cs
index 5b9709f..613fea4 100644
--- a/src/UnityNuGet.Tool/RegistryCacheUpdater.cs
+++ b/src/UnityNuGet.Tool/RegistryCacheUpdater.cs
@@ -41,12 +41,12 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
Filter = _registryOptions.Filter,
// Update progress
- OnProgress = (current, total) =>
+ OnProgress = (_, e) =>
{
- _currentRegistryCache.ProgressTotalPackageCount = total;
- _currentRegistryCache.ProgressPackageIndex = current;
+ _currentRegistryCache.ProgressTotalPackageCount = e.Total;
+ _currentRegistryCache.ProgressPackageIndex = e.Current;
},
- OnError = message => errorCount++
+ OnError = (_, _) => errorCount++
};
await newRegistryCache.Build(stoppingToken);
diff --git a/src/UnityNuGet/RegistryCache.cs b/src/UnityNuGet/RegistryCache.cs
index feea9d6..a59f547 100644
--- a/src/UnityNuGet/RegistryCache.cs
+++ b/src/UnityNuGet/RegistryCache.cs
@@ -30,7 +30,7 @@ namespace UnityNuGet
///
public class RegistryCache
{
- public static readonly bool IsRunningOnAzure = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME"));
+ public static readonly bool IsRunningAsContinuousIntegration = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI"));
// Change this version number if the content of the packages are changed by an update of this class
private const string CurrentRegistryVersion = "1.9.0";
@@ -92,8 +92,8 @@ public RegistryCache(
Directory.CreateDirectory(_rootPersistentFolder);
}
- // Force NuGet packages to be in the same directory to avoid storage full on Azure.
- if (IsRunningOnAzure)
+ // Force NuGet packages to be in the same directory to avoid storage full on CI.
+ if (IsRunningAsContinuousIntegration)
{
string nugetFolder = Path.Combine(_rootPersistentFolder, ".nuget");
Environment.SetEnvironmentVariable("NUGET_PACKAGES", nugetFolder);
@@ -112,6 +112,10 @@ public RegistryCache(
_sourceCacheContext = new SourceCacheContext();
_npmPackageRegistry = new NpmPackageRegistry();
+
+ GlobalPackagesFolder = SettingsUtility.GetGlobalPackagesFolder(_settings);
+
+ LogInformation($"NuGet packages directory: {GlobalPackagesFolder}");
}
///
@@ -122,25 +126,27 @@ public RegistryCache(
///
public string? Filter { get; set; }
+ public string GlobalPackagesFolder { get; }
+
///
/// OnProgress event (number of packages initialized, total number of packages)
///
- public Action? OnProgress { get; set; }
+ public EventHandler OnProgress = (sender, e) => { };
///
/// OnInformation event (information message)
///
- public Action? OnInformation { get; set; }
+ public EventHandler OnInformation = (sender, e) => { };
///
/// OnWarning event (warning message)
///
- public Action? OnWarning { get; set; }
+ public EventHandler OnWarning = (sender, e) => { };
///
/// OnError event (error message)
///
- public Action? OnError { get; set; }
+ public EventHandler OnError = (sender, e) => { };
///
/// Get all packages registered.
@@ -226,7 +232,7 @@ private async Task GetPackageDownloadResourceResult(
_sourceRepositories,
packageIdentity,
new PackageDownloadContext(_sourceCacheContext),
- SettingsUtility.GetGlobalPackagesFolder(_settings),
+ GlobalPackagesFolder,
_logger,
cancellationToken);
}
@@ -254,10 +260,6 @@ private async Task BuildInternal(CancellationToken cancellationToken = default)
LogInformation($"Filtering with regex: {Filter}");
}
- Action? onProgress = OnProgress;
-
- string globalPackagesFolder = SettingsUtility.GetGlobalPackagesFolder(_settings);
-
int progressCount = 0;
foreach (KeyValuePair packageDesc in _registry)
@@ -266,7 +268,7 @@ private async Task BuildInternal(CancellationToken cancellationToken = default)
RegistryEntry packageEntry = packageDesc.Value;
// Log progress count
- onProgress?.Invoke(++progressCount, _registry.Count);
+ OnProgress(this, new RegistryProgressEventArgs(++progressCount, _registry.Count));
// A package entry is ignored but allowed in the registry (case of Microsoft.CSharp)
if (packageEntry.Ignored || (regexFilter != null && !regexFilter.IsMatch(packageName)))
@@ -543,13 +545,15 @@ private async Task BuildInternal(CancellationToken cancellationToken = default)
// Update the cache entry
await WritePackageCacheEntry(packageId, cacheEntry, cancellationToken);
- if (packageConverted && IsRunningOnAzure)
+ if (packageConverted && IsRunningAsContinuousIntegration)
{
- string localPackagePath = Path.Combine(globalPackagesFolder, packageIdentity.Id.ToLowerInvariant(), packageIdentity.Version.ToString());
+ string localPackagePath = Path.Combine(GlobalPackagesFolder, packageIdentity.Id.ToLowerInvariant(), packageIdentity.Version.ToString());
if (Directory.Exists(localPackagePath))
{
Directory.Delete(localPackagePath, true);
+
+ LogInformation($"The NuGet package cache folder has been deleted: {localPackagePath}");
}
else
{
@@ -1397,19 +1401,19 @@ private static string Sha1sum(Stream stream)
private void LogInformation(string message)
{
_logger.LogInformation(message);
- OnInformation?.Invoke(message);
+ OnInformation(this, new RegistryLogEventArgs(message));
}
private void LogWarning(string message)
{
_logger.LogWarning(message);
- OnWarning?.Invoke(message);
+ OnWarning(this, new RegistryLogEventArgs(message));
}
private void LogError(string message)
{
_logger.LogError(message);
- OnError?.Invoke(message);
+ OnError(this, new RegistryLogEventArgs(message));
}
private static List SplitCommaSeparatedString(string input)
diff --git a/src/UnityNuGet/RegistryLogEventArgs.cs b/src/UnityNuGet/RegistryLogEventArgs.cs
new file mode 100644
index 0000000..7aa74f0
--- /dev/null
+++ b/src/UnityNuGet/RegistryLogEventArgs.cs
@@ -0,0 +1,12 @@
+namespace UnityNuGet
+{
+ public class RegistryLogEventArgs
+ {
+ public string Message { get; }
+
+ public RegistryLogEventArgs(string message)
+ {
+ Message = message;
+ }
+ }
+}
diff --git a/src/UnityNuGet/RegistryProgressEventArgs.cs b/src/UnityNuGet/RegistryProgressEventArgs.cs
new file mode 100644
index 0000000..e4fcd26
--- /dev/null
+++ b/src/UnityNuGet/RegistryProgressEventArgs.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace UnityNuGet
+{
+ public class RegistryProgressEventArgs : EventArgs
+ {
+ public int Current { get; }
+
+ public int Total { get; }
+
+ public RegistryProgressEventArgs(int current, int total)
+ {
+ Current = current;
+ Total = total;
+ }
+ }
+}