diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 8c50de238..1755c286b 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -5,10 +5,10 @@ This extension contains three major components: - [A Gradle language server](./gradle-language-server) that provides language features such as code completion and diagnostics for gradle script files. - [A Gradle project importer](./extension/jdtls.ext/com.microsoft.gradle.bs.importer) that imports Gradle projects detected by the [Gradle Build Server](https://github.com/microsoft/build-server-for-gradle) into the workspace. This importer works with the Language Support for Java extension. -# Gradle Server and Gradle Language Server +# Gradle Server -The gradle server is a long-running Java process that include two threads: 1. Build Server 2. Task Server +The gradle server is a long-running Java process that include three threads: 1. Build Server 2. Task Server 3. Language Server ## 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. @@ -17,6 +17,9 @@ Due to Java's limited support for named pipes on Windows, a TypeScript layer nam For information about the Build Server itself, visit the [Gradle Build Server](https://github.com/microsoft/build-server-for-gradle). +## Language Server +Language Server provides language features such as code completion and diagnostics for Gradle script files. It communicates with the Language Client using the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) through named pipe. + ## 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. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed6a0b136..508a6d084 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,30 +6,36 @@ Start by opening an issue using one of the issue templates, or propose a change ## Running the Project -### Build Gradle Server and Gradle Language Server. +### Prerequisites 1. Install [nvm](https://github.com/nvm-sh/nvm) 2. Install [Java version >= 17](https://adoptium.net/) -3. Change directory to the root of the project -4. Select Node version: `nvm use` -5. If using an Apple M1: +3. Select Node version: `nvm use` +4. If using an Apple M1: - Add `npm_arch=x64` to $HOME/.gradle/gradle.properties - Add `protoc_platform=osx-x86_64` to $HOME/.gradle/gradle.properties -6. If using Windows: +5. If using Windows: - The extension uses `grpc-tools@1.12.x` dependency which does not work out-of-the-box in Windows (check [this issues](https://github.com/grpc/grpc-node/issues/2338) for details), so you'll need to install some aditional DLLs if the project build is failed. - Download and start [Build Tools for Visual Studio 2022](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022). - Go to the **Individual Components** tab and select the following: - `MSVC v143 - VS 2022 C++ x64/x86 build tools (latest)` (replacing `x64/x86` with your arch) - `Windows Universal CRT SDK` - Click `Install` to add the components. -7. Build project files: `./gradlew build` -Running the build for the first time can take a bit of time, but subsequent builds should be fast. +### Build Gradle Build Server & Gradle Project Importer +Before proceeding with the build steps for Build Task Server & Language Server, you need to build the Gradle Build Server and its client (Gradle Project Importer) first. + +1. `cd extension` +2. `git clone https://github.com/microsoft/build-server-for-gradle.git ` +3. Build the Importer and Build Server jars: `../gradlew buildJars` + +### Build Task Server & Language Server +After building the Gradle Build Server and its client, proceed with the following steps. + +1. Change directory to the root of the project -### Build Gradle Project Importer -1. Install [Java version >= 17](https://adoptium.net/) -2. `cd extension` -3. `git clone https://github.com/microsoft/build-server-for-gradle.git ` -4. Build the Importer and Build Server jars: `../gradlew buildJars` +2. Build project files: `./gradlew build` + +Running the build for the first time can take a bit of time, but subsequent builds should be fast. ## Debugging Gradle plugin @@ -51,11 +57,6 @@ The extension uses a Gradle plugin (`com.microsoft.gradle.GradlePlugin`) to get > ``` > it indicates that the connection attempt to the Gradle Server was too slow. The [GradleBuildClient](/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/ImporterPlugin.java#L107) requires an active Gradle Server to successfully establish a connection. If you encounter this issue, please retry the connection promptly to avoid this error. -## Debugging Gradle Language Server (editing feature related) - -1. Run vscode launch configuration `Debug Language Server: Launch Extension`. -2. Run vscode launch configuration `Debug Language Server: Launch Language Server`. - ## Development Workflow Open the root of the project in VS Code. diff --git a/gradle-server/build.gradle b/gradle-server/build.gradle index bba2d9957..83dede14b 100644 --- a/gradle-server/build.gradle +++ b/gradle-server/build.gradle @@ -125,10 +125,13 @@ task serverStartScripts(type: CreateStartScripts) { } task copyRuntimeLibs(type: Copy) { - into "../extension/lib" from configurations.runtimeClasspath + into libsDir duplicatesStrategy = 'exclude' mustRunAfter ':gradle-language-server:customFatJar' + doFirst { + delete libsDir + } } project.tasks.named("processResources") { diff --git a/images/gradle-server-architecture.svg b/images/gradle-server-architecture.svg index 18fdb06d6..4e37f95bb 100644 --- a/images/gradle-server-architecture.svg +++ b/images/gradle-server-architecture.svg @@ -1,4 +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
+
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
Language
Server
Language Server Protol
Gradle Tooling API
\ No newline at end of file