Skip to content

Commit

Permalink
implement dual targetting for both netstandard2.0 and net60 (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkatufus authored Jan 23, 2025
1 parent c805144 commit f8b7a68
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

<PackageReference Include="System.Data.SQLite" />

<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected Configuration.Config Config()
}}")
.WithFallback(SqlPersistence.DefaultConfiguration)
.WithFallback(ClusterSharding.DefaultConfig())
.WithFallback(ClusterSingletonManager.DefaultConfig());
.WithFallback(ClusterSingleton.DefaultConfig());

protected virtual Task InitializeTestAsync()
=> Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetStandardLibVersion)</TargetFramework>
<TargetFrameworks>$(NetStandardLibVersion);$(NetLibVersion)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<ItemGroup>
<PackageReference Include="System.CommandLine" />
<PackageReference Include="Microsoft.Data.SqlClient" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Persistence.Sql/Akka.Persistence.Sql.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>An Akka Persistence Module for SQL Databases using Linq2Db.</Description>
<TargetFramework>$(NetStandardLibVersion)</TargetFramework>
<TargetFrameworks>$(NetStandardLibVersion);$(NetLibVersion)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Persistence.Sql/Config/EventJournalTableConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public EventJournalTableConfig(Configuration.Config config)

public JournalTableColumnNames ColumnNames { get; }

public bool Equals(EventJournalTableConfig other)
public bool Equals(EventJournalTableConfig? other)
{
if (ReferenceEquals(null, other))
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Persistence.Sql/Config/JournalTableConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public JournalTableConfig(Configuration.Config config)
// ReSharper disable once InconsistentNaming
public TagTableConfig TagTable { get; }

public bool Equals(JournalTableConfig other)
public bool Equals(JournalTableConfig? other)
{
if (ReferenceEquals(null, other))
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Persistence.Sql/Config/MultiDataOptionsSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed class MultiDataOptionsSetup: Setup
public void AddDataOptions(string pluginId, DataOptions dataOptions)
=> _options[pluginId] = dataOptions;

public bool TryGetDataOptionsFor(string pluginId, out DataOptions dataOptions)
public bool TryGetDataOptionsFor(string pluginId, out DataOptions? dataOptions)
=> _options.TryGetValue(pluginId, out dataOptions);

public void RemoveDataOptionsFor(string pluginId)
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Persistence.Sql/Journal/SqlWriteJournal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public SqlWriteJournal(Configuration.Config journalConfig)
{
var multiSetup = setup.Get<MultiDataOptionsSetup>();
if (multiSetup.HasValue && multiSetup.Value.TryGetDataOptionsFor(_journalConfig.PluginId, out var dataOptions))
_journalConfig = _journalConfig.WithDataOptions(dataOptions);
_journalConfig = _journalConfig.WithDataOptions(dataOptions!);
}

_useWriterUuid = _journalConfig.TableConfig.EventJournalTable.UseWriterUuidColumn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private static async Task<List<JournalRow>> AddTagDataFromTagTableAsync(IQueryab
var result = new List<JournalRow>();
foreach (var rowAndTags in rowsAndTags)
{
rowAndTags.row.TagArray = rowAndTags.tags?.Split([';'], StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
rowAndTags.row.TagArray = rowAndTags.tags?.Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
result.Add(rowAndTags.row);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Akka.Persistence.Sql/Query/SqlReadJournal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public SqlReadJournal(

var multiSetup = setup.Get<MultiDataOptionsSetup>();
if (multiSetup.HasValue && multiSetup.Value.TryGetDataOptionsFor(_readJournalConfig.PluginId, out var dataOptions))
_readJournalConfig = _readJournalConfig.WithDataOptions(dataOptions);
_readJournalConfig = _readJournalConfig.WithDataOptions(dataOptions!);

_eventAdapters = Persistence.Instance.Apply(system).AdaptersFor(_readJournalConfig.WritePluginId);

Expand Down
3 changes: 1 addition & 2 deletions src/Akka.Persistence.Sql/Snapshot/SqlSnapshotStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SqlSnapshotStore(Configuration.Config snapshotConfig)
{
var multiSetup = setup.Get<MultiDataOptionsSetup>();
if (multiSetup.HasValue && multiSetup.Value.TryGetDataOptionsFor(_settings.PluginId, out var dataOptions))
_settings = _settings.WithDataOptions(dataOptions);
_settings = _settings.WithDataOptions(dataOptions!);
}

_dao = new ByteArraySnapshotDao(
Expand Down Expand Up @@ -76,7 +76,6 @@ private bool WaitingForInitialization(object message)
_log.Error(msg.Cause, "Error during {0} initialization", Self);
// trigger a restart so we have some hope of succeeding in the future even if initialization failed
throw new ApplicationException("Failed to initialize SQL SnapshotStore.", msg.Cause);
return true;

default:
Stash.Stash();
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<PropertyGroup>
<NetStandardLibVersion>netstandard2.0</NetStandardLibVersion>
<NetLibVersion>net6.0</NetLibVersion>
<NetCoreTestVersion>net8.0</NetCoreTestVersion>
</PropertyGroup>

Expand Down
3 changes: 1 addition & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<FluentMigratorVersion>5.2.0</FluentMigratorVersion>
<SqliteVersion>1.0.118</SqliteVersion>
<MicrosoftSqliteVersion>8.0.7</MicrosoftSqliteVersion>
<MicrosoftExtensionsVersion>[8.0.0, )</MicrosoftExtensionsVersion>
<MicrosoftExtensionsVersion>[6.0.0, )</MicrosoftExtensionsVersion>
</PropertyGroup>
<!-- Akka dependencies -->
<ItemGroup>
Expand Down Expand Up @@ -77,7 +77,6 @@
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftExtensionsVersion)" />
</ItemGroup>
<!-- SourceLink support for all Akka.NET projects -->
<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Examples/HoconConfiguration/HoconConfiguration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit f8b7a68

Please sign in to comment.