From 86379922d2f15e8d5e9100eac4c8f33171ca1bf8 Mon Sep 17 00:00:00 2001 From: Michael Noah <92764374+mnoah1@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:31:50 -0400 Subject: [PATCH] include minimum jvm version in launch command (#10) (migrating existing commit from internal repo) Specify minimum --jvm argument when launching the BSP install command. This will allow coursier to attempt to find a version that matches if already installed, or download one that meets the requirements. This ensures a successful launch even in environments that do not have a new enough jvm version installed. --- src/server/install.ts | 2 +- src/test/suite/install.test.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/install.ts b/src/server/install.ts index 365a628..03296ff 100644 --- a/src/server/install.ts +++ b/src/server/install.ts @@ -166,7 +166,7 @@ export class BazelBSPInstaller { .join(' ') // Full install command including flags. - const installCommand = `"${coursierPath}" launch ${MAVEN_PACKAGE}:${config.serverVersion} -M ${INSTALL_METHOD} -- ${flagsString}` + const installCommand = `"${coursierPath}" launch --jvm 11+ ${MAVEN_PACKAGE}:${config.serverVersion} -M ${INSTALL_METHOD} -- ${flagsString}` // Report progress in output channel. const installProcess = cp.spawn(installCommand, {cwd: root, shell: true}) diff --git a/src/test/suite/install.test.ts b/src/test/suite/install.test.ts index 256ac21..d8cbb0c 100644 --- a/src/test/suite/install.test.ts +++ b/src/test/suite/install.test.ts @@ -87,6 +87,7 @@ suite('BSP Installer', () => { // Just confirm that coursier path was part of the spawn call, to leave flexibility for other changes to the command. assert.ok(spawnStub.getCalls()[0].args[0].includes(coursierPath)) + assert.ok(spawnStub.getCalls()[0].args[0].includes('--jvm 11+')) assert.ok(installResult) })