@@ -124362,6 +124362,8 @@ const base_installer_1 = __nccwpck_require__(59741);
124362124362const util_1 = __nccwpck_require__(92629);
124363124363const http_client_1 = __nccwpck_require__(96255);
124364124364const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
124365+ const IS_WINDOWS = process.platform === 'win32';
124366+ const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
124365124367class GraalVMDistribution extends base_installer_1.JavaBase {
124366124368 constructor(installerOptions) {
124367124369 super('GraalVM', installerOptions);
@@ -124387,10 +124389,10 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
124387124389 throw new Error(`Unsupported architecture: ${this.architecture}`);
124388124390 }
124389124391 if (!this.stable) {
124390- throw new Error('Early access versions are not supported' );
124392+ return this.findEABuildDownloadUrl(`${range}-ea` );
124391124393 }
124392124394 if (this.packageType !== 'jdk') {
124393- throw new Error('GraalVM JDK provides only the `jdk` package type');
124395+ throw new Error('GraalVM provides only the `jdk` package type');
124394124396 }
124395124397 const platform = this.getPlatform();
124396124398 const extension = (0, util_1.getDownloadArchiveExtension)();
@@ -124405,18 +124407,58 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
124405124407 fileUrl = `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
124406124408 }
124407124409 if (parseInt(major) < 17) {
124408- throw new Error('GraalVM JDK is only supported for JDK 17 and later');
124410+ throw new Error('GraalVM is only supported for JDK 17 and later');
124409124411 }
124410124412 const response = yield this.http.head(fileUrl);
124411124413 if (response.message.statusCode === http_client_1.HttpCodes.NotFound) {
124412- throw new Error(`Could not find GraalVM JDK for SemVer ${range}`);
124414+ throw new Error(`Could not find GraalVM for SemVer ${range}`);
124413124415 }
124414124416 if (response.message.statusCode !== http_client_1.HttpCodes.OK) {
124415- throw new Error(`Http request for GraalVM JDK failed with status code: ${response.message.statusCode}`);
124417+ throw new Error(`Http request for GraalVM failed with status code: ${response.message.statusCode}`);
124416124418 }
124417124419 return { url: fileUrl, version: range };
124418124420 });
124419124421 }
124422+ findEABuildDownloadUrl(javaEaVersion) {
124423+ return __awaiter(this, void 0, void 0, function* () {
124424+ const versions = yield this.fetchEAJson(javaEaVersion);
124425+ const latestVersion = versions.find(v => v.latest);
124426+ if (!latestVersion) {
124427+ throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
124428+ }
124429+ const arch = this.distributionArchitecture();
124430+ const file = latestVersion.files.find(f => f.arch === arch && f.platform === GRAALVM_PLATFORM);
124431+ if (!file || !file.filename.startsWith('graalvm-jdk-')) {
124432+ throw new Error(`Unable to find file metadata for '${javaEaVersion}'`);
124433+ }
124434+ return {
124435+ url: `${latestVersion.download_base_url}${file.filename}`,
124436+ version: latestVersion.version
124437+ };
124438+ });
124439+ }
124440+ fetchEAJson(javaEaVersion) {
124441+ return __awaiter(this, void 0, void 0, function* () {
124442+ const owner = 'graalvm';
124443+ const repository = 'oracle-graalvm-ea-builds';
124444+ const branch = 'main';
124445+ const filePath = `versions/${javaEaVersion}.json`;
124446+ const url = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
124447+ const headers = (0, util_1.getGitHubHttpHeaders)();
124448+ core.debug(`Trying to fetch available version info for GraalVM EA builds from '${url}'`);
124449+ let fetchedJson;
124450+ try {
124451+ fetchedJson = (yield this.http.getJson(url, headers)).result;
124452+ }
124453+ catch (err) {
124454+ throw Error(`Fetching version info for GraalVM EA builds from '${url}' failed with the error: ${err.message}`);
124455+ }
124456+ if (fetchedJson === null) {
124457+ throw Error(`No GraalVM EA build found. Are you sure java-version: '${javaEaVersion}' is correct?`);
124458+ }
124459+ return fetchedJson;
124460+ });
124461+ }
124420124462 getPlatform(platform = process.platform) {
124421124463 switch (platform) {
124422124464 case 'darwin':
0 commit comments