From e07d36bbdd53f023ff03ddec008064bf899a927e Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 27 Jul 2026 22:27:24 -0400 Subject: [PATCH] Set GRAALVM_HOME for GraalVM distributions (#1146) * Initial plan * Set GRAALVM_HOME for GraalVM distributions * Rebuild setup action bundle --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .../distributors/graalvm-installer.test.ts | 23 +++++++++++++++++++ dist/setup/index.js | 4 ++++ src/distributions/graalvm/installer.ts | 5 ++++ 3 files changed, 32 insertions(+) diff --git a/__tests__/distributors/graalvm-installer.test.ts b/__tests__/distributors/graalvm-installer.test.ts index c2e303d9..0882c6ca 100644 --- a/__tests__/distributors/graalvm-installer.test.ts +++ b/__tests__/distributors/graalvm-installer.test.ts @@ -166,6 +166,29 @@ describe('GraalVMDistribution', () => { }); }); + describe('setJavaDefault', () => { + it('should set GRAALVM_HOME for Oracle GraalVM', () => { + (distribution as any).setJavaDefault('17.0.5', '/cached/java/path'); + + expect(core.exportVariable).toHaveBeenCalledWith( + 'GRAALVM_HOME', + '/cached/java/path' + ); + }); + + it('should set GRAALVM_HOME for GraalVM Community', () => { + (communityDistribution as any).setJavaDefault( + '17.0.5', + '/cached/java/path' + ); + + expect(core.exportVariable).toHaveBeenCalledWith( + 'GRAALVM_HOME', + '/cached/java/path' + ); + }); + }); + describe('downloadTool', () => { const javaRelease = { version: '17.0.5', diff --git a/dist/setup/index.js b/dist/setup/index.js index 89e5b84e..c547ea81 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -131328,6 +131328,10 @@ class GraalVMDistribution extends JavaBase { throw error; } } + setJavaDefault(version, toolPath) { + super.setJavaDefault(version, toolPath); + exportVariable('GRAALVM_HOME', toolPath); + } async findPackageForDownload(range) { this.validateVersionRange(range); const arch = this.getSupportedArchitecture(); diff --git a/src/distributions/graalvm/installer.ts b/src/distributions/graalvm/installer.ts index ccbb5b44..d2255a22 100644 --- a/src/distributions/graalvm/installer.ts +++ b/src/distributions/graalvm/installer.ts @@ -110,6 +110,11 @@ export class GraalVMDistribution extends JavaBase { } } + protected setJavaDefault(version: string, toolPath: string): void { + super.setJavaDefault(version, toolPath); + core.exportVariable('GRAALVM_HOME', toolPath); + } + protected async findPackageForDownload( range: string ): Promise {