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

Split namespaces into Different Libraries. #3136

Merged
merged 13 commits into from
Feb 15, 2024
Merged
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ jobs:
dotnet pack ./src/Neo \
--configuration Release \
--output ./out
- name : Pack (Neo.IO)
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack ./src/Neo.IO \
--configuration Release \
--output ./out
- name : Pack (Neo.Extensions)
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack ./src/Neo.Extensions \
--configuration Release \
--output ./out
- name : Pack (Neo.Json)
if: steps.check_tag.outputs.statusCode == '404'
run: |
Expand Down
22 changes: 18 additions & 4 deletions neo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.VM", "src\Neo.VM\Neo.VM
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.VM.Tests", "tests\Neo.VM.Tests\Neo.VM.Tests.csproj", "{005F84EB-EA2E-449F-930A-7B4173DDC7EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.ConsoleService", "src\Neo.ConsoleService\Neo.ConsoleService.csproj", "{9E886812-7243-48D8-BEAF-47AADC11C054}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.ConsoleService", "src\Neo.ConsoleService\Neo.ConsoleService.csproj", "{9E886812-7243-48D8-BEAF-47AADC11C054}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.GUI", "src\Neo.GUI\Neo.GUI.csproj", "{02ABDE42-9880-43B4-B6F7-8D618602A277}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.GUI", "src\Neo.GUI\Neo.GUI.csproj", "{02ABDE42-9880-43B4-B6F7-8D618602A277}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.CLI", "src\Neo.CLI\Neo.CLI.csproj", "{BDFBE455-4C1F-4FC4-B5FC-1387B93A8687}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.CLI", "src\Neo.CLI\Neo.CLI.csproj", "{BDFBE455-4C1F-4FC4-B5FC-1387B93A8687}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.ConsoleService.Tests", "tests\Neo.ConsoleService.Tests\Neo.ConsoleService.Tests.csproj", "{B40F8584-5AFB-452C-AEFA-009C80CC23A9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.ConsoleService.Tests", "tests\Neo.ConsoleService.Tests\Neo.ConsoleService.Tests.csproj", "{B40F8584-5AFB-452C-AEFA-009C80CC23A9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Cryptography.BLS12_381", "src\Neo.Cryptography.BLS12_381\Neo.Cryptography.BLS12_381.csproj", "{D48C1FAB-3471-4CA0-8688-25E6F43F2C25}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Cryptography.BLS12_381.Tests", "tests\Neo.Cryptography.BLS12_381.Tests\Neo.Cryptography.BLS12_381.Tests.csproj", "{387CCF6C-9A26-43F6-A639-0A82E91E10D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.IO", "src\Neo.IO\Neo.IO.csproj", "{4CDAC1AA-45C6-4157-8D8E-199050433048}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Extensions", "src\Neo.Extensions\Neo.Extensions.csproj", "{9C5213D6-3833-4570-8AE2-47E9F9017A8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -98,6 +102,14 @@ Global
{387CCF6C-9A26-43F6-A639-0A82E91E10D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{387CCF6C-9A26-43F6-A639-0A82E91E10D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{387CCF6C-9A26-43F6-A639-0A82E91E10D8}.Release|Any CPU.Build.0 = Release|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Release|Any CPU.Build.0 = Release|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -117,6 +129,8 @@ Global
{B40F8584-5AFB-452C-AEFA-009C80CC23A9} = {EDE05FA8-8E73-4924-BC63-DD117127EEE1}
{D48C1FAB-3471-4CA0-8688-25E6F43F2C25} = {B5339DF7-5D1D-43BA-B332-74B825E1770E}
{387CCF6C-9A26-43F6-A639-0A82E91E10D8} = {EDE05FA8-8E73-4924-BC63-DD117127EEE1}
{4CDAC1AA-45C6-4157-8D8E-199050433048} = {B5339DF7-5D1D-43BA-B332-74B825E1770E}
{9C5213D6-3833-4570-8AE2-47E9F9017A8F} = {B5339DF7-5D1D-43BA-B332-74B825E1770E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BCBA19D9-F868-4C6D-8061-A2B91E06E3EC}
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions src/Neo.Extensions/Neo.Extensions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<PackageTags>NEO;Blockchain;Extensions</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Akka" Version="1.5.14" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Neo" />
<InternalsVisibleTo Include="Neo.IO" />
cschuchardt88 marked this conversation as resolved.
Show resolved Hide resolved
<InternalsVisibleTo Include="$(AssemblyName).Tests" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Neo/Utility.cs → src/Neo.Extensions/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Logger()
}
}

public static event LogEventHandler Logging;
Copy link
Member

@shargon shargon Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Neo.Extensions in Neo.Vm to avoid duplicate Neo.VM.Utility.StrictUTF8? This can be done later.

public static event LogEventHandler? Logging;

/// <summary>
/// A strict UTF8 encoding used in NEO system.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,32 @@ internal class ByteArrayComparer : IComparer<byte[]>
public static readonly ByteArrayComparer Default = new(1);
public static readonly ByteArrayComparer Reverse = new(-1);

private readonly int direction;
private readonly int _direction;

private ByteArrayComparer(int direction)
{
this.direction = direction;
_direction = direction;
}

public int Compare(byte[] x, byte[] y)
public int Compare(byte[]? x, byte[]? y)
{
return direction > 0
? CompareInternal(x, y)
: -CompareInternal(x, y);
if (x == y) return 0;
if (x is null && y is not null)
return _direction > 0 ? -y.Length : y.Length;
if (y is null && x is not null)
return _direction > 0 ? x.Length : -x.Length;
return _direction > 0 ?
CompareInternal(x!, y!) :
-CompareInternal(x!, y!);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int CompareInternal(byte[] x, byte[] y)
{
int length = Math.Min(x.Length, y.Length);
for (int i = 0; i < length; i++)
var length = Math.Min(x.Length, y.Length);
for (var i = 0; i < length; i++)
{
int r = x[i].CompareTo(y[i]);
var r = x[i].CompareTo(y[i]);
if (r != 0) return r;
}
return x.Length.CompareTo(y.Length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ internal class ByteArrayEqualityComparer : IEqualityComparer<byte[]>
{
public static readonly ByteArrayEqualityComparer Default = new();

public unsafe bool Equals(byte[] x, byte[] y)
public unsafe bool Equals(byte[]? x, byte[]? y)
{
if (ReferenceEquals(x, y)) return true;
if (x is null || y is null) return false;
int len = x.Length;
var len = x.Length;
if (len != y.Length) return false;
if (len == 0) return true;
fixed (byte* xp = x, yp = y)
Expand All @@ -48,8 +48,8 @@ public int GetHashCode(byte[] obj)
{
unchecked
{
int hash = 17;
foreach (byte element in obj)
var hash = 17;
foreach (var element in obj)
hash = hash * 31 + element;
return hash;
}
Expand Down
File renamed without changes.
Loading