From 306523349f2cfded8652be004b890cdfbed64152 Mon Sep 17 00:00:00 2001 From: LPeter1997 Date: Wed, 31 Jan 2024 22:40:15 +0100 Subject: [PATCH] Publish JsonRpc package (#385) * Update publish.yaml * Internalized JsonRpc * Moved IVT to projectfile as per review comment --- .github/workflows/publish.yaml | 4 ++-- src/Draco.Compiler/Attributes.cs | 5 ----- src/Draco.Compiler/Draco.Compiler.csproj | 6 ++++++ src/Draco.Dap/Adapter/DebugAdapter.cs | 2 +- src/Draco.Dap/Adapter/IDebugClient.cs | 2 +- src/Draco.JsonRpc/Draco.JsonRpc.csproj | 5 +++++ src/Draco.JsonRpc/IJsonRpcClient.cs | 2 +- src/Draco.JsonRpc/IJsonRpcConnection.cs | 2 +- src/Draco.JsonRpc/IJsonRpcMethodHandler.cs | 2 +- src/Draco.JsonRpc/JsonRpcClientProxy.cs | 2 +- src/Draco.JsonRpc/JsonRpcConnection.cs | 2 +- src/Draco.JsonRpc/JsonRpcMethodHandler.cs | 2 +- src/Draco.Lsp/Server/ILanguageClient.cs | 2 +- src/Draco.Lsp/Server/LanguageServer.cs | 2 +- 14 files changed, 23 insertions(+), 17 deletions(-) delete mode 100644 src/Draco.Compiler/Attributes.cs diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e33b36ad4..4570ede7d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -58,8 +58,8 @@ jobs: run: | cd src $sdkProjects = "Compiler", "Compiler.Toolset", "Sdk", "ProjectTemplates" - $langserverProjects = "Compiler", "LanguageServer", "Lsp" - $debugadapterProjects = "DebugAdapter", "Dap" + $langserverProjects = "Compiler", "LanguageServer", "Lsp", "JsonRpc" + $debugadapterProjects = "DebugAdapter", "Dap", "JsonRpc" $projects = @() if ($${{ github.event.inputs.deploy-sdk }}) { $projects += $sdkProjects; } diff --git a/src/Draco.Compiler/Attributes.cs b/src/Draco.Compiler/Attributes.cs deleted file mode 100644 index 420acbb17..000000000 --- a/src/Draco.Compiler/Attributes.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Draco.Compiler.Tests")] -[assembly: InternalsVisibleTo("Draco.Compiler.Benchmarks")] -[assembly: InternalsVisibleTo("Draco.Compiler.Fuzzer")] diff --git a/src/Draco.Compiler/Draco.Compiler.csproj b/src/Draco.Compiler/Draco.Compiler.csproj index 9297f2e3e..f85843bcb 100644 --- a/src/Draco.Compiler/Draco.Compiler.csproj +++ b/src/Draco.Compiler/Draco.Compiler.csproj @@ -7,6 +7,12 @@ true + + + + + + diff --git a/src/Draco.Dap/Adapter/DebugAdapter.cs b/src/Draco.Dap/Adapter/DebugAdapter.cs index b050c9eaa..925ba59fe 100644 --- a/src/Draco.Dap/Adapter/DebugAdapter.cs +++ b/src/Draco.Dap/Adapter/DebugAdapter.cs @@ -38,7 +38,7 @@ public static IDebugClient Connect(IDuplexPipe stream) /// The task that completes when the communication is over. public static async Task RunAsync(this IDebugClient client, IDebugAdapter adapter) { - var connection = client.Connection; + var connection = ((DebugClientProxy)client).Connection; // Register adapter methods RegisterAdapterRpcMethods(adapter, connection); diff --git a/src/Draco.Dap/Adapter/IDebugClient.cs b/src/Draco.Dap/Adapter/IDebugClient.cs index 6e2b46dcd..b286b8cf7 100644 --- a/src/Draco.Dap/Adapter/IDebugClient.cs +++ b/src/Draco.Dap/Adapter/IDebugClient.cs @@ -8,7 +8,7 @@ namespace Draco.Dap.Adapter; /// /// An interface representing the debug client on the remote. /// -public interface IDebugClient : IJsonRpcClient +public interface IDebugClient { [Event("initialized")] public Task Initialized(); diff --git a/src/Draco.JsonRpc/Draco.JsonRpc.csproj b/src/Draco.JsonRpc/Draco.JsonRpc.csproj index bdfab7cc6..0c77b25f0 100644 --- a/src/Draco.JsonRpc/Draco.JsonRpc.csproj +++ b/src/Draco.JsonRpc/Draco.JsonRpc.csproj @@ -6,6 +6,11 @@ enable + + + + + diff --git a/src/Draco.JsonRpc/IJsonRpcClient.cs b/src/Draco.JsonRpc/IJsonRpcClient.cs index 0ad1995ca..ad3ff27e7 100644 --- a/src/Draco.JsonRpc/IJsonRpcClient.cs +++ b/src/Draco.JsonRpc/IJsonRpcClient.cs @@ -3,7 +3,7 @@ namespace Draco.JsonRpc; /// /// The interface all JSON-RPC clients must implement. /// -public interface IJsonRpcClient +internal interface IJsonRpcClient { /// /// The connection. diff --git a/src/Draco.JsonRpc/IJsonRpcConnection.cs b/src/Draco.JsonRpc/IJsonRpcConnection.cs index 816ee673e..d4406bc5f 100644 --- a/src/Draco.JsonRpc/IJsonRpcConnection.cs +++ b/src/Draco.JsonRpc/IJsonRpcConnection.cs @@ -3,7 +3,7 @@ namespace Draco.JsonRpc; /// /// Represents a JSON RPC connection. /// -public interface IJsonRpcConnection +internal interface IJsonRpcConnection { /// /// Registers a message handler. diff --git a/src/Draco.JsonRpc/IJsonRpcMethodHandler.cs b/src/Draco.JsonRpc/IJsonRpcMethodHandler.cs index a1cd186bf..d585f04ba 100644 --- a/src/Draco.JsonRpc/IJsonRpcMethodHandler.cs +++ b/src/Draco.JsonRpc/IJsonRpcMethodHandler.cs @@ -5,7 +5,7 @@ namespace Draco.JsonRpc; /// /// A registered JSON RPC method handler. /// -public interface IJsonRpcMethodHandler +internal interface IJsonRpcMethodHandler { /// /// The name of the method this handles. diff --git a/src/Draco.JsonRpc/JsonRpcClientProxy.cs b/src/Draco.JsonRpc/JsonRpcClientProxy.cs index 0f9dd0c00..428d1da05 100644 --- a/src/Draco.JsonRpc/JsonRpcClientProxy.cs +++ b/src/Draco.JsonRpc/JsonRpcClientProxy.cs @@ -6,7 +6,7 @@ namespace Draco.JsonRpc; /// /// A proxy type for a JSON-RPC client. /// -public abstract class JsonRpcClientProxy : DispatchProxy +internal abstract class JsonRpcClientProxy : DispatchProxy { /// /// The connection of the client. diff --git a/src/Draco.JsonRpc/JsonRpcConnection.cs b/src/Draco.JsonRpc/JsonRpcConnection.cs index 8d7693ff9..ae7539b28 100644 --- a/src/Draco.JsonRpc/JsonRpcConnection.cs +++ b/src/Draco.JsonRpc/JsonRpcConnection.cs @@ -13,7 +13,7 @@ namespace Draco.JsonRpc; /// /// The message type. /// The error descriptor. -public abstract class JsonRpcConnection : IJsonRpcConnection +internal abstract class JsonRpcConnection : IJsonRpcConnection { protected sealed class JsonRpcResponseException : Exception { diff --git a/src/Draco.JsonRpc/JsonRpcMethodHandler.cs b/src/Draco.JsonRpc/JsonRpcMethodHandler.cs index 55842a271..4778f6007 100644 --- a/src/Draco.JsonRpc/JsonRpcMethodHandler.cs +++ b/src/Draco.JsonRpc/JsonRpcMethodHandler.cs @@ -5,7 +5,7 @@ namespace Draco.JsonRpc; /// /// Utilities for construction s. /// -public static class JsonRpcMethodHandler +internal static class JsonRpcMethodHandler { /// /// Constructs a new from a given . diff --git a/src/Draco.Lsp/Server/ILanguageClient.cs b/src/Draco.Lsp/Server/ILanguageClient.cs index a711fc9d7..9c6cb1159 100644 --- a/src/Draco.Lsp/Server/ILanguageClient.cs +++ b/src/Draco.Lsp/Server/ILanguageClient.cs @@ -10,7 +10,7 @@ namespace Draco.Lsp.Server; /// /// An interface representing the language client on the remote. /// -public interface ILanguageClient : IJsonRpcClient +public interface ILanguageClient { // Language features diff --git a/src/Draco.Lsp/Server/LanguageServer.cs b/src/Draco.Lsp/Server/LanguageServer.cs index 089474ece..aee33fa5d 100644 --- a/src/Draco.Lsp/Server/LanguageServer.cs +++ b/src/Draco.Lsp/Server/LanguageServer.cs @@ -38,7 +38,7 @@ public static ILanguageClient Connect(IDuplexPipe stream) /// The task that completes when the communication is over. public static async Task RunAsync(this ILanguageClient client, ILanguageServer server) { - var connection = client.Connection; + var connection = ((LanguageClientProxy)client).Connection; // Register server methods RegisterServerRpcMethods(server, connection);