Skip to content

Commit

Permalink
Fix gu integration for GraalVM for JDK 21.
Browse files Browse the repository at this point in the history
Fixes #62.
  • Loading branch information
fniephaus committed Sep 20, 2023
1 parent 2fb264a commit 8dd4f51
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 36 deletions.
55 changes: 41 additions & 14 deletions dist/cleanup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 47 additions & 18 deletions dist/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/gu.ts
Original file line number Diff line number Diff line change
@@ -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>>([
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).`
Expand All @@ -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')
Expand Down

0 comments on commit 8dd4f51

Please sign in to comment.