Skip to content

Commit

Permalink
Implement dual targetting (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkatufus authored Jan 23, 2025
1 parent 4187906 commit 1832d3b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</PropertyGroup>
<PropertyGroup>
<LibraryFramework>netstandard2.0</LibraryFramework>
<NetLibraryFramework>net6.0</NetLibraryFramework>
<TestsNetCoreFramework>net8.0</TestsNetCoreFramework>
<XunitVersion>2.8.1</XunitVersion>
<TestSdkVersion>17.11.1</TestSdkVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Cluster.Hosting/Akka.Cluster.Hosting.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(LibraryFramework)</TargetFramework>
<TargetFrameworks>$(LibraryFramework);$(NetLibraryFramework)</TargetFrameworks>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Description>Akka.Cluster and Akka.Cluster.Sharding Microsoft.Extensions.Hosting support.</Description>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Akka.Cluster.Hosting/AkkaClusterHostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public override string ToString()
sb.AppendLine($"remember-entities = {RememberEntities.ToHocon()}");

if(RememberEntitiesStore is not null)
sb.AppendLine($"remember-entities-store = {RememberEntitiesStore.ToString().ToLowerInvariant().ToHocon()}");
sb.AppendLine($"remember-entities-store = {RememberEntitiesStore.Value.ToString().ToLowerInvariant().ToHocon()}");

var journalId = JournalOptions?.PluginId ?? JournalPluginId ?? null;
if (journalId is not null)
Expand All @@ -376,7 +376,7 @@ public override string ToString()
sb.AppendLine($"snapshot-plugin-id = {snapshotId.ToHocon()}");

if (StateStoreMode is not null)
sb.AppendLine($"state-store-mode = {StateStoreMode.ToString().ToLowerInvariant().ToHocon()}");
sb.AppendLine($"state-store-mode = {StateStoreMode.Value.ToString().ToLowerInvariant().ToHocon()}");

if (LeaseImplementation is not null)
sb.AppendLine($"use-lease = {LeaseImplementation.ConfigPath}");
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Hosting.TestKit/Akka.Hosting.TestKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>TestKit for writing tests for Akka.NET using Akka.Hosting and xUnit.</Description>
<TargetFramework>$(LibraryFramework)</TargetFramework>
<TargetFrameworks>$(LibraryFramework);$(NetLibraryFramework)</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
Expand Down
9 changes: 6 additions & 3 deletions src/Akka.Hosting/ActorRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ public WaitForActorRegistration(Type key, TaskCompletionSource<IActorRef> waiter

public CancellationTokenRegistration CancellationRegistration { get; set; }

public bool Equals(WaitForActorRegistration other)
public bool Equals(WaitForActorRegistration? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Key == other.Key;
}

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is WaitForActorRegistration other && Equals(other);
}
Expand Down Expand Up @@ -336,11 +336,14 @@ private void NotifyWaiters(Type key, IActorRef value)
}
}

private static Action<object> CancelWaiter(Type key, CancellationToken ct,
private static Action<object?> CancelWaiter(Type key, CancellationToken ct,
WaitForActorRegistration waitingRegistration)
{
return dict =>
{
if (dict is null)
return;

// first step during timeout is to remove our registration
var d = (ConcurrentDictionary<Type, ImmutableHashSet<WaitForActorRegistration>>)dict;
d.AddOrUpdate(key, type => ImmutableHashSet<WaitForActorRegistration>.Empty,
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Hosting/Akka.Hosting.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(LibraryFramework)</TargetFramework>
<TargetFrameworks>$(LibraryFramework);$(NetLibraryFramework)</TargetFrameworks>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Description>Akka.NET Microsoft.Extensions.Hosting support.</Description>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Hosting/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static bool IsRunningInMaui
{
get
{
_runningInMaui ??= AppDomain.CurrentDomain.GetAssemblies().Any(asm => asm.GetName().Name.StartsWith("Microsoft.Maui"));
_runningInMaui ??= AppDomain.CurrentDomain.GetAssemblies().Any(asm => asm?.GetName()?.Name?.StartsWith("Microsoft.Maui") ?? false);
return _runningInMaui.Value;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(LibraryFramework)</TargetFramework>
<TargetFrameworks>$(LibraryFramework);$(NetLibraryFramework)</TargetFrameworks>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Description>Akka.Persistence Microsoft.Extensions.Hosting support.</Description>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Remote.Hosting/Akka.Remote.Hosting.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(LibraryFramework)</TargetFramework>
<TargetFrameworks>$(LibraryFramework);$(NetLibraryFramework)</TargetFrameworks>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Description>Akka.Remote Microsoft.Extensions.Hosting support.</Description>
<LangVersion>Latest</LangVersion>
Expand Down

0 comments on commit 1832d3b

Please # to comment.