Fix gu integration for GraalVM for JDK 21.

Fixes #62.
This commit is contained in:
Fabio Niephaus 2023-09-20 12:59:33 +02:00
parent 2fb264a6b0
commit 8dd4f51a5e
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
4 changed files with 6 additions and 4 deletions

BIN
dist/cleanup/index.js generated vendored

Binary file not shown.

BIN
dist/main/index.js generated vendored

Binary file not shown.

View File

@ -1,9 +1,9 @@
import * as c from './constants'
import * as core from '@actions/core'
import * as semver from 'semver'
import {GRAALVM_PLATFORM} from './constants'
import {exec} from './utils'
import {join} from 'path'
import {gte as semverGte, valid as semverValid} from 'semver'
const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress']
const COMPONENT_TO_POST_INSTALL_HOOK = new Map<string, Map<string, string>>([
@ -34,10 +34,11 @@ export async function setUpGUComponents(
if (components.length == 0) {
return // nothing to do
}
const coercedJavaVersion = semver.coerce(javaVersion)
if (
graalVMVersion === c.VERSION_DEV ||
javaVersion === c.VERSION_DEV ||
(semverValid(javaVersion) && semverGte(javaVersion, '21.0.0'))
(coercedJavaVersion != null && semver.gte(coercedJavaVersion, '21.0.0'))
) {
if (components.length == 1 && components[0] === 'native-image') {
core.warning(

View File

@ -83,11 +83,13 @@ async function run(): Promise<void> {
throw new Error(`Unsupported distribution: ${distribution}`)
}
} else {
const coercedJavaVersion = semver.coerce(javaVersion)
switch (graalVMVersion) {
case c.VERSION_LATEST:
if (
javaVersion.startsWith('17') ||
(semver.valid(javaVersion) && semver.gte(javaVersion, '20.0.0'))
(coercedJavaVersion !== null &&
semver.gte(coercedJavaVersion, '20.0.0'))
) {
core.info(
`This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`
@ -106,7 +108,6 @@ async function run(): Promise<void> {
'Downloading GraalVM EE dev builds is not supported'
)
}
const coercedJavaVersion = semver.coerce(javaVersion)
if (
coercedJavaVersion !== null &&
!semver.gte(coercedJavaVersion, '21.0.0')