From bad7388035c85a6014f7080b88ecba3ddb44072f Mon Sep 17 00:00:00 2001 From: Jiaming <71547730+Jiaaming@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:26:17 +0800 Subject: [PATCH] Update: architecture.md for merge server (#1520) --- ARCHITECTURE.md | 19 ++++++++++++++----- images/gradle-server-architecture.svg | 4 ++++ 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 images/gradle-server-architecture.svg diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index e56a00078..8c50de238 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -7,9 +7,18 @@ This extension contains three major components: # Gradle Server and Gradle Language Server - + +The gradle server is a long-running Java process that include two threads: 1. Build Server 2. Task Server -The extension uses client/server architecture using [gRPC](https://grpc.io/) as the interface between the client and server. It uses TypeScript (Node.js) on the client and Java on the server. A long running server provides very good performance. +## Build Server +The Gradle Build Server communicates with the Build Client using the [Build Server Protocol](https://build-server-protocol.github.io/) through named pipes. + +Due to Java's limited support for named pipes on Windows, a TypeScript layer named [BspProxy](./extension/src/bs/BspProxy.ts) was introduced. This layer acts as a middleware and it helps by sending messages back and forth and creating a safer named pipe JSON-RPC connection between the Gradle Build Server and the Build Client. + +For information about the Build Server itself, visit the [Gradle Build Server](https://github.com/microsoft/build-server-for-gradle). + +## Task Server +The task server and client using [gRPC](https://grpc.io/) as the interface between each other. It uses TypeScript (Node.js) on the client and Java on the server. A long running server provides very good performance. On extension activate, the client starts the Java gRPC server which remains running for the period the extension is activated. The server is packaged with the extension as a fat `.jar` file and is started by Node.js via executables generated by Gradle [CreateStartScripts](https://docs.gradle.org/current/dsl/org.gradle.jvm.application.tasks.CreateStartScripts.html). @@ -17,7 +26,7 @@ On extension activate, the client starts the Java gRPC server which remains runn The Java server uses the [Gradle Tooling Api](https://docs.gradle.org/current/userguide/third_party_integration.html#embedding) to discover projects & tasks, and to run Gradle tasks. -## Discovering Projects & Tasks +### Discovering Projects & Tasks Tasks belong to projects and projects are hierarchical, meaning projects can have sub-projects, and any/all projects in the tree can have tasks. @@ -29,7 +38,7 @@ Once the client has discovered the root projects for all workspaces, it requests The extension models the project hierarchical structure using the vscode tree view. The tree view data provider consumes the vscode tasks, and builds a tree of projects & tasks using the information provided in the task definitions. -## Running Tasks +### Running Tasks Gradle tasks can be run through either the [Tree View](https://code.visualstudio.com/api/extension-guides/tree-view) or the Command Palette. @@ -41,6 +50,6 @@ Gradle is used as the build system for the extension, for both the client and th Getting started on this extension is as simple as `./gradlew build`. -## Gradle Project Importer +# Gradle Project Importer The Gradle project importer works as a client of the [Gradle Build Server](https://github.com/microsoft/build-server-for-gradle). The importer communicates with the Gradle build server via Build Server Protocol, and convert the build targets into Java Projects of JDT Language Server. diff --git a/images/gradle-server-architecture.svg b/images/gradle-server-architecture.svg new file mode 100644 index 000000000..18fdb06d6 --- /dev/null +++ b/images/gradle-server-architecture.svg @@ -0,0 +1,4 @@ + + + +
Gradle Server
Task Server
Build Server
Client
Build Client
Gradle project Importer
bspProxy
Streaming RPC's
Get/Run/Cancel build task
Progress, 
STDOUT & STDERR
Build Server Protol
Message forwarding
Gradle Tooling API