Skip to content

Commit

Permalink
Fix GraalVM for JDK 17+ detection in MSVC feature.
Browse files Browse the repository at this point in the history
Fixes #88
  • Loading branch information
fniephaus committed Mar 11, 2024
1 parent 5393c3d commit 636adab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
14 changes: 5 additions & 9 deletions dist/main/index.js

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

10 changes: 7 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,22 @@ async function run(): Promise<void> {
const enableCheckForUpdates =
core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true'
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
const isGraalVMforJDK17OrLater =
distribution.length > 0 || graalVMVersion.length == 0

if (c.IS_WINDOWS) {
setUpWindowsEnvironment(javaVersion, graalVMVersion)
setUpWindowsEnvironment(
javaVersion,
graalVMVersion,
isGraalVMforJDK17OrLater
)
}
await setUpDependencies(components)
if (enableNativeImageMusl) {
await setUpNativeImageMusl()
}

// Download GraalVM JDK
const isGraalVMforJDK17OrLater =
distribution.length > 0 || graalVMVersion.length == 0
let graalVMHome
if (isGraalVMforJDK17OrLater) {
if (
Expand Down
13 changes: 4 additions & 9 deletions src/msvc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,13 @@ function findVcvarsallPath(): string {

export function setUpWindowsEnvironment(
javaVersion: string,
graalVMVersion: string
graalVMVersion: string,
isGraalVMforJDK17OrLater: boolean
): void {
if (javaVersion === javaVersion || graalVMVersion === VERSION_DEV) {
return // no longer required in dev builds
}
const javaVersionSemVer = semver.coerce(javaVersion)
if (
javaVersionSemVer &&
semver.valid(javaVersionSemVer) &&
semver.gte(javaVersionSemVer, '18.0.0')
) {
return // no longer required in GraalVM for JDK 17 and later. JDK 17 builds from 22.3 still need this, so skip 17.X.X
} else if (isGraalVMforJDK17OrLater) {
return // no longer required in GraalVM for JDK 17 and later.
}

core.startGroup('Updating Windows environment...')
Expand Down

0 comments on commit 636adab

Please sign in to comment.