Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Google.Protobuf from 3.27.3 to 3.28.0 in /src/net #277

Merged
343 changes: 297 additions & 46 deletions .github/workflows/build.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MASES.KNet.Serialization.Avro" Version="2.8.0" />
<PackageReference Include="MASES.KNet.Serialization.Avro" Version="2.8.1" />
</ItemGroup>

<ItemGroup>
<None Update="AvroValueContainer.avsc">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

<ItemGroup>
<ProjectReference Include="..\KEFCore.SerDes\KEFCore.SerDes.csproj" />
<PackageReference Include="Google.Protobuf" Version="3.27.3" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.27.3">
<PackageReference Include="Google.Protobuf" Version="3.28.2" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.28.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/net/KEFCore.SerDes.Protobuf/ProtobufKEFCoreSerDes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static class ProtobufKEFCoreSerDes
/// <summary>
/// Base class to define key extensions of <see cref="ISerDesSelector{T}"/>, for example <see href="https://masesgroup.github.io/KNet/articles/usageSerDes.html"/>
/// </summary>
public class Key<T> : ISerDesSelector<T> where T : class, IMessage<T>
public class Key<T> : ISerDesSelector<T>
{
/// <summary>
/// Returns a new instance of <see cref="Key{T}"/>
Expand Down
4 changes: 2 additions & 2 deletions src/net/KEFCore.SerDes/KEFCore.SerDes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.33" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="MASES.KNet" Version="2.8.1">
<IncludeAssets>All</IncludeAssets>
Expand Down
49 changes: 41 additions & 8 deletions test/Common/ProgramConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@
using System.Text.Json;
using Java.Lang;
using Java.Util.Concurrent;
using System.Collections.Generic;
using System.Reflection;

namespace MASES.EntityFrameworkCore.KNet.Test.Common
{
public class ProgramConfig
{
public bool UseJson { get; set; } = false;
public bool UseProtobuf { get; set; } = false;
public bool UseAvro { get; set; } = false;
public bool UseAvroBinary { get; set; } = false;
public bool UseAvroBinary { get; set; } = true;
public bool EnableKEFCoreTracing { get; set; } = false;
public bool UseInMemoryProvider { get; set; } = false;
public bool UseModelBuilder { get; set; } = false;
Expand Down Expand Up @@ -84,7 +87,10 @@ public void ApplyOnContext(KafkaDbContext context)
context.UseEnumeratorWithPrefetch = UseEnumeratorWithPrefetch;
context.UseByteBufferDataTransfer = UseByteBufferDataTransfer;

if (UseProtobuf)
if (UseJson)
{ // default
}
else if (UseProtobuf)
{
context.KeySerDesSelectorType = typeof(ProtobufKEFCoreSerDes.Key<>);
context.ValueContainerType = typeof(ProtobufValueContainer<>);
Expand All @@ -104,19 +110,46 @@ public void ApplyOnContext(KafkaDbContext context)

public static void LoadConfig(string[] args)
{
if (args.Length > 0)
const string FileFormat = "/f:";
const string PropertyFormat = "/p:";

Dictionary<PropertyInfo, object> properties = new Dictionary<PropertyInfo, object>();
var props = typeof(ProgramConfig).GetProperties();
string file = null;
foreach (var arg in args)
{
if (arg.StartsWith(FileFormat))
{
file = arg[FileFormat.Length..];
if (!File.Exists(file)) { throw new FileNotFoundException($"{file} is not a configuration file.", file); }
}
else if (arg.StartsWith(PropertyFormat))
{
var argVal = arg[FileFormat.Length..];
var values = argVal.Split('=');
foreach (var prop in props)
{
if (prop.Name == values[0])
{
properties.Add(prop, Convert.ChangeType(values[1], prop.PropertyType));
}
}
}
else if (File.Exists(arg)) file = arg;
}

if (!string.IsNullOrWhiteSpace(file))
{
if (!File.Exists(args[0])) { throw new FileNotFoundException($"{args[0]} is not a configuration file.", args[0]); }
Config = JsonSerializer.Deserialize<ProgramConfig>(File.ReadAllText(args[0]));
Config = JsonSerializer.Deserialize<ProgramConfig>(File.ReadAllText(file));
}
else Config = new();

if (args.Length > 1)
foreach (var property in properties)
{
Config.BootstrapServers = args[1];
property.Key.SetValue(Config, property.Value);
}

ReportString(JsonSerializer.Serialize<ProgramConfig>(Config, new JsonSerializerOptions() { WriteIndented = true }));
ReportString(JsonSerializer.Serialize(Config, new JsonSerializerOptions() { WriteIndented = true }));

if (!KafkaDbContext.EnableKEFCoreTracing) KafkaDbContext.EnableKEFCoreTracing = Config.EnableKEFCoreTracing;

Expand Down
Loading