Unverified Commit e07d36bb authored by Copilot's avatar Copilot Committed by GitHub
Browse files

Set GRAALVM_HOME for GraalVM distributions (#1146)

* Initial plan

* Set GRAALVM_HOME for GraalVM distributions

* Rebuild setup action bundle

---------

Co-authored-by: default avatarcopilot-swe-agent[bot] <[email protected]>
parent 69304e5b
Loading
Loading
Loading
Loading
+23
Changes for __tests__/distributors/graalvm-installer.test.ts: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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',
+4
Changes for dist/setup/index.js: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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();
+5
Changes for src/distributions/graalvm/installer.ts: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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<JavaDownloadRelease> {