Skip to content

Commit e07d36b

Browse files
authored
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>
1 parent 69304e5 commit e07d36b

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎__tests__/distributors/graalvm-installer.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,29 @@ describe('GraalVMDistribution', () => {
166166
});
167167
});
168168

169+
describe('setJavaDefault', () => {
170+
it('should set GRAALVM_HOME for Oracle GraalVM', () => {
171+
(distribution as any).setJavaDefault('17.0.5', '/cached/java/path');
172+
173+
expect(core.exportVariable).toHaveBeenCalledWith(
174+
'GRAALVM_HOME',
175+
'/cached/java/path'
176+
);
177+
});
178+
179+
it('should set GRAALVM_HOME for GraalVM Community', () => {
180+
(communityDistribution as any).setJavaDefault(
181+
'17.0.5',
182+
'/cached/java/path'
183+
);
184+
185+
expect(core.exportVariable).toHaveBeenCalledWith(
186+
'GRAALVM_HOME',
187+
'/cached/java/path'
188+
);
189+
});
190+
});
191+
169192
describe('downloadTool', () => {
170193
const javaRelease = {
171194
version: '17.0.5',

‎dist/setup/index.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131328,6 +131328,10 @@ class GraalVMDistribution extends JavaBase {
131328131328
throw error;
131329131329
}
131330131330
}
131331+
setJavaDefault(version, toolPath) {
131332+
super.setJavaDefault(version, toolPath);
131333+
exportVariable('GRAALVM_HOME', toolPath);
131334+
}
131331131335
async findPackageForDownload(range) {
131332131336
this.validateVersionRange(range);
131333131337
const arch = this.getSupportedArchitecture();

‎src/distributions/graalvm/installer.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ export class GraalVMDistribution extends JavaBase {
110110
}
111111
}
112112

113+
protected setJavaDefault(version: string, toolPath: string): void {
114+
super.setJavaDefault(version, toolPath);
115+
core.exportVariable('GRAALVM_HOME', toolPath);
116+
}
117+
113118
protected async findPackageForDownload(
114119
range: string
115120
): Promise<JavaDownloadRelease> {

0 commit comments

Comments
 (0)