From 96b5c942b42c113a4fcef1587a01d53a0d90eae3 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Mon, 11 Nov 2024 11:17:41 +0800 Subject: [PATCH 1/2] fix - Cannot see Delegate Test to Gradle option in VS Code (#1622) --- extension/src/Extension.ts | 46 ++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/extension/src/Extension.ts b/extension/src/Extension.ts index 6144f6002..60307413d 100644 --- a/extension/src/Extension.ts +++ b/extension/src/Extension.ts @@ -239,20 +239,7 @@ export class Extension { } private async activate(): Promise { - const testExtension = vscode.extensions.getExtension("vscjava.vscode-java-test"); - if (testExtension) { - testExtension.activate().then((api: any) => { - if (api) { - const testRunner: GradleTestRunner = this.buildServerController.getGradleTestRunner(api); - api.registerTestProfile("Delegate Test to Gradle", vscode.TestRunProfileKind.Run, testRunner); - api.registerTestProfile( - "Delegate Test to Gradle (Debug)", - vscode.TestRunProfileKind.Debug, - testRunner - ); - } - }); - } + this.registerGradleTestRunner(); const activated = !!(await this.rootProjectsStore.getProjectRoots()).length; if (!this.server.isReady()) { await this.server.start(); @@ -399,4 +386,35 @@ export class Extension { public getApi(): Api { return this.api; } + + private async registerGradleTestRunner(): Promise { + // To register the Gradle test runner, we need to wait for the Test Runner extension to be activated. + // The Test Runner extension depends on the Java extension, VS Code has an issue that it doesn't + // activate the Java extension before the Test Runner extension if we call activate() for the test extension. + // Thus here we need to activate the Java extension first. + const javaLsExtension = vscode.extensions.getExtension("redhat.java"); + if (!javaLsExtension) { + return; + } + + const javaLsApi = await javaLsExtension.activate(); + if (!javaLsApi.serverReady) { + return; + } + + await javaLsApi.serverReady(); + const testExtension = vscode.extensions.getExtension("vscjava.vscode-java-test"); + if (testExtension) { + const testRunnerApi = await testExtension.activate(); + if (testRunnerApi) { + const testRunner: GradleTestRunner = this.buildServerController.getGradleTestRunner(testRunnerApi); + testRunnerApi.registerTestProfile("Delegate Test to Gradle", vscode.TestRunProfileKind.Run, testRunner); + testRunnerApi.registerTestProfile( + "Delegate Test to Gradle (Debug)", + vscode.TestRunProfileKind.Debug, + testRunner + ); + } + } + } } From 28eb056642b010e242ec004f338ef278d204af94 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Tue, 12 Nov 2024 12:54:04 +0800 Subject: [PATCH 2/2] build - Prepare for 3.17.0 (#1625) --- CHANGELOG.md | 23 +++++++++++++++++++++++ extension/package-lock.json | 4 ++-- extension/package.json | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45f2ac799..2ddce46cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,29 @@ All notable changes to the "vscode-gradle" extension will be documented in this The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 3.17.0 +## What's Changed +* enhancement - Support onBuildShowMessage for BSP client by @jdneo in https://github.com/microsoft/vscode-gradle/pull/1583 +* enhancement - Extract classes.jar from *.aar by @Tanish-Ranjan in https://github.com/microsoft/vscode-gradle/pull/1594 +* enhancement - Gradle project view keeps project hierarchy by @jjohannes in https://github.com/microsoft/vscode-gradle/pull/1612 +* fix - java generate Random pipe path by @Jiaaming in https://github.com/microsoft/vscode-gradle/pull/1582 +* fix - Gradle test debug not working on version 8.5 and higher by @jdneo in https://github.com/microsoft/vscode-gradle/pull/1586 +* fix - Correct the gradle java version to jdt parsing by @jdneo in https://github.com/microsoft/vscode-gradle/pull/1590 +* fix - Fallback to /tmp/ when named pipe is too long by @jdneo in https://github.com/microsoft/vscode-gradle/pull/1591 +* fix - Add root project folder to each key in projectTreeItemMap by @jjohannes in https://github.com/microsoft/vscode-gradle/pull/1617 +* fix - Discover Gradle builds by looking for setting.gradle(.kts) by @jjohannes in https://github.com/microsoft/vscode-gradle/pull/1618 +* fix - Cannot see Delegate Test to Gradle option in VS Code by @jdneo in https://github.com/microsoft/vscode-gradle/pull/1622 +* docs - architecture image typo by @Jiaaming in https://github.com/microsoft/vscode-gradle/pull/1599 +* gbs - Parallelize source set retrieval. by @Arthurm1 in https://github.com/microsoft/build-server-for-gradle/pull/168 +* gbs - Find compatible GradleJavaHome and notify client in case of incompatibility by @Tanish-Ranjan in https://github.com/microsoft/build-server-for-gradle/pull/165 +* gbs - Handle java source/target defined at extension level by @Arthurm1 in https://github.com/microsoft/build-server-for-gradle/pull/188 + +## New Contributors +* @Tanish-Ranjan made their first contribution in https://github.com/microsoft/vscode-gradle/pull/1594 +* @jjohannes made their first contribution in https://github.com/microsoft/vscode-gradle/pull/1612 + +**Full Changelog**: https://github.com/microsoft/vscode-gradle/compare/3.16.4...3.17.0 + ## 3.16.4 ## What's Changed * fix - closeConnection will fail if pipe server hasn't been started by @Jiaaming in https://github.com/microsoft/vscode-gradle/pull/1579 diff --git a/extension/package-lock.json b/extension/package-lock.json index 84c48b048..5e431e4ac 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-gradle", - "version": "3.16.4", + "version": "3.17.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vscode-gradle", - "version": "3.16.4", + "version": "3.17.0", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "await-lock": "^2.2.2", diff --git a/extension/package.json b/extension/package.json index b70e9d3b6..ecd8f575a 100644 --- a/extension/package.json +++ b/extension/package.json @@ -2,7 +2,7 @@ "name": "vscode-gradle", "displayName": "Gradle for Java", "description": "Manage Gradle Projects, run Gradle tasks and provide better Gradle file authoring experience in VS Code", - "version": "3.16.4", + "version": "3.17.0", "private": true, "publisher": "vscjava", "aiKey": "b4aae7d0-c65b-4819-92bf-1d2f537ae7ce",