Skip to content

Commit

Permalink
Have added net 6 as a TFM and implement conditional packages
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson-tomo authored and lukebakken committed Feb 13, 2024
1 parent 13dbfdc commit e418160
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .ci/versions.json
@@ -1,4 +1,4 @@
{
"erlang": "26.0.2",
"rabbitmq": "3.12.4"
"erlang": "26.2.2",
"rabbitmq": "3.12.12"
}
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;net6.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AssemblyTitle>RabbitMQ OAuth2 Client Library for .NET</AssemblyTitle>
Expand Down Expand Up @@ -59,6 +59,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="4.3.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net462' OR $(TargetFramework) == 'netstandard2.0'">
<PackageReference Include="System.Net.Http.Json" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions projects/RabbitMQ.Client/RabbitMQ.Client.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;net6.0</TargetFrameworks>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down Expand Up @@ -60,10 +60,10 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />

<PackageReference Include="MinVer" Version="4.3.0" PrivateAssets="All" />
<PackageReference Include="System.Threading.Channels" Version="7.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<ItemGroup Condition="$(TargetFramework) == 'net462' OR $(TargetFramework) == 'netstandard2.0'">
<PackageReference Include="System.Threading.Channels" Version="7.0.0" />
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>

Expand Down
Expand Up @@ -47,7 +47,7 @@ public RabbitMqClientEventSource() : base(EventSourceSettings.EtwSelfDescribingE
{
}

public static RabbitMqClientEventSource Log = new RabbitMqClientEventSource();
public static readonly RabbitMqClientEventSource Log = new RabbitMqClientEventSource();

[Event(1, Message = "INFO", Keywords = Keywords.Log, Level = EventLevel.Informational)]
public void Info(string message)
Expand Down
16 changes: 8 additions & 8 deletions projects/RabbitMQ.Client/util/NetworkOrderDeserializer.cs
Expand Up @@ -15,7 +15,7 @@ internal static double ReadDouble(ReadOnlySpan<byte> span)
throw new ArgumentOutOfRangeException(nameof(span), "Insufficient length to decode Double from memory.");
}
ulong val = ReadUInt64(span);
#elif NETSTANDARD
#else
ulong val = BinaryPrimitives.ReadUInt64BigEndian(span);
#endif
return Unsafe.As<ulong, double>(ref val);
Expand All @@ -31,7 +31,7 @@ internal static short ReadInt16(ReadOnlySpan<byte> span)
}

return (short)ReadUInt16(span);
#elif NETSTANDARD
#else
return BinaryPrimitives.ReadInt16BigEndian(span);
#endif
}
Expand All @@ -46,7 +46,7 @@ internal static int ReadInt32(ReadOnlySpan<byte> span)
}

return (int)ReadUInt32(span);
#elif NETSTANDARD
#else
return BinaryPrimitives.ReadInt32BigEndian(span);
#endif
}
Expand All @@ -61,7 +61,7 @@ internal static long ReadInt64(ReadOnlySpan<byte> span)
}

return (long)ReadUInt64(span);
#elif NETSTANDARD
#else
return BinaryPrimitives.ReadInt64BigEndian(span);
#endif
}
Expand All @@ -76,7 +76,7 @@ internal static float ReadSingle(ReadOnlySpan<byte> span)
}

uint num = ReadUInt32(span);
#elif NETSTANDARD
#else
uint num = BinaryPrimitives.ReadUInt32BigEndian(span);
#endif
return Unsafe.As<uint, float>(ref num);
Expand All @@ -92,7 +92,7 @@ internal static ushort ReadUInt16(ReadOnlySpan<byte> span)
}

return (ushort)((span[0] << 8) | span[1]);
#elif NETSTANDARD
#else
return BinaryPrimitives.ReadUInt16BigEndian(span);
#endif
}
Expand All @@ -107,7 +107,7 @@ internal static uint ReadUInt32(ReadOnlySpan<byte> span)
}

return (uint)((span[0] << 24) | (span[1] << 16) | (span[2] << 8) | span[3]);
#elif NETSTANDARD
#else
return BinaryPrimitives.ReadUInt32BigEndian(span);
#endif
}
Expand All @@ -124,7 +124,7 @@ internal static ulong ReadUInt64(ReadOnlySpan<byte> span)
uint num1 = (uint)((span[0] << 24) | (span[1] << 16) | (span[2] << 8) | span[3]);
uint num2 = (uint)((span[4] << 24) | (span[5] << 16) | (span[6] << 8) | span[7]);
return ((ulong)num1 << 32) | num2;
#elif NETSTANDARD
#else
return BinaryPrimitives.ReadUInt64BigEndian(span);
#endif
}
Expand Down
4 changes: 3 additions & 1 deletion projects/Unit/APIApproval.Approve.verified.txt
Expand Up @@ -675,10 +675,12 @@ namespace RabbitMQ.Client
public static RabbitMQ.Client.TimerBasedCredentialRefresherEventSource Log { get; }
[System.Diagnostics.Tracing.Event(6)]
public void AlreadyRegistered(string name) { }
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification="Parameters to this method are primitive and are trimmer safe")]
[System.Diagnostics.Tracing.Event(5)]
public void RefreshedCredentials(string name, bool succesfully) { }
[System.Diagnostics.Tracing.Event(1)]
public void Registered(string name) { }
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification="Parameters to this method are primitive and are trimmer safe")]
[System.Diagnostics.Tracing.Event(3)]
public void ScheduledTimer(string name, double interval) { }
[System.Diagnostics.Tracing.Event(4)]
Expand Down Expand Up @@ -985,7 +987,7 @@ namespace RabbitMQ.Client.Logging
[System.Diagnostics.Tracing.EventSource(Name="rabbitmq-dotnet-client")]
public sealed class RabbitMqClientEventSource : System.Diagnostics.Tracing.EventSource
{
public static RabbitMQ.Client.Logging.RabbitMqClientEventSource Log;
public static readonly RabbitMQ.Client.Logging.RabbitMqClientEventSource Log;
public RabbitMqClientEventSource() { }
[System.Diagnostics.Tracing.Event(3, Keywords=System.Diagnostics.Tracing.EventKeywords.None, Level=System.Diagnostics.Tracing.EventLevel.Error, Message="ERROR")]
public void Error(string message, RabbitMQ.Client.Logging.RabbitMqExceptionDetail ex) { }
Expand Down

0 comments on commit e418160

Please sign in to comment.