diff --git a/.azure-pipelines/vscode-gradle-rc.yml b/.azure-pipelines/vscode-gradle-rc.yml index a17fa455b..cac2bae36 100644 --- a/.azure-pipelines/vscode-gradle-rc.yml +++ b/.azure-pipelines/vscode-gradle-rc.yml @@ -81,6 +81,59 @@ steps: inputs: artifact: 'NOTICE.txt' path: $(Build.SourcesDirectory)/extension +- task: DownloadBuildArtifacts@1 + displayName: 'Download Build Server Artifacts' + inputs: + buildType: specific + project: 'a4d27ce2-a42d-4b71-8eef-78cee9a9728e' + pipeline: 15024 + downloadType: specific + extractTars: false +- task: CopyFiles@2 + displayName: 'Copy Build Server Artifacts' + inputs: + SourceFolder: '$(System.ArtifactsDirectory)/build-server/server/build/libs' + Contents: '**' + TargetFolder: $(Build.SourcesDirectory)/extension/server +- task: JavaToolInstaller@0 + displayName: Install Java 17 + inputs: + versionSpec: '17' + jdkArchitectureOption: 'x64' + jdkSourceOption: 'PreInstalled' +- task: Gradle@2 + displayName: Build + inputs: + gradleWrapperFile: 'gradlew' + gradleOptions: '-Xmx3072m' + tasks: ':extension:copyJdtlsPluginJar' +- task: EsrpCodeSigning@2 + displayName: 'ESRP CodeSigning' + inputs: + ConnectedServiceName: 'vscjavaci_codesign' + FolderPath: 'extension/server' + Pattern: 'com.microsoft.gradle.bs.importer-*.jar' + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "KeyCode" : "CP-447347-Java", + "OperationCode" : "JavaSign", + "Parameters" : { + "SigAlg" : "SHA256withRSA", + "Timestamp" : "-tsa http://sha256timestamp.ws.digicert.com/sha256/timestamp" + }, + "ToolName" : "sign", + "ToolVersion" : "1.0" + }, + { + "KeyCode" : "CP-447347-Java", + "OperationCode" : "JavaVerify", + "Parameters" : {}, + "ToolName" : "sign", + "ToolVersion" : "1.0" + } + ] - bash: | cd $(Build.SourcesDirectory)/extension npx @vscode/vsce@latest package diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 9a42c25b4..e56a00078 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,5 +1,12 @@ # Architecture Overview +This extension contains three major components: +- [A Gradle server](./gradle-server) that runs in the background and provides project & task information, and runs Gradle tasks. +- [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 + 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. @@ -33,3 +40,7 @@ Tasks are run via the `runBuild` gRPC method. Similar to getting project data, G Gradle is used as the build system for the extension, for both the client and the server. Gradle compiles the Java & Protobuf files and runs the relevant tasks to download & build all the dependencies of the project. The builds should work on Linux/MacOS & Windows. Getting started on this extension is as simple as `./gradlew build`. + +## 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/CONTRIBUTING.md b/CONTRIBUTING.md index 4d1425371..67548c214 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,8 +6,9 @@ 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. 1. Install [nvm](https://github.com/nvm-sh/nvm) -2. Install [Java version >= 8](https://adoptopenjdk.net/) +2. Install [Java version >= 8](https://adoptium.net/) 3. Change directory to the root of the project 4. Select Node version: `nvm use` 5. If using an Apple M1: @@ -17,6 +18,12 @@ Start by opening an issue using one of the issue templates, or propose a change Running the build for the first time can take a bit of time, but subsequent builds should be fast. +### 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` + ## Debugging Gradle plugin The extension uses a Gradle plugin (`com.microsoft.gradle.GradlePlugin`) to get a lot of information from your project's Gradle build. If you want to debug the Gradle plugin, you can follow these steps: diff --git a/README.md b/README.md index 44dfaa9c1..83470f2b5 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,8 @@ This extension contributes the following settings: - `gradle.disableConfirmations`: Disable the warning confirm messages when performing batch actions (eg clear tasks, stop daemons etc) (boolean) - `gradle.allowParallelRun`: Allow to run tasks in parallel, each running will create a new terminal. This configuration will override `gradle.reuseTerminals` and always create new task terminals when running or debugging a task. - `gradle.projectOpenBehaviour`: Specify the default method of opening newly created project ("Interactive", "Open" or "Add to Workspace") +- `java.gradle.buildServer.enabled`: Whether to use build server to synchronize Gradle project ("on" or "off") +- `java.gradle.buildServer.openBuildOutput`: Controls when the build output should open ("neverOpen", "openOnBuildStart" or "openOnBuildFailure") ## Gradle & Java Settings