Allow java-version: 'dev' if version: 'dev'.

Fixes #30
This commit is contained in:
Fabio Niephaus 2023-01-24 10:35:51 +01:00 committed by Fabio Niephaus
parent d01f5f519f
commit b53bc17dd7
8 changed files with 183 additions and 60 deletions

View File

@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
version: [latest, dev]
java-version: ['17', '19']
java-version: ['19']
components: ['native-image']
os: [macos-latest, windows-latest, ubuntu-latest]
include:
@ -42,6 +42,10 @@ jobs:
java-version: '17'
components: 'native-image'
os: windows-2022
- version: 'dev'
java-version: 'dev'
components: 'native-image'
os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
@ -77,10 +81,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ['22.3.0', 'latest']
java-version: ['11', '17', '19']
version: ['latest']
java-version: ['19']
components: ['native-image']
os: [macos-latest, windows-latest, ubuntu-latest]
include:
- version: '22.3.0'
java-version: '11'
components: 'native-image'
os: ubuntu-latest
- version: '22.3.0'
java-version: '17'
components: 'native-image'
os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
@ -172,8 +185,8 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'latest'
java-version: '19'
version: 'dev'
java-version: 'dev'
components: 'native-image'
native-image-musl: 'true'
native-image-job-reports: 'true'
@ -196,7 +209,7 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'dev'
version: 'latest'
java-version: '17'
components: 'espresso,llvm-toolchain,native-image,nodejs,python,R,ruby,wasm'
set-java-home: 'false'

View File

@ -116,7 +116,7 @@ jobs:
|-----------------|:--------:|-------------|
| `version`<br>*(required)* | n/a | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases]<br>`latest` for [latest stable release][stable],<br>`dev` for [latest dev build][dev-build],<br>`mandrel-X.Y.Z` (e.g., `mandrel-21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` for [latest Mandrel stable release][mandrel-stable]. |
| `gds-token` | `''` | Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up GraalVM Enterprise Edition (see [GraalVM EE template](#basic-graalvm-enterprise-edition-template)). |
| `java-version`<br>*(required)* | n/a | `'17'` or `'19'` for a specific Java version.<br>(`'8'`, `'11'`, `'16'` are supported for older GraalVM releases.) |
| `java-version`<br>*(required)* | n/a | `'17'` or `'19'` for a specific Java version, `'dev'` for the highest Java version available (requires `version: 'dev'`).<br>(`'8'`, `'11'`, `'16'` are supported for older GraalVM releases.) |
| `components` | `''` | Comma-spearated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
| `github-token` | `''` | Token for communication with the GitHub API. Please set to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps to reduce rate limiting issues. |
| `set-java-home` | `'true'` | If set to `'true'`, instructs the action to set `$JAVA_HOME` to the path of the GraalVM installation. Overrides any previous action or command that sets `$JAVA_HOME`. |

View File

@ -1,6 +1,9 @@
import * as path from 'path'
import * as graalvm from '../src/graalvm'
import {expect, test} from '@jest/globals'
import {getLatestRelease} from '../src/utils'
import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm'
import {GRAALVM_RELEASES_REPO} from '../src/constants'
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
@ -23,3 +26,27 @@ test('request invalid version/javaVersion', async () => {
expect(error.message).toContain('Are you sure version')
}
})
test('find version/javaVersion', async () => {
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestVersion = findGraalVMVersion(latestRelease)
expect(latestVersion).not.toBe('')
const latestJavaVersion = findHighestJavaVersion(latestRelease, latestVersion)
expect(latestJavaVersion).not.toBe('')
let error = new Error('unexpected')
try {
const invalidRelease = {...latestRelease, tag_name: 'invalid'}
findGraalVMVersion(invalidRelease)
} catch (err) {
error = err
}
expect(error.message).toContain('Could not find latest GraalVM release:')
try {
findHighestJavaVersion(latestRelease, 'invalid')
} catch (err) {
error = err
}
expect(error.message).toContain('Could not find highest Java version.')
})

3
dist/cleanup/index.js generated vendored
View File

@ -73818,7 +73818,7 @@ else {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
exports.INPUT_VERSION = 'version';
exports.INPUT_GDS_TOKEN = 'gds-token';
exports.INPUT_JAVA_VERSION = 'java-version';
@ -73837,6 +73837,7 @@ exports.GRAALVM_ARCH = determineGraalVMArchitecture();
exports.GRAALVM_FILE_EXTENSION = exports.IS_WINDOWS ? '.zip' : '.tar.gz';
exports.GRAALVM_GH_USER = 'graalvm';
exports.GRAALVM_PLATFORM = exports.IS_WINDOWS ? 'windows' : process.platform;
exports.GRAALVM_RELEASES_REPO = 'graalvm-ce-builds';
exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : '';
exports.MANDREL_NAMESPACE = 'mandrel-';
exports.GDS_BASE = 'https://gds.oracle.com/api/20220101';

78
dist/main/index.js generated vendored
View File

@ -73707,7 +73707,7 @@ try {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
exports.INPUT_VERSION = 'version';
exports.INPUT_GDS_TOKEN = 'gds-token';
exports.INPUT_JAVA_VERSION = 'java-version';
@ -73726,6 +73726,7 @@ exports.GRAALVM_ARCH = determineGraalVMArchitecture();
exports.GRAALVM_FILE_EXTENSION = exports.IS_WINDOWS ? '.zip' : '.tar.gz';
exports.GRAALVM_GH_USER = 'graalvm';
exports.GRAALVM_PLATFORM = exports.IS_WINDOWS ? 'windows' : process.platform;
exports.GRAALVM_RELEASES_REPO = 'graalvm-ce-builds';
exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : '';
exports.MANDREL_NAMESPACE = 'mandrel-';
exports.GDS_BASE = 'https://gds.oracle.com/api/20220101';
@ -74081,13 +74082,15 @@ const core = __importStar(__nccwpck_require__(2186));
const utils_1 = __nccwpck_require__(1314);
const semver_1 = __nccwpck_require__(1383);
const graalvm_1 = __nccwpck_require__(5254);
const constants_1 = __nccwpck_require__(9042);
function checkForUpdates(graalVMVersion, javaVersion) {
return __awaiter(this, void 0, void 0, function* () {
if (graalVMVersion === '22.3.0' && javaVersion === '11') {
core.notice('Please consider upgrading your project to Java 17+. The GraalVM 22.3.0 release is the last to support JDK11: https://github.com/oracle/graal/issues/5063');
return;
}
const latestGraalVMVersion = yield graalvm_1.getLatestReleaseVersion();
const latestRelease = yield utils_1.getLatestRelease(constants_1.GRAALVM_RELEASES_REPO);
const latestGraalVMVersion = graalvm_1.findGraalVMVersion(latestRelease);
const selectedVersion = utils_1.toSemVer(graalVMVersion);
const latestVersion = utils_1.toSemVer(latestGraalVMVersion);
if (semver_1.valid(selectedVersion) &&
@ -74697,50 +74700,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setUpGraalVMRelease = exports.setUpGraalVMDevBuild = exports.getLatestReleaseVersion = exports.setUpGraalVMLatest = void 0;
exports.findHighestJavaVersion = exports.setUpGraalVMRelease = exports.setUpGraalVMDevBuild = exports.findGraalVMVersion = exports.setUpGraalVMLatest = void 0;
const c = __importStar(__nccwpck_require__(9042));
const utils_1 = __nccwpck_require__(1314);
const gds_1 = __nccwpck_require__(9543);
const tool_cache_1 = __nccwpck_require__(7784);
const GRAALVM_CE_DL_BASE = 'https://github.com/graalvm/graalvm-ce-builds/releases/download';
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`;
const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds';
const GRAALVM_REPO_RELEASES = 'graalvm-ce-builds';
const GRAALVM_TAG_PREFIX = 'vm-';
function setUpGraalVMLatest(gdsToken, javaVersion) {
return __awaiter(this, void 0, void 0, function* () {
if (gdsToken.length > 0) {
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion);
}
const latestReleaseVersion = yield getLatestReleaseVersion();
return setUpGraalVMRelease(gdsToken, latestReleaseVersion, javaVersion);
const latestRelease = yield utils_1.getLatestRelease(c.GRAALVM_RELEASES_REPO);
const version = findGraalVMVersion(latestRelease);
return setUpGraalVMRelease(gdsToken, version, javaVersion);
});
}
exports.setUpGraalVMLatest = setUpGraalVMLatest;
function getLatestReleaseVersion() {
return __awaiter(this, void 0, void 0, function* () {
const latestRelease = yield utils_1.getLatestRelease(GRAALVM_REPO_RELEASES);
const tag_name = latestRelease.tag_name;
if (tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
function findGraalVMVersion(release) {
const tag_name = release.tag_name;
if (!tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
throw new Error(`Could not find latest GraalVM release: ${tag_name}`);
}
return tag_name.substring(GRAALVM_TAG_PREFIX.length, tag_name.length);
}
throw new Error(`Could not find latest GraalVM release: ${tag_name}`);
});
}
exports.getLatestReleaseVersion = getLatestReleaseVersion;
exports.findGraalVMVersion = findGraalVMVersion;
function setUpGraalVMDevBuild(gdsToken, javaVersion) {
return __awaiter(this, void 0, void 0, function* () {
if (gdsToken.length > 0) {
throw new Error('Downloading GraalVM EE dev builds is not supported');
}
const latestDevBuild = yield utils_1.getLatestRelease(GRAALVM_REPO_DEV_BUILDS);
const graalVMIdentifier = determineGraalVMIdentifier(false, 'dev', javaVersion);
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`;
for (const asset of latestDevBuild.assets) {
if (asset.name === expectedFileName) {
return utils_1.downloadAndExtractJDK(asset.browser_download_url);
let resolvedJavaVersion;
if (javaVersion == c.VERSION_DEV) {
resolvedJavaVersion = findHighestJavaVersion(latestDevBuild, c.VERSION_DEV);
}
else {
resolvedJavaVersion = javaVersion;
}
throw new Error(`Could not find GraalVM dev build for Java ${javaVersion}. It may no longer be available, so please consider upgrading the Java version. If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.`);
const downloadUrl = findDownloadUrl(latestDevBuild, resolvedJavaVersion);
return utils_1.downloadAndExtractJDK(downloadUrl);
});
}
exports.setUpGraalVMDevBuild = setUpGraalVMDevBuild;
@ -74759,6 +74760,37 @@ function setUpGraalVMRelease(gdsToken, version, javaVersion) {
});
}
exports.setUpGraalVMRelease = setUpGraalVMRelease;
function findHighestJavaVersion(release, version) {
const graalVMIdentifierPattern = determineGraalVMIdentifier(false, version, '(\\d+)');
const expectedFileNameRegExp = new RegExp(`^${graalVMIdentifierPattern}${c.GRAALVM_FILE_EXTENSION.replace(/\./g, '\\.')}$`);
let highestJavaVersion = 0;
for (const asset of release.assets) {
const matches = asset.name.match(expectedFileNameRegExp);
if (matches) {
const javaVersion = +matches[1];
if (javaVersion > highestJavaVersion) {
highestJavaVersion = javaVersion;
}
}
}
if (highestJavaVersion > 0) {
return String(highestJavaVersion);
}
else {
throw new Error('Could not find highest Java version. Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.');
}
}
exports.findHighestJavaVersion = findHighestJavaVersion;
function findDownloadUrl(release, javaVersion) {
const graalVMIdentifier = determineGraalVMIdentifier(false, c.VERSION_DEV, javaVersion);
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`;
for (const asset of release.assets) {
if (asset.name === expectedFileName) {
return asset.browser_download_url;
}
}
throw new Error(`Could not find GraalVM dev build for Java ${javaVersion}. It may no longer be available, so please consider upgrading the Java version. If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.`);
}
function determineGraalVMIdentifier(isEE, version, javaVersion) {
return `graalvm-${isEE ? 'ee' : 'ce'}-java${javaVersion}-${c.GRAALVM_PLATFORM}-${c.GRAALVM_ARCH}-${version}`;
}
@ -74775,7 +74807,7 @@ function downloadGraalVMCE(version, javaVersion) {
catch (error) {
if (error instanceof Error && error.message.includes('404')) {
// Not Found
throw new Error(`Failed to download ${graalVMIdentifier}. Are you sure version: '${version}' and javaVersion: '${javaVersion}' are correct?`);
throw new Error(`Failed to download ${graalVMIdentifier}. Are you sure version: '${version}' and java-version: '${javaVersion}' are correct?`);
}
throw new Error(`Failed to download ${graalVMIdentifier} (error: ${error}).`);
}

View File

@ -21,6 +21,7 @@ export const GRAALVM_ARCH = determineGraalVMArchitecture()
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
export const GRAALVM_GH_USER = 'graalvm'
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
export const GRAALVM_RELEASES_REPO = 'graalvm-ce-builds'
export const JDK_HOME_SUFFIX = IS_MACOS ? '/Contents/Home' : ''
export const MANDREL_NAMESPACE = 'mandrel-'

View File

@ -1,7 +1,8 @@
import * as core from '@actions/core'
import {toSemVer} from '../utils'
import {getLatestRelease, toSemVer} from '../utils'
import {lt, major, minor, valid} from 'semver'
import {getLatestReleaseVersion} from '../graalvm'
import {findGraalVMVersion} from '../graalvm'
import {GRAALVM_RELEASES_REPO} from '../constants'
export async function checkForUpdates(
graalVMVersion: string,
@ -13,7 +14,9 @@ export async function checkForUpdates(
)
return
}
const latestGraalVMVersion = await getLatestReleaseVersion()
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestGraalVMVersion = findGraalVMVersion(latestRelease)
const selectedVersion = toSemVer(graalVMVersion)
const latestVersion = toSemVer(latestGraalVMVersion)
if (

View File

@ -7,10 +7,8 @@ import {
import {downloadGraalVMEE} from './gds'
import {downloadTool} from '@actions/tool-cache'
const GRAALVM_CE_DL_BASE =
'https://github.com/graalvm/graalvm-ce-builds/releases/download'
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`
const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds'
const GRAALVM_REPO_RELEASES = 'graalvm-ce-builds'
const GRAALVM_TAG_PREFIX = 'vm-'
export async function setUpGraalVMLatest(
@ -20,18 +18,18 @@ export async function setUpGraalVMLatest(
if (gdsToken.length > 0) {
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion)
}
const latestReleaseVersion = await getLatestReleaseVersion()
return setUpGraalVMRelease(gdsToken, latestReleaseVersion, javaVersion)
const latestRelease = await getLatestRelease(c.GRAALVM_RELEASES_REPO)
const version = findGraalVMVersion(latestRelease)
return setUpGraalVMRelease(gdsToken, version, javaVersion)
}
export async function getLatestReleaseVersion(): Promise<string> {
const latestRelease = await getLatestRelease(GRAALVM_REPO_RELEASES)
const tag_name = latestRelease.tag_name
if (tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
return tag_name.substring(GRAALVM_TAG_PREFIX.length, tag_name.length)
}
export function findGraalVMVersion(release: c.LatestReleaseResponse['data']) {
const tag_name = release.tag_name
if (!tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
throw new Error(`Could not find latest GraalVM release: ${tag_name}`)
}
return tag_name.substring(GRAALVM_TAG_PREFIX.length, tag_name.length)
}
export async function setUpGraalVMDevBuild(
gdsToken: string,
@ -41,20 +39,14 @@ export async function setUpGraalVMDevBuild(
throw new Error('Downloading GraalVM EE dev builds is not supported')
}
const latestDevBuild = await getLatestRelease(GRAALVM_REPO_DEV_BUILDS)
const graalVMIdentifier = determineGraalVMIdentifier(
false,
'dev',
javaVersion
)
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
for (const asset of latestDevBuild.assets) {
if (asset.name === expectedFileName) {
return downloadAndExtractJDK(asset.browser_download_url)
let resolvedJavaVersion
if (javaVersion == c.VERSION_DEV) {
resolvedJavaVersion = findHighestJavaVersion(latestDevBuild, c.VERSION_DEV)
} else {
resolvedJavaVersion = javaVersion
}
}
throw new Error(
`Could not find GraalVM dev build for Java ${javaVersion}. It may no longer be available, so please consider upgrading the Java version. If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.`
)
const downloadUrl = findDownloadUrl(latestDevBuild, resolvedJavaVersion)
return downloadAndExtractJDK(downloadUrl)
}
export async function setUpGraalVMRelease(
@ -73,6 +65,60 @@ export async function setUpGraalVMRelease(
return downloadExtractAndCacheJDK(downloader, toolName, version)
}
export function findHighestJavaVersion(
release: c.LatestReleaseResponse['data'],
version: string
): string {
const graalVMIdentifierPattern = determineGraalVMIdentifier(
false,
version,
'(\\d+)'
)
const expectedFileNameRegExp = new RegExp(
`^${graalVMIdentifierPattern}${c.GRAALVM_FILE_EXTENSION.replace(
/\./g,
'\\.'
)}$`
)
let highestJavaVersion = 0
for (const asset of release.assets) {
const matches = asset.name.match(expectedFileNameRegExp)
if (matches) {
const javaVersion = +matches[1]
if (javaVersion > highestJavaVersion) {
highestJavaVersion = javaVersion
}
}
}
if (highestJavaVersion > 0) {
return String(highestJavaVersion)
} else {
throw new Error(
'Could not find highest Java version. Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
)
}
}
function findDownloadUrl(
release: c.LatestReleaseResponse['data'],
javaVersion: string
): string {
const graalVMIdentifier = determineGraalVMIdentifier(
false,
c.VERSION_DEV,
javaVersion
)
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
for (const asset of release.assets) {
if (asset.name === expectedFileName) {
return asset.browser_download_url
}
}
throw new Error(
`Could not find GraalVM dev build for Java ${javaVersion}. It may no longer be available, so please consider upgrading the Java version. If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.`
)
}
function determineGraalVMIdentifier(
isEE: boolean,
version: string,
@ -105,7 +151,7 @@ async function downloadGraalVMCE(
if (error instanceof Error && error.message.includes('404')) {
// Not Found
throw new Error(
`Failed to download ${graalVMIdentifier}. Are you sure version: '${version}' and javaVersion: '${javaVersion}' are correct?`
`Failed to download ${graalVMIdentifier}. Are you sure version: '${version}' and java-version: '${javaVersion}' are correct?`
)
}
throw new Error(