Skip to content

Commit

Permalink
Enable features that are now in the netstandard2.0 library set (but w…
Browse files Browse the repository at this point in the history
…ere missing from the 1.x library set). akkadotnet#3668
  • Loading branch information
transmax-open-source authored and Aaronontheweb committed Feb 28, 2020
1 parent ad50778 commit 67d173e
Show file tree
Hide file tree
Showing 78 changed files with 61 additions and 368 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public AsyncReplayTimeoutException(string message)
{
}

#if SERIALIZATION
/// <summary>
/// Initializes a new instance of the <see cref="AsyncReplayTimeoutException"/> class.
/// </summary>
Expand All @@ -53,7 +52,6 @@ protected AsyncReplayTimeoutException(SerializationInfo info, StreamingContext c
: base(info, context)
{
}
#endif
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
<Reference Include="System.Data.DataSetExtensions" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<ProjectReference Include="..\..\..\core\Akka.Cluster\Akka.Cluster.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ public sealed class ClusterSingletonManagerIsStuckException : AkkaException
/// <param name="message">The message that describes the error.</param>
public ClusterSingletonManagerIsStuckException(string message) : base(message) { }

#if SERIALIZATION
/// <summary>
/// Initializes a new instance of the <see cref="ClusterSingletonManagerIsStuckException"/> class.
/// </summary>
Expand All @@ -434,7 +433,6 @@ public ClusterSingletonManagerIsStuckException(string message) : base(message) {
public ClusterSingletonManagerIsStuckException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endif
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
<PackageReference Include="Hyperion" Version="$(HyperionVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION;CLONABLE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions src/contrib/cluster/Akka.DistributedData/Durable/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ public LoadFailedException(string message, Exception cause) : base(message, caus
{
}

#if SERIALIZATION
public LoadFailedException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endif
}

public sealed class DurableDataEnvelope : IReplicatorMessage, IEquatable<DurableDataEnvelope>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<ProjectReference Include="..\..\..\core\Akka\Akka.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);APPDOMAIN</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
24 changes: 0 additions & 24 deletions src/contrib/dependencyinjection/Akka.DI.Core/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
using System.Reflection;
using Akka.Actor;

#if CORECLR
using Microsoft.Extensions.DependencyModel;
#endif
namespace Akka.DI.Core
{
/// <summary>
Expand Down Expand Up @@ -78,28 +75,7 @@ public static Type GetTypeValue(this string typeName)
/// <returns>The list of loaded assemblies</returns>
private static IEnumerable<Assembly> GetLoadedAssemblies()
{
#if APPDOMAIN
return AppDomain.CurrentDomain.GetAssemblies();
#elif CORECLR
var assemblies = new List<Assembly>();
var dependencies = DependencyContext.Default.RuntimeLibraries;
foreach (var library in dependencies)
{
try
{
var assembly = Assembly.Load(new AssemblyName(library.Name));
assemblies.Add(assembly);
}
catch
{
//do nothing can't if can't load assembly
}
}
return assemblies;
#else
#warning Method not implemented
throw new NotImplementedException();
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<ProjectReference Include="..\..\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
<DefineConstants>$(DefineConstants);APPDOMAIN</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION;CONFIGURATION</DefineConstants>
<DefineConstants>$(DefineConstants);CONFIGURATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Akka.Tests.Shared.Internals\Akka.Tests.Shared.Internals.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public AkkaEqualException(object expected, object actual, string format = "", pa
_args = args;
}

#if SERIALIZATION
/// <summary>
/// Initializes a new instance of the <see cref="AkkaEqualException"/> class.
/// </summary>
Expand All @@ -43,7 +42,7 @@ protected AkkaEqualException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif

/// <summary>
/// The message that describes the error.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public AkkaEqualException(object expected, object actual, string format = "", pa
_args = args;
}

#if SERIALIZATION
/// <summary>
/// Initializes a new instance of the <see cref="AkkaEqualException"/> class.
/// </summary>
Expand All @@ -43,7 +42,7 @@ protected AkkaEqualException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif

/// <summary>
/// The message that describes the error.
/// </summary>
Expand Down
4 changes: 0 additions & 4 deletions src/core/Akka.Cluster.TestKit/Akka.Cluster.TestKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<ProjectReference Include="..\Akka.Cluster\Akka.Cluster.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
4 changes: 0 additions & 4 deletions src/core/Akka.Cluster/Akka.Cluster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<ProjectReference Include="..\Akka.Remote\Akka.Remote.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
// </auto-generated>
// ------------------------------------------------------------------------------

#if CORECLR
using Akka.MultiNodeTestRunner.Shared.Extensions;
#endif

namespace Akka.MultiNodeTestRunner.Shared.Persistence
{
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
using System.Linq;
using Akka.Actor;
using Akka.Event;
#if CORECLR
using Akka.MultiNodeTestRunner.Shared.Extensions;
#endif
using Akka.MultiNodeTestRunner.Shared.Reporting;

namespace Akka.MultiNodeTestRunner.Shared.Sinks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,7 @@ private void PublishToChildren(RunnerMessage message)
{
foreach (var sink in Sinks)
{
#if CORECLR
sink.LogRunnerMessage(message.Message, Assembly.GetEntryAssembly().GetName().Name, LogLevel.InfoLevel);
#else
sink.LogRunnerMessage(message.Message, Assembly.GetExecutingAssembly().GetName().Name, LogLevel.InfoLevel);
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Event;
#if CORECLR
using Akka.MultiNodeTestRunner.Shared.Extensions;
#endif
using Akka.MultiNodeTestRunner.Shared.Reporting;
using JetBrains.TeamCity.ServiceMessages;
using JetBrains.TeamCity.ServiceMessages.Write.Special;
Expand Down
19 changes: 0 additions & 19 deletions src/core/Akka.MultiNodeTestRunner/Discovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@

namespace Akka.MultiNodeTestRunner
{
#if CORECLR
public class Discovery : IMessageSink, IDisposable
#else
public class Discovery : MarshalByRefObject, IMessageSink, IDisposable
#endif
{
public Dictionary<string, List<NodeTest>> Tests { get; set; }
public List<ErrorMessage> Errors { get; } = new List<ErrorMessage>();
Expand Down Expand Up @@ -124,20 +120,11 @@ internal static ConstructorInfo FindConfigConstructor(Type configUser)
var current = configUser;
while (current != null)
{

#if CORECLR
var ctorWithConfig = current
.GetConstructors(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance)
.FirstOrDefault(c => null != c.GetParameters().FirstOrDefault(p => p.ParameterType.GetTypeInfo().IsSubclassOf(baseConfigType)));

current = current.GetTypeInfo().BaseType;
#else
var ctorWithConfig = current
.GetConstructors(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance)
.FirstOrDefault(c => null != c.GetParameters().FirstOrDefault(p => p.ParameterType.IsSubclassOf(baseConfigType)));

current = current.BaseType;
#endif
if (ctorWithConfig != null) return ctorWithConfig;
}

Expand All @@ -149,15 +136,9 @@ private object[] ConfigConstructorParamValues(Type configType)
var ctors = configType.GetConstructors(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
var empty = ctors.FirstOrDefault(c => !c.GetParameters().Any());

#if CORECLR
return empty != null
? new object[0]
: ctors.First().GetParameters().Select(p => p.ParameterType.GetTypeInfo().IsValueType ? Activator.CreateInstance(p.ParameterType) : null).ToArray();
#else
return empty != null
? new object[0]
: ctors.First().GetParameters().Select(p => p.ParameterType.IsValueType ? Activator.CreateInstance(p.ParameterType) : null).ToArray();
#endif
}

/// <inheritdoc/>
Expand Down
8 changes: 0 additions & 8 deletions src/core/Akka.Persistence.Query/Akka.Persistence.Query.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
<ProjectReference Include="..\Akka.Streams\Akka.Streams.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants)</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
4 changes: 0 additions & 4 deletions src/core/Akka.Persistence.TCK/Akka.Persistence.TCK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<ProjectReference Include="..\Akka.Streams.TestKit\Akka.Streams.TestKit.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions src/core/Akka.Persistence.TCK/Journal/JournalSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ public void Journal_should_serialize_events()
Assertions.AssertEqual(_receiverProbe.ExpectMsg<RecoverySuccess>().HighestSequenceNr, 6L);
}

#if !CORECLR
/// <summary>
/// JSON serializer should fail on this
/// </summary>
Expand Down Expand Up @@ -359,6 +358,5 @@ public void Journal_optionally_may_reject_non_serializable_events()
m.Persistent.WriterGuid.Equals(writerGuid) &&
m.Persistent.Payload.Equals("b-8"));
}
#endif
}
}
3 changes: 0 additions & 3 deletions src/core/Akka.Persistence/Akka.Persistence.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="$(ProtobufVersion)" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZATION</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 67d173e

Please sign in to comment.