diff --git a/Directory.Build.props b/Directory.Build.props
index 84068b4..9ffb047 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,4 +6,10 @@
3.5.119
+
+
+ preview
+ enable
+ enable
+
\ No newline at end of file
diff --git a/MSBuild.CompilerCache.Benchmarks/MSBuild.CompilerCache.Benchmarks.csproj b/MSBuild.CompilerCache.Benchmarks/MSBuild.CompilerCache.Benchmarks.csproj
index bb38bf6..338a3c8 100644
--- a/MSBuild.CompilerCache.Benchmarks/MSBuild.CompilerCache.Benchmarks.csproj
+++ b/MSBuild.CompilerCache.Benchmarks/MSBuild.CompilerCache.Benchmarks.csproj
@@ -2,9 +2,7 @@
Exe
- net6.0
- enable
- enable
+ net8.0
Benchmarks
@@ -14,7 +12,7 @@
-
+
diff --git a/MSBuild.CompilerCache.Benchmarks/Program.cs b/MSBuild.CompilerCache.Benchmarks/Program.cs
index 25e4b89..384711b 100644
--- a/MSBuild.CompilerCache.Benchmarks/Program.cs
+++ b/MSBuild.CompilerCache.Benchmarks/Program.cs
@@ -33,12 +33,13 @@ public void HashCalculationPerfTest()
var decomposed = TargetsExtractionUtils.DecomposeCompilerProps(inputs.AllProps);
var memCache = new DictionaryBasedCache();
var refCacheFileBased = new RefCache("c:/projekty/.refcache");
- var refCache = new CacheCombiner(memCache, refCacheFileBased);
+ var refCache = CacheCombiner.Combine(memCache, refCacheFileBased);
var refTrimmingConfig = new RefTrimmingConfig();
void Act()
{
- var inputs = LocatorAndPopulator.CalculateLocalInputs(decomposed, refCache, "assembly", refTrimmingConfig, new DictionaryBasedCache(), Utils.DefaultHasher);
+ var hasher = HasherFactory.CreateHash(HasherType.XxHash64);
+ var inputs = LocatorAndPopulator.CalculateLocalInputs(decomposed, refCache, "assembly", refTrimmingConfig, new DictionaryBasedCache(), hasher, null);
if (inputs.Files.Length == 0) throw new Exception();
}
diff --git a/MSBuild.CompilerCache.Tests/EndToEndTests.cs b/MSBuild.CompilerCache.Tests/EndToEndTests.cs
index 480ca48..dc62452 100644
--- a/MSBuild.CompilerCache.Tests/EndToEndTests.cs
+++ b/MSBuild.CompilerCache.Tests/EndToEndTests.cs
@@ -47,21 +47,21 @@ private static string NugetConfig(string sourcePath) =>
""";
private static readonly string PropsFile =
- $"""
-
-
-
- true
- Embedded
- true
-
-
-
- $(MSBuildThisFileDirectory).cache/
-
-
-
-""";
+ """
+
+
+
+ true
+ Embedded
+ true
+
+
+
+ $(MSBuildThisFileDirectory).cache/
+
+
+
+ """;
public void Dispose()
{
@@ -133,9 +133,9 @@ public record ProjectFileBuilder
public bool GenerateDocumentationFile { get; init; } = true;
public bool ProduceReferenceAssembly { get; init; } = true;
public string? AssemblyName { get; init; } = null;
- public string? CompilationCacheConfigPath { get; init; } = null;
+ public string? CompilerCacheConfigPath { get; init; }
public string TargetFramework { get; init; } = "net6.0";
- public string Name { get; init; } = null;
+ public string Name { get; init; }
public ProjectFileBuilder(string name) => Name = name;
@@ -176,7 +176,7 @@ void AddIfNotNull(string name, string? value)
}
AddIfNotNull("AssemblyName", AssemblyName);
- AddIfNotNull("CompilationCacheConfigPath", CompilationCacheConfigPath);
+ AddIfNotNull("CompilerCacheConfigPath", CompilerCacheConfigPath);
return properties;
}
@@ -249,9 +249,9 @@ FileInfo DllFile(DirectoryInfo projDir, ProjectFileBuilder proj) =>
var dll2 = DllFile(projDir2, proj);
var dll3 = DllFile(projDir3, proj);
- var hash1 = Utils.FileBytesToHashHex(dll1.FullName, Utils.DefaultHasher);
- var hash2 = Utils.FileBytesToHashHex(dll2.FullName, Utils.DefaultHasher);
- var hash3 = Utils.FileBytesToHashHex(dll3.FullName, Utils.DefaultHasher);
+ var hash1 = TestUtils.FileBytesToHash(dll1.FullName, TestUtils.DefaultHasher);
+ var hash2 = TestUtils.FileBytesToHash(dll2.FullName, TestUtils.DefaultHasher);
+ var hash3 = TestUtils.FileBytesToHash(dll3.FullName, TestUtils.DefaultHasher);
Assert.That(hash2, Is.EqualTo(hash1));
Assert.That(hash3, Is.Not.EqualTo(hash2));
@@ -269,7 +269,7 @@ public class Class { }
var proj =
new ProjectFileBuilder("C.csproj")
{
- CompilationCacheConfigPath = configFile.FullName,
+ CompilerCacheConfigPath = configFile.FullName,
ProduceReferenceAssembly = produceRefAssembly
}
.WithSource(source);
@@ -285,7 +285,7 @@ namespace CSharp
var proj =
new ProjectFileBuilder("F.fsproj")
{
- CompilationCacheConfigPath = configFile.FullName,
+ CompilerCacheConfigPath = configFile.FullName,
ProduceReferenceAssembly = produceRefAssembly
}
.WithSource(source);
@@ -313,7 +313,7 @@ private static string[] BuildProject(DirectoryInfo dir, ProjectFileBuilder proje
{
Environment.SetEnvironmentVariable("MSBuildSDKsPath", null);
Environment.SetEnvironmentVariable("MSBuildExtensionsPath", null);
- TestUtils.RunProcess("dotnet", $"add package MSBuild.CompilerCache --prerelease", dir);
- return TestUtils.RunProcess("dotnet", $"build -verbosity:normal", dir);
+ TestUtils.RunProcess("dotnet", "add package MSBuild.CompilerCache --prerelease", dir);
+ return TestUtils.RunProcess("dotnet", "build -verbosity:normal", dir);
}
}
\ No newline at end of file
diff --git a/MSBuild.CompilerCache.Tests/Extensions.cs b/MSBuild.CompilerCache.Tests/Extensions.cs
index 7d3b2d1..d68fa60 100644
--- a/MSBuild.CompilerCache.Tests/Extensions.cs
+++ b/MSBuild.CompilerCache.Tests/Extensions.cs
@@ -1,6 +1,8 @@
+using Newtonsoft.Json;
+
namespace Tests;
public static class Extensions
{
- public static string ToJson(this object x) => Newtonsoft.Json.JsonConvert.SerializeObject(x);
+ public static string ToJson(this object x) => JsonConvert.SerializeObject(x);
}
\ No newline at end of file
diff --git a/MSBuild.CompilerCache.Tests/InMemoryTaskBasedTests.cs b/MSBuild.CompilerCache.Tests/InMemoryTaskBasedTests.cs
index f4bc8ea..7745f2e 100644
--- a/MSBuild.CompilerCache.Tests/InMemoryTaskBasedTests.cs
+++ b/MSBuild.CompilerCache.Tests/InMemoryTaskBasedTests.cs
@@ -4,8 +4,8 @@
using MSBuild.CompilerCache;
using Newtonsoft.Json;
using NUnit.Framework;
-using IRefCache =
- MSBuild.CompilerCache.ICacheBase;
+using IRefCache = MSBuild.CompilerCache.ICacheBase;
+using JsonSerializer = System.Text.Json.JsonSerializer;
namespace Tests;
@@ -35,7 +35,7 @@ public void SetUp()
dict[(key, life)] = value);
_buildEngine
- .Setup(x => x.GetRegisteredTaskObject(It.IsAny